census-ecosystem / opencensus-go-exporter-stackdriver

OpenCensus Go exporter for Stackdriver Monitoring and Trace
Apache License 2.0
67 stars 79 forks source link

Support multiple monitored resource types in one process #230

Closed yanweiguo closed 4 years ago

yanweiguo commented 4 years ago

NB: Before opening a feature request against this repo, consider whether the feature should/could be implemented in exporter libraries in other languages. If so, please open an issue on opencensus-specs first.

Is your feature request related to a problem? Please describe. We are using GetMonitoredResource in our code to determine which monitoring resource type to use. The resource type is determined by the metric name currently. If the metric is a built-in metric, we send it with a non-global resource type. If not, we send it with global resource type as custom metrics.

Now GetMonitoredResource was removed in v0.12.7.

Describe the solution you'd like Provide some option similar to GetMonitoredResource.

songy23 commented 4 years ago

Now the recommended way to export metrics is through MetricReader like

se.StartMetricsExporter()
defer se.StopMetricsExporter()

Options that work with View will be no-op in this case. We should provide something like GetMonitoredResource func(*metric.Descriptor) (monitoredresource.Interface).

/cc @rghetia