dd-trace-js
dd-trace-js copied to clipboard
tracer.setUrl does not override the url set within profiler instance
Expected behaviour
All cached instances of agent URL/hostname must be updated after tracer.setUrl() call
Actual behaviour
// implicitly sets agent URL to `127.0.0.1:8126`
tracer.init();
// Will update the trace exporter:
// https://github.com/DataDog/dd-trace-js/blob/c88c05829a0df6cf24700905c2a07f355f2d508d/packages/dd-trace/src/exporters/common/writer.js#L39
//
// But not profiler:
// https://github.com/DataDog/dd-trace-js/blob/c88c05829a0df6cf24700905c2a07f355f2d508d/packages/dd-trace/src/profiling/exporters/agent.js#L47
tracer.setUrl(newUrl);
This results in a bunch of failing requests to 127.0.0.1:8126 (cached agent URL).
Steps to reproduce see above
Environment
- OS macOS Monterey 12.6
- Node.js version: 18.9.1
- Tracer version: 3.2.0
- Agent version: not relevant
- Relevant library versions: n/a