Skip to content
This repository has been archived by the owner on Jul 31, 2023. It is now read-only.

Commit

Permalink
Remove all mentions of mean aggregation (#651)
Browse files Browse the repository at this point in the history
Fixes #650.
  • Loading branch information
rakyll committed Mar 28, 2018
1 parent 8c14281 commit 232014e
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 21 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 2 additions & 4 deletions exporter/prometheus/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions exporter/stackdriver/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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 {
Expand Down
3 changes: 1 addition & 2 deletions internal/readme/source.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
3 changes: 1 addition & 2 deletions stats/view/aggregation.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion stats/view/aggregation_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
4 changes: 2 additions & 2 deletions stats/view/aggtype_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions stats/view/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion stats/view/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 232014e

Please sign in to comment.