Skip to content
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.

Add an option to set metric name prefix #84

Merged
merged 3 commits into from
Jun 15, 2020

Conversation

jjzeng-seattle
Copy link
Contributor

In knative we need to set the component names(autoscaler and activator) as the prefix for metric names. Both prometheus and stackdriver provide a way to do that:

https://github.com/census-ecosystem/opencensus-go-exporter-prometheus/blob/master/prometheus.go#L170
https://github.com/census-ecosystem/opencensus-go-exporter-stackdriver/blob/master/metrics_proto.go#L413

This PR brings the parity to opencensus agent.

It's hard to test without a mock agent for metrics. But I tested manually and it worked as expected.

options.go Outdated
}

// UseMetricNamePrefix provides an option for the caller to add a prefix to metric names.
func UseMetricNamePrefix(prefix string) ExporterOption {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/UseMetricNamePrefix/WithMetricNamePrefix/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants