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

How to use service.name resource attribute since the 0.20.0 release ? #2271

Closed
fungiboletus opened this issue Jun 10, 2021 · 3 comments
Closed

Comments

@fungiboletus
Copy link
Contributor

fungiboletus commented Jun 10, 2021

Hei,

Since the 0.20.0 release and the pull request #2227 it seems that serviceName is deprecated and we should use service.name instead. I havn't easily found this information in the changelog, it did require some digging to understand why the service name was now a very long unknown_service:/path/to/node. Documentation says Use service.name Resource attribute instead. but it wasn't about replacing serviceName: 'toto' by service: { name: 'toto'}.

So how to use service.name resource attribute ?

@julien-sugg
Copy link

Hi,

You may be able to define it when instantiating your trace provider.

e.g.:

import { ResourceAttributes } from '@opentelemetry/semantic-conventions';
import { Resource } from '@opentelemetry/resources';
// ...other imports

// ...code

const tracerProvider = new WebTracerProvider( {
  resource: new Resource( {
    [ ResourceAttributes.SERVICE_NAME ]: "yourServiceName",
  } )
} );

// ...code

@fungiboletus
Copy link
Contributor Author

Thanks ! It works.

@gamblea
Copy link

gamblea commented Jun 10, 2021

This was very helpful and fixed my issue! I was running into the same issue when running a node.js project locally. I was unable to pass the Semantic Attributes through an env variable on macOS.

Thank you @julien-sugg

Just wondering if there are limitations with passing Semantic Attributes through environment variables right now?

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

No branches or pull requests

3 participants