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

Setting service.name and service.version - recommended way to do it across languages? #1325

Open
cartermp opened this issue Apr 30, 2022 · 3 comments
Labels
docs e2-days Effort: < 5 days

Comments

@cartermp
Copy link
Contributor

cartermp commented Apr 30, 2022

As we know, service.name is a required resource attribute and service.version is a "this is not required but you should really set this damn thing" resource attribute too.

The two major ways to set these are in code or environment variables. Each has a drawback though:

  • If you set it in code, these will get picked up by manual instrumentation. But automatic instrumentation (e.g. from an agent) may not pick them up, and so you can be in a situation where your service.name is actually unknown_service for automatic instrumentation, but your manual instrumentation has the right service.name.
  • If you set it in environment variables, then this effectively makes it required to use environment variables with automatic instrumentation, thus making things more complicated (you now need to remember to set this in every environment your app runs in, you can't keep track of these values in your actual service code, etc.)

In Honeycomb docs, we've opted for the environment variable route: https://docs.honeycomb.io/getting-started/quickstart/#add-auto-instrumentation-to-your-application

The rationale is that it's better to be correct (and frankly follow some best practices)

Should this also be done for all docs here?

@MikeGoldsmith
Copy link
Member

MikeGoldsmith commented May 4, 2022

An addition to option 1) would be to ensure SDKs that manually set service.name also set the corresponding environment variables so auto instrumentation picks them up. This would likely be an spec and subsequent SDK change.

@cartermp cartermp added docs e2-days Effort: < 5 days labels Jul 9, 2022
@cartermp
Copy link
Contributor Author

cartermp commented Apr 9, 2024

Here's where we're at for setting service names for getting started:

Language Sets service name? Using Env Var so it works with agents (if/should they exist)
C++ no no
.NET yes yes
Erlang/Elixir no no
Go yes no
Java no no
JavaScript no no
PHP no no
Python yes yes
Ruby yes no
Rust no no
Swift no no

@svrnm
Copy link
Member

svrnm commented Apr 10, 2024

+1 for this, we can turn this into a meta issue once again and tackle languages 1-by-1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs e2-days Effort: < 5 days
Projects
None yet
Development

No branches or pull requests

3 participants