Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decide if service.name should be required #11

Closed
codeboten opened this issue May 1, 2023 · 10 comments
Closed

Decide if service.name should be required #11

codeboten opened this issue May 1, 2023 · 10 comments

Comments

@codeboten
Copy link
Contributor

It isn't required to set OTEL_SERVICE_NAME, however the SDKs will set service.name to unknown_service when it isn't configured. Making it required allows users to correctly set it upfront, rather than finding out later that the service name isn't set.

That being said, there are a few different mechanisms out there that set the service name automatically (i.e. resource detectors)

Originally posted by @tsloughter in #6 (comment)

@codeboten
Copy link
Contributor Author

@tsloughter is erlang setting it via a resource detector or is the SDK detecting the service name?

@MikeGoldsmith
Copy link
Member

MikeGoldsmith commented May 2, 2023

Initially I was in favour of making it required because the config file is expected to wholly be used by itself and not be layered with other configuration sources (eg env vars or SDK options). Making service.name required would help prevent the cycle of users not naming their services, seeing unknown_service and then going back to name their services.

However, setting service.name in the config file means a single config file cannot be used by multiple similar services without edits. I think this is a very valuable feature and will increase adoption of the config file.

@jack-berg
Copy link
Member

However, I setting service.name in the config file means a single config file cannot be used by multiple similar services without edits. I think this is a very valuable feature and will increase adoption of the config file.

Can still achieve this by doing something like:

resource:
  attributes:
    service.name: ${env:OTEL_SERVICE_NAME}

@codeboten
Copy link
Contributor Author

@MikeGoldsmith right, re-using this config would require service.name to be set via an environment variable:

resource:
  attributes:
    service.name: ${env:OTEL_SERVICE_NAME}

@codeboten
Copy link
Contributor Author

... what @jack-berg said 😄

@tsloughter
Copy link
Member

@codeboten the SDK's resource detector runner does it after running all detectors.

@MikeGoldsmith
Copy link
Member

However, I setting service.name in the config file means a single config file cannot be used by multiple similar services without edits. I think this is a very valuable feature and will increase adoption of the config file.

Can still achieve this by doing something like:

resource:
  attributes:
    service.name: ${env:OTEL_SERVICE_NAME}

Ah, that is nice. Thanks for pointing out how to evaluate env vars 👍🏻

@tsloughter
Copy link
Member

I'll have to check if any others do similar to Erlang. I can't imagine we are the only ones who are able to get the service name without the user essentially setting it twice.

@tsloughter
Copy link
Member

@marcalff
Copy link
Member

marcalff commented Mar 4, 2024

Resolved by #68

Please close.

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

No branches or pull requests

5 participants