Skip to content

Commit

Permalink
Rename sink to metric value symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
codebien committed May 30, 2023
1 parent df7a5af commit 446e7d6
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions output/cloud/expv2/mapping.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,39 +52,39 @@ func addBucketToTimeSeriesProto(
timeSeries *pbcloud.TimeSeries,
mt metrics.MetricType,
time time.Time,
sink metricValue,
value metricValue,
) {
if timeSeries.Samples == nil {
initTimeSeriesSamples(timeSeries, mt)
}

switch typedSink := sink.(type) {
switch typedMetricValue := value.(type) {
case *counter:
samples := timeSeries.GetCounterSamples()
samples.Values = append(samples.Values, &pbcloud.CounterValue{
Time: timestamppb.New(time),
Value: typedSink.Sum,
Value: typedMetricValue.Sum,
})
case *gauge:
samples := timeSeries.GetGaugeSamples()
samples.Values = append(samples.Values, &pbcloud.GaugeValue{
Time: timestamppb.New(time),
Last: typedSink.Last,
Min: typedSink.Max,
Max: typedSink.Min,
Avg: typedSink.Avg,
Count: typedSink.Count,
Last: typedMetricValue.Last,
Min: typedMetricValue.Max,
Max: typedMetricValue.Min,
Avg: typedMetricValue.Avg,
Count: typedMetricValue.Count,
})
case *rate:
samples := timeSeries.GetRateSamples()
samples.Values = append(samples.Values, &pbcloud.RateValue{
Time: timestamppb.New(time),
NonzeroCount: typedSink.NonZeroCount,
TotalCount: typedSink.Total,
NonzeroCount: typedMetricValue.NonZeroCount,
TotalCount: typedMetricValue.Total,
})
case *histogram:
samples := timeSeries.GetTrendHdrSamples()
samples.Values = append(samples.Values, histogramAsProto(typedSink, time))
samples.Values = append(samples.Values, histogramAsProto(typedMetricValue, time))
default:
panic(fmt.Sprintf("MetricType %q is not supported", mt))
}
Expand Down

0 comments on commit 446e7d6

Please sign in to comment.