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

"Traced example" in getting started is broken as HTTP correlation is not working in "axios" module #1076

Closed
kanikashah90 opened this issue May 19, 2020 · 6 comments · Fixed by #1099
Labels
bug Something isn't working

Comments

@kanikashah90
Copy link
Contributor

What version of OpenTelemetry are you using?

v0.8.1

What version of Node are you using?

v12.16.3

What did you do?

If possible, provide a recipe for reproducing the error.
I ran the example in "traced-example" in "getting-started" directory with "ConsoleSpanExporter". I ran two instances of the example with one as the client service and the other as the server service.

What did you expect to see?

When I access the "middle-tier" endpoint spans created by the client service trace should look like:

{
  traceId: '40fca7b4c16fb167bca73a8c607a379c',
  parentId: undefined,
  name: 'GET /middle-tier',
  id: '41bbe26a01306357',
  kind: 1,
  timestamp: 1589846494827686,
  duration: 8643,
  attributes: {
    'http.url': 'http://localhost:3000/middle-tier-2',
    'http.host': 'localhost:3000',
    'net.host.name': 'localhost',
    'http.method': 'GET',
    'http.target': '/middle-tier-2',
    'http.route': '/middle-tier-2',
    'http.user_agent': 'curl/7.54.0',
    'http.flavor': '1.1',
    'net.transport': 'IP.TCP',
    component: 'http',
    'net.host.ip': '::1',
    'net.host.port': 3000,
    'net.peer.ip': '::1',
    'net.peer.port': 63030,
    'http.status_code': 200,
    'http.status_text': 'OK'
  },
  status: { code: 0 },
  events: []
}
{
  traceId: '40fca7b4c16fb167bca73a8c607a379c',
  parentId: '41bbe26a01306357',
  name: 'GET /backend',
  id: 'c18f23c859a64e68',
  kind: 2,
  timestamp: 1589846494829362,
  duration: 9582,
  attributes: {
    component: 'http',
    'http.url': 'http://localhost:3003/backend',
    'http.method': 'GET',
    'http.target': '/backend',
    'net.peer.name': 'localhost',
    'net.peer.ip': '127.0.0.1',
    'net.peer.port': 3003,
    'http.host': 'localhost:3003',
    'http.status_code': 200,
    'http.status_text': 'OK',
    'http.flavor': '1.1',
    'net.transport': 'IP.TCP'
  },
  status: { code: 0 },
  events: []
}

What did you see instead?

Instead in the span with name "GET /backend" parentId is undefined

{
  traceId: '73763a97123e4856efff8fd1c870dab9',
  parentId: undefined,
  name: 'GET /backend',
  id: '7b8792f650cd7bb1',
  kind: 2,
  timestamp: 1589846321647670,
  duration: 24370,
  attributes: {
    component: 'http',
    'http.url': 'http://localhost:3003/backend',
    'http.method': 'GET',
    'http.target': '/backend',
    'net.peer.name': 'localhost',
    'net.peer.ip': '127.0.0.1',
    'net.peer.port': 3003,
    'http.host': 'localhost:3003',
    'http.status_code': 200,
    'http.status_text': 'OK',
    'http.flavor': '1.1',
    'net.transport': 'IP.TCP'
  },
  status: { code: 0 },
  events: []
}
{
  traceId: 'bb9fd4ebc23d8f8f268afc3a728f71b8',
  parentId: undefined,
  name: 'GET /middle-tier',
  id: '1a6018422f2cb7f5',
  kind: 1,
  timestamp: 1589846321637625,
  duration: 37836,
  attributes: {
    'http.url': 'http://localhost:3000/middle-tier',
    'http.host': 'localhost:3000',
    'net.host.name': 'localhost',
    'http.method': 'GET',
    'http.target': '/middle-tier',
    'http.route': '/middle-tier',
    'http.user_agent': 'curl/7.54.0',
    'http.flavor': '1.1',
    'net.transport': 'IP.TCP',
    component: 'http',
    'net.host.ip': '::1',
    'net.host.port': 3000,
    'net.peer.ip': '::1',
    'net.peer.port': 62737,
    'http.status_code': 200,
    'http.status_text': 'OK'
  },
  status: { code: 0 },
  events: []
}

I tried it with Jaeger backend to visualize the results. Due to this broken correlation, two traces are getting created. One for the client-side for everything before HTTP call to the server and the other for the HTTP call to the server.

@dyladan
Copy link
Member

dyladan commented May 19, 2020

is this fixed by #1078 or does it need its own PR?

@kanikashah90
Copy link
Contributor Author

@dyladan No #1078 doesn't fix this issue. This issue can be fixed in two ways:

  1. Replace the "axios" library with built-in "http" module to make HTTP calls.
  2. Fix the issue in "axios" library which is causing the break-up in the parent-child relationship creation.

@blumamir
Copy link
Member

I've seen similar behavior with plain http module. described in #1101

@vmarchaud
Copy link
Member

I've put what i believe is a workaround there, could you test it @kanikashah90 ?

@zydemail
Copy link

@dyladan No #1078 doesn't fix this issue. This issue can be fixed in two ways:

  1. Replace the "axios" library with built-in "http" module to make HTTP calls.
  2. Fix the issue in "axios" library which is causing the break-up in the parent-child relationship creation.

how to fix this problem?

@kanikashah90
Copy link
Contributor Author

@zydemail this should not be a problem based on the merge #1099

pichlermarc pushed a commit to dynatrace-oss-contrib/opentelemetry-js that referenced this issue Dec 15, 2023
open-telemetry#1076)

Co-authored-by: Daniel Dyla <[email protected]>
Co-authored-by: Gerhard Stöbich <[email protected]>
Co-authored-by: Valentin Marchaud <[email protected]>
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.

5 participants