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

[http-plugin] Missing traceparent header if WHATWG URL is used #583

Closed
Flarna opened this issue Dec 3, 2019 · 1 comment · Fixed by #589
Closed

[http-plugin] Missing traceparent header if WHATWG URL is used #583

Flarna opened this issue Dec 3, 2019 · 1 comment · Fixed by #589
Assignees
Labels
bug Something isn't working

Comments

@Flarna
Copy link
Member

Flarna commented Dec 3, 2019

What version of OpenTelemetry are you using?

0.2.0

What version of Node are you using?

10.17.0

What did you do?

Use a WHATWG URL (https://nodejs.org/dist/latest-v10.x/docs/api/url.html#url_class_url) in http.get() instead an options object or string.

e.g. in https://github.com/open-telemetry/opentelemetry-js/blob/v0.2.0/examples/http/client.js#L22 replace
http.get({ host: 'localhost', port: 8080, path: '/helloworld' }
by
http.get(new url.URL('http://localhost:8080/helloworld').

Also when using WHATWG URL + options like this:
http.get(new url.URL('http://localhost:8080/helloworld'), { headers: { 'x-foo': 'bar' } }
traceparent header is missing.

What did you expect to see?

traceparent header should be present

What did you see instead?

traceparent header is missing

Additional context

a missing traceparent header is causing disconnected spans.

The current implementation handles WHATWG URL objects like an options object and attaches a headers property to it. But node core is ignoring a headers property on WHATWG URL objects (see https://github.com/nodejs/node/blob/v12.13.1/lib/_http_client.js#L96 and https://github.com/nodejs/node/blob/v12.13.1/lib/internal/url.js#L1257.

If wanted I can try to create a PR to fix this.

@Flarna Flarna added the bug Something isn't working label Dec 3, 2019
@mayurkale22
Copy link
Member

Thanks for reporting this! Feel free to attempt to write solution and open a PR. :)

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

Successfully merging a pull request may close this issue.

2 participants