1

I'm emitting metrics in google cloud counting how often certain jobs are executed and succeed vs. fail. These are cumulative metrics, so the actual values emitted should be monotonically increasing.

When I graph these metrics, for each job I would expect to get 3 lines, each generally increasing. Instead of graphing what's being emitted, it seems MQL is destroying the cumulative nature of these metrics.

visualized metrics, not cumulative for some reason

I would expect to see more of a step function, where the last value charted is 6 not 2.

The relevant MQL is:

fetch_cumulative gce_instance
| metric 'custom.googleapis.com/opencensus/foo_job.counter'
| group_by [metric.eventName],
    [sum(value.counter)]

My understanding is that fetch would convert cumulative metrics to delta metrics and thus result in this behavior. But fetch_cumulative should avoid that.

c69
  • 19,951
  • 7
  • 52
  • 82
  • The Cumulative metricKind is a value accumulated over a time interval. Cumulative measurements in a time series should have the same start time and increasing end times, until an event resets the cumulative value to zero and sets a new start time for the following points. Instead, if you choose Delta as your Metrickind this measurement will monitor the change in a value during a time interval. When you created your query in MQL, did you use the Cumulative MetricKind, why didn't you choose Delta Kind? Are you using a custom metric? – Ismael Clemente Aguirre Mar 17 '22 at 21:18

1 Answers1

0

I believe fetch_cumulative should do the job. However, according to the footnotes, the charting in the UI might convert it automatically into delta streams. Maybe try the API call directly to confirm this behaviour.

Cheng Hou
  • 81
  • 1