Skip to content

Commit

Permalink
consistency: timeseries: update for NewTimeSeries(name string)
Browse files Browse the repository at this point in the history
  • Loading branch information
grokify committed Jul 26, 2021
1 parent 563b9bb commit 96148d5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
11 changes: 4 additions & 7 deletions data/histogram/histogram_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,7 @@ func (hset *HistogramSet) LeafStats(name string) *Histogram {
}

func (hset *HistogramSet) ToTimeSeriesDistinct() (timeseries.TimeSeries, error) {
ds := timeseries.NewTimeSeries()
ds.SeriesName = hset.Name
ds := timeseries.NewTimeSeries(hset.Name)
for rfc3339, hist := range hset.HistogramMap {
dt, err := time.Parse(time.RFC3339, rfc3339)
if err != nil {
Expand Down Expand Up @@ -312,12 +311,10 @@ func (hset *HistogramSet) DatetimeKeyToQuarter(name string) (*HistogramSet, erro
return fsetQtr, nil
}

// DatetimeKeyCount returns a TimeSeries when
// the first key is a RFC3339 time and a sum of items
// is desired per time.
// DatetimeKeyCount returns a TimeSeries when the first key is a RFC3339 time
// and a sum of items is desired per time.
func (hset *HistogramSet) DatetimeKeyCount() (timeseries.TimeSeries, error) {
ts := timeseries.NewTimeSeries()
ts.SeriesName = hset.Name
ts := timeseries.NewTimeSeries(hset.Name)
for rfc3339, hist := range hset.HistogramMap {
dt, err := time.Parse(time.RFC3339, rfc3339)
if err != nil {
Expand Down
5 changes: 2 additions & 3 deletions data/timeseries/interval/data_series_set_interval.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,7 @@ func (set *TimeSeriesSet) addAllSeries(allSeriesName string) {
if len(strings.TrimSpace(allSeriesName)) == 0 {
allSeriesName = "All"
}
allSeries := timeseries.NewTimeSeries()
allSeries.SeriesName = allSeriesName
allSeries := timeseries.NewTimeSeries(allSeriesName)

for _, series := range set.SourceSeriesMap {
for _, item := range series.ItemMap {
Expand Down Expand Up @@ -129,7 +128,7 @@ func (set *TimeSeriesSet) GetTimeSeries(seriesName string, seriesType SeriesType
}

func (set *TimeSeriesSet) BuildOutputSeries(source timeseries.TimeSeries) (timeseries.TimeSeries, error) {
output := timeseries.NewTimeSeries()
output := timeseries.NewTimeSeries(set.AllSeriesName)
for _, item := range source.ItemMap {
output.SeriesName = item.SeriesName
ivalStart, err := timeutil.IntervalStart(
Expand Down

0 comments on commit 96148d5

Please sign in to comment.