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

Default service name defaults to potentially incorrect value #710

Closed
alexrhogue opened this issue Oct 9, 2019 · 1 comment · Fixed by #724
Closed

Default service name defaults to potentially incorrect value #710

alexrhogue opened this issue Oct 9, 2019 · 1 comment · Fixed by #724
Labels
bug Something isn't working community core
Milestone

Comments

@alexrhogue
Copy link

Ran into a potential bug with the default value of 'service' in the tracer init. I am setting up my team's project to have a shared npm module that contains something like this:

shared-dd-config:

const tracer = require('dd-trace');

tracer.init({
    analytics: true
});

The idea is to install this package and require it across our node apps. This would allow me to make changes to our init/plugins in one place.

This issue I ran into (after much head banging) is that the default 'service' value of the tracer was being initialized to 'shared-dd-config' not the name of the root node project.

I was able to get around this by just adding the following line to my init. But I am curious if this is intended behavior or a bug

service: process.env.npm_package_name

Environment

  • Operation system:
    OSX 10.14.3
  • Node version:
    v11.15.0
  • Tracer version:
    dd-trace@0.15.4
  • Agent version:
    6.14.1
@alexrhogue alexrhogue added the bug Something isn't working label Oct 9, 2019
@rochdev
Copy link
Member

rochdev commented Oct 10, 2019

This is the intended behavior, but this use case was not considered. It should be straightforward to find the root module instead of the parent one and update the tracer accordingly. In the meantime, you can use the DD_SERVICE_NAME environment variable which is supported out of the box.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working community core
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants