opencensus-go-exporter-stackdriver icon indicating copy to clipboard operation
opencensus-go-exporter-stackdriver copied to clipboard

MetricDescriptor should be created as soon as the view is registered

Open yegle opened this issue 3 years ago • 3 comments

Please answer these questions before submitting a bug report.

What version of the Exporter are you using?

0.13.4

What version of OpenCensus are you using?

0.22.5

What version of Go are you using?

1.15.7

What did you do?

We have a metric that are only recorded rarely. (i.e. the call to stat.Record() is in an if-statement and rarely reached). The metric may not get recorded for days.

What did you expect to see?

Regardless of how frequently the data point is produced, the MetricDescriptor is created ~instantly after the views are generated.

What did you see instead?

The MetricDescriptor is not created long after the new metric is added.

Additional context

I created https://github.com/census-ecosystem/opencensus-go-exporter-stackdriver/pull/277 to try to manage the MetricDescriptor by ourselves, but I think the root issue is the delayed MetricDescriptor.

yegle avatar Jan 20 '21 00:01 yegle

Any update on this? We also have the same problem and would love for it to be fixed, as we try to create Stackdriver alerts for the metrics.

miroslavLalev avatar Jul 22 '21 14:07 miroslavLalev

FWIW this is our workaround (StartExporter will be called during server startup): https://github.com/google/exposure-notifications-server/blob/7841200f6face7b648944be241362218d6f04588/pkg/observability/stackdriver.go#L116-L127

yegle avatar Jul 22 '21 18:07 yegle

Hey, thanks for the idea! I did not check what is exported from the package and what isn't. We will give this approach a shot, but sadly, it is awkward to implement because conventionally, the views are separated from the exporters.

miroslavLalev avatar Jul 29 '21 09:07 miroslavLalev