Search code examples
gogcloudopencensus

Can't filter custom metrics in google cloud monitoring with tags


I registered stats with opencensus and attached tags thanks to a StackDriver exporter:

ctx, err = tag.New(ctx, tag.Upsert(key, val))
stats.Record(ctx, []stats.Measurement{csqAverage.M(m)}...)

In the metric explorer, I can see the metrics, but I can't see or filter with the associated tag. When I retrieve the resources thanks to the REST API, I don't see tags at all, and this kind of property is not mentionened in the documentation describing a metric. However, the gcloud documentation indicates that opencensus tag can be exported to filter the metrics.


Solution

  • TagKeys must be declared in the registered view.