Skip to content

how do I set the service.name on a metric? #2576

Answered by lalitb
willie asked this question in Q&A
Discussion options

You must be logged in to vote

As of now, you need to use:

static std::unique_ptr<opentelemetry::metrics::MeterProvider> Create(
std::unique_ptr<ViewRegistry> views,
const opentelemetry::sdk::resource::Resource &resource);

and perhaps pass an empty ViewRegistry. I believe there should be a much simpler approach to be supported.

ps. You can also set it using env-variable OTEL_RESOURCE_ATTRIBUTES.

Replies: 1 comment 7 replies

Comment options

You must be logged in to vote
7 replies
@willie
Comment options

@lalitb
Comment options

@willie
Comment options

@lalitb
Comment options

@willie
Comment options

Answer selected by willie
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants