aboutsummaryrefslogtreecommitdiffstats
path: root/library/go/yandex/unistat/aggr/aggr.go
blob: acd933ec55368870ba8607e01d0af8c3b198e01a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package aggr

import "a.yandex-team.ru/library/go/yandex/unistat"

// Histogram returns delta histogram aggregation (dhhh).
func Histogram() unistat.Aggregation {
	return unistat.StructuredAggregation{
		AggregationType: unistat.Delta,
		Group:           unistat.Hgram,
		MetaGroup:       unistat.Hgram,
		Rollup:          unistat.Hgram,
	}
}

// AbsoluteHistogram returns absolute histogram aggregation (ahhh).
func AbsoluteHistogram() unistat.Aggregation {
	return unistat.StructuredAggregation{
		AggregationType: unistat.Absolute,
		Group:           unistat.Hgram,
		MetaGroup:       unistat.Hgram,
		Rollup:          unistat.Hgram,
	}
}

// Counter returns counter aggregation (dmmm)
func Counter() unistat.Aggregation {
	return unistat.StructuredAggregation{
		AggregationType: unistat.Delta,
		Group:           unistat.Sum,
		MetaGroup:       unistat.Sum,
		Rollup:          unistat.Sum,
	}
}

// Absolute returns value aggregation (ammm)
func Absolute() unistat.Aggregation {
	return unistat.StructuredAggregation{
		AggregationType: unistat.Absolute,
		Group:           unistat.Sum,
		MetaGroup:       unistat.Sum,
		Rollup:          unistat.Sum,
	}
}

// SummAlias corresponds to _summ suffix
type SummAlias struct{}

func (s SummAlias) Suffix() string {
	return "summ"
}

// SummAlias corresponds to _hgram suffix
type HgramAlias struct{}

func (s HgramAlias) Suffix() string {
	return "hgram"
}

// SummAlias corresponds to _max suffix
type MaxAlias struct{}

func (s MaxAlias) Suffix() string {
	return "max"
}