Skip to content
This repository has been archived by the owner on Oct 17, 2018. It is now read-only.

Commit

Permalink
use a list for all valid agg types
Browse files Browse the repository at this point in the history
  • Loading branch information
Chao Wang committed May 24, 2017
1 parent 17cb1a4 commit 2d50d77
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions policy/unaggregated/aggregation_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,35 +57,36 @@ const (

var (
emptyStruct struct{}
// EmptyAggregationTypes is an empty list of AggregationTypes.
// EmptyAggregationTypes is an empty list of aggregation types.
EmptyAggregationTypes AggregationTypes

// EmptyAggregationID is an empty AggregationID.
EmptyAggregationID AggregationID

validAggregationTypesMap = map[AggregationType]struct{}{
Last: emptyStruct,
Lower: emptyStruct,
Upper: emptyStruct,
Mean: emptyStruct,
Median: emptyStruct,
Count: emptyStruct,
Sum: emptyStruct,
SumSq: emptyStruct,
Stdev: emptyStruct,
P50: emptyStruct,
P95: emptyStruct,
P99: emptyStruct,
P999: emptyStruct,
P9999: emptyStruct,
// ValidAggregationTypes is the list of valid aggregation types
ValidAggregationTypes = []AggregationType{
Last,
Lower,
Upper,
Mean,
Median,
Count,
Sum,
SumSq,
Stdev,
P50,
P95,
P99,
P999,
P9999,
}

aggregationTypeStringMap map[string]AggregationType
)

func init() {
aggregationTypeStringMap = make(map[string]AggregationType, totalAggregationTypes)
for aggType := range validAggregationTypesMap {
for _, aggType := range ValidAggregationTypes {
aggregationTypeStringMap[aggType.String()] = aggType
}
}
Expand Down

0 comments on commit 2d50d77

Please sign in to comment.