-
Notifications
You must be signed in to change notification settings - Fork 14
Switch counter metrics to use CUMULATIVE #19
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here with What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
b1306d0
to
6c0e530
Compare
I'll need to do some manual testing on this because i'm not sure that converting a metric from gauge to cumulative is backwards compatible for existing metrics |
@@ -365,7 +365,7 @@ func (s *Sink) report(ctx context.Context) { | |||
Type: fmt.Sprintf("custom.googleapis.com/%s%s", s.prefix, name), | |||
Labels: labels, | |||
}, | |||
MetricKind: metricpb.MetricDescriptor_GAUGE, | |||
MetricKind: metricpb.MetricDescriptor_CUMULATIVE, | |||
Resource: resource, | |||
Points: []*monitoringpb.Point{ | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think for CUMULATIVE the points also need to have a StartTime:
https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.metricDescriptors#metrickind
@tam7t let me know what are your findings when you do simple backwards compatibility testing |
So I tested this and I'm getting this error |
The correct |
#19 (comment) is the reason for the error there. I'm still evaluating the effects of changing the metric types at all but i do not suspect that |
It turns out I'm not sure that counters in // edit: Was looking at the wrong |
@rf I believe that what you are describing is how to implement and report a |
I did have some trouble getting I was able to get this to work, however, by using |
fixes #18