From 232014ea50db4d2318960a0a3c67eded40ff6db2 Mon Sep 17 00:00:00 2001 From: JBD Date: Wed, 28 Mar 2018 14:38:58 -0700 Subject: [PATCH] Remove all mentions of mean aggregation (#651) Fixes #650. --- README.md | 4 +--- exporter/prometheus/prometheus.go | 6 ++---- exporter/stackdriver/stats.go | 4 +--- internal/readme/source.md | 3 +-- stats/view/aggregation.go | 3 +-- stats/view/aggregation_data.go | 2 +- stats/view/aggtype_string.go | 4 ++-- stats/view/doc.go | 5 ++--- stats/view/view.go | 2 +- 9 files changed, 12 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 1479e4721..9aac5a939 100644 --- a/README.md +++ b/README.md @@ -103,18 +103,16 @@ set of recorded data points (measurements). Views have two parts: the tags to group by and the aggregation type used. -Currently four types of aggregations are supported: +Currently three types of aggregations are supported: * CountAggregation is used to count the number of times a sample was recorded. * DistributionAggregation is used to provide a histogram of the values of the samples. * SumAggregation is used to sum up all sample values. -* MeanAggregation is used to calculate the mean of sample values. [embedmd]:# (stats.go aggs) ```go distAgg := view.Distribution(0, 1<<32, 2<<32, 3<<32) countAgg := view.Count() sumAgg := view.Sum() -meanAgg := view.Mean() ``` Here we create a view with the DistributionAggregation over our measure. diff --git a/exporter/prometheus/prometheus.go b/exporter/prometheus/prometheus.go index 70307491d..a3924b550 100644 --- a/exporter/prometheus/prometheus.go +++ b/exporter/prometheus/prometheus.go @@ -144,10 +144,8 @@ func (o *Options) onError(err error) { // ExportView exports to the Prometheus if view data has one or more rows. // Each OpenCensus AggregationData will be converted to // corresponding Prometheus Metric: SumData will be converted -// to Untyped Metric, CountData will be Counter Metric, -// DistributionData will be Histogram Metric, and MeanData -// will be Summary Metric. Please note the Summary Metric from -// MeanData does not have any quantiles. +// to Untyped Metric, CountData will be a Counter Metric, +// DistributionData will be a Histogram Metric. func (e *Exporter) ExportView(vd *view.Data) { if len(vd.Rows) == 0 { return diff --git a/exporter/stackdriver/stats.go b/exporter/stackdriver/stats.go index 71156c136..a3c7f0f9a 100644 --- a/exporter/stackdriver/stats.go +++ b/exporter/stackdriver/stats.go @@ -261,8 +261,6 @@ func (e *statsExporter) createMeasure(ctx context.Context, vd *view.Data) error case *stats.Float64Measure: valueType = metricpb.MetricDescriptor_DOUBLE } - case view.AggTypeMean: - valueType = metricpb.MetricDescriptor_DISTRIBUTION case view.AggTypeDistribution: valueType = metricpb.MetricDescriptor_DISTRIBUTION default: @@ -392,7 +390,7 @@ func equalAggTagKeys(md *metricpb.MetricDescriptor, agg *view.Aggregation, keys case metricpb.MetricDescriptor_DOUBLE: aggTypeMatch = agg.Type == view.AggTypeSum case metricpb.MetricDescriptor_DISTRIBUTION: - aggTypeMatch = agg.Type == view.AggTypeMean || agg.Type == view.AggTypeDistribution + aggTypeMatch = agg.Type == view.AggTypeDistribution } if !aggTypeMatch { diff --git a/internal/readme/source.md b/internal/readme/source.md index 31aaa4c97..158885d43 100644 --- a/internal/readme/source.md +++ b/internal/readme/source.md @@ -91,11 +91,10 @@ set of recorded data points (measurements). Views have two parts: the tags to group by and the aggregation type used. -Currently four types of aggregations are supported: +Currently three types of aggregations are supported: * CountAggregation is used to count the number of times a sample was recorded. * DistributionAggregation is used to provide a histogram of the values of the samples. * SumAggregation is used to sum up all sample values. -* MeanAggregation is used to calculate the mean of sample values. [embedmd]:# (stats.go aggs) diff --git a/stats/view/aggregation.go b/stats/view/aggregation.go index c3272e52e..5c9859182 100644 --- a/stats/view/aggregation.go +++ b/stats/view/aggregation.go @@ -24,12 +24,11 @@ const ( AggTypeNone AggType = iota // no aggregation; reserved for future use. AggTypeCount // the count aggregation, see Count. AggTypeSum // the sum aggregation, see Sum. - AggTypeMean // the mean aggregation, see Mean. AggTypeDistribution // the distribution aggregation, see Distribution. ) // Aggregation represents a data aggregation method. Use one of the functions: -// Count, Sum, Mean, or Distribution to construct an Aggregation. +// Count, Sum, or Distribution to construct an Aggregation. type Aggregation struct { Type AggType // Type is the AggType of this Aggregation. Buckets []float64 // Buckets are the bucket endpoints if this Aggregation represents a distribution, see Distribution. diff --git a/stats/view/aggregation_data.go b/stats/view/aggregation_data.go index 09cc7c141..15bf2970a 100644 --- a/stats/view/aggregation_data.go +++ b/stats/view/aggregation_data.go @@ -44,7 +44,7 @@ func newCountData(v int64) *CountData { func (a *CountData) isAggregationData() bool { return true } -func (a *CountData) addSample(_ float64) { +func (a *CountData) addSample(v float64) { *a = *a + 1 } diff --git a/stats/view/aggtype_string.go b/stats/view/aggtype_string.go index b6ad7411b..3cf9e402d 100644 --- a/stats/view/aggtype_string.go +++ b/stats/view/aggtype_string.go @@ -4,9 +4,9 @@ package view import "strconv" -const _AggType_name = "AggTypeNoneAggTypeCountAggTypeSumAggTypeMeanAggTypeDistribution" +const _AggType_name = "AggTypeNoneAggTypeCountAggTypeSumAggTypeDistribution" -var _AggType_index = [...]uint8{0, 11, 23, 33, 44, 63} +var _AggType_index = [...]uint8{0, 11, 23, 33, 52} func (i AggType) String() string { if i < 0 || i >= AggType(len(_AggType_index)-1) { diff --git a/stats/view/doc.go b/stats/view/doc.go index fcaae6efc..856fb4e15 100644 --- a/stats/view/doc.go +++ b/stats/view/doc.go @@ -21,11 +21,10 @@ A view allows recorded measurements to be filtered and aggregated over a time wi All recorded measurements can be filtered by a list of tags. -OpenCensus provides several aggregation methods: count, distribution, sum and mean. +OpenCensus provides several aggregation methods: count, distribution and sum. Count aggregation only counts the number of measurement points. Distribution aggregation provides statistical summary of the aggregated data. Sum distribution -sums up the measurement points. Mean provides the mean of the recorded measurements. -Aggregations can either happen cumulatively or over an interval. +sums up the measurement points. Aggregations are cumulative. Users can dynamically create and delete views. diff --git a/stats/view/view.go b/stats/view/view.go index d289b590f..c3dbf2325 100644 --- a/stats/view/view.go +++ b/stats/view/view.go @@ -176,7 +176,7 @@ func (r *Row) String() string { return buffer.String() } -// same returns true if both Rows are equal. Tags are expected to be ordered +// Equal returns true if both rows are equal. Tags are expected to be ordered // by the key name. Even both rows have the same tags but the tags appear in // different orders it will return false. func (r *Row) Equal(other *Row) bool {