question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

span is not sent to APM server

See original GitHub issue

I see SPAN data with NodeJs agent 1.14.5 but 2.6.0 is failing to capture same JS code stays same only APM agent version is changing

debug output from 1.14.5 version:

init span { id: 'c5231c49-ad8d-4c08-8c54-e35704096dc1' }
intercepted call to http.request { id: 'c5231c49-ad8d-4c08-8c54-e35704096dc1' }
request details: { protocol: 'https:',
  host: 'iapi.xyz.com',
  id: 'c5231c49-ad8d-4c08-8c54-e35704096dc1' }
start span { id: 'c5231c49-ad8d-4c08-8c54-e35704096dc1',
  name: 'GET iapi.xyz.com/xyz/xyz/../up',
  type: 'ext.http.http' }
intercepted http.ClientRequest response event { id: 'c5231c49-ad8d-4c08-8c54-e35704096dc1' }
setting transaction result { id: 'c5231c49-ad8d-4c08-8c54-e35704096dc1',
  result: 'HTTP 2xx' }
setting default transaction name: GET /up { id: 'c5231c49-ad8d-4c08-8c54-e35704096dc1' }
ended span { id: 'c5231c49-ad8d-4c08-8c54-e35704096dc1',
  name: 'GET iapi.xyz.com/xyz/xyz/../up',
  type: 'ext.http.http',
  truncated: true }
adding transaction to queue { id: 'c5231c49-ad8d-4c08-8c54-e35704096dc1' }
setting timer to flush queue: 4860ms
ended transaction { id: 'c5231c49-ad8d-4c08-8c54-e35704096dc1',
  type: 'request',
  result: 'HTTP 2xx',
  name: 'GET /up' }
flushing queue
sending transactions payload

debug from 2.6.0 version:

intercepted request event call to http.Server.prototype.emit
start trace { trans: '54768b21709fe11d',
  parent: undefined,
  trace: 'bc3d74b2436610ae1574d7604a0d4c68',
  name: null,
  type: null }
start span { span: '26737ff7e8c227eb',
  parent: '54768b21709fe11d',
  trace: 'bc3d74b2436610ae1574d7604a0d4c68',
  name: null,
  type: 'ext.http.http' }
intercepted call to http.request { id: '54768b21709fe11d' }
request details: { protocol: 'https:',
  host: 'iapi.xyz.com',
  id: '54768b21709fe11d' }
intercepted http.ClientRequest response event { id: '54768b21709fe11d' }
setting transaction result { trans: '54768b21709fe11d',
  parent: undefined,
  trace: 'bc3d74b2436610ae1574d7604a0d4c68',
  result: 'HTTP 2xx' }
setting default transaction name: GET /up { trans: '54768b21709fe11d',
  parent: undefined,
  trace: 'bc3d74b2436610ae1574d7604a0d4c68' }
sending transaction { trans: '54768b21709fe11d',
  trace: 'bc3d74b2436610ae1574d7604a0d4c68' }
ended transaction { trans: '54768b21709fe11d',
  parent: undefined,
  trace: 'bc3d74b2436610ae1574d7604a0d4c68',
  type: 'request',
  result: 'HTTP 2xx',
  name: 'GET /up' }

I’m happy to share more details just tell me what would help here.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
watsoncommented, Mar 20, 2019

Turns out that up until Node.js v7, the IncomingMessage object would emit aborted if the underlying socket was closed

0reactions
watsoncommented, Mar 20, 2019

I just used event-debug to see what was going on on both the request, response and the underlying socket. Here’s the result:

adding hook to Node.js module loader
shimming http@11.10.1 module
shimming http.Server.prototype.emit function
shimming http.request function
shimming http.ServerResponse.prototype.writeHead function
start trace { trans: '4e2f1e90fc90f4ce',
  parent: undefined,
  trace: '7746926dd756ae7a0db94c04ae70659b',
  name: undefined,
  type: undefined }
start span { span: 'a35df073808cec1e',
  parent: '4e2f1e90fc90f4ce',
  trace: '7746926dd756ae7a0db94c04ae70659b',
  name: null,
  type: 'ext.http.http' }
intercepted call to http.request { id: '4e2f1e90fc90f4ce' }
request details: { protocol: 'http:',
  host: 'example.com',
  id: '4e2f1e90fc90f4ce' }
ClientRequest: socket +0ms
ClientRequest: prefinish +3ms
Socket: resume +1ms
Socket: lookup +1ms
Socket: connect +526ms
ClientRequest: finish +1ms
Socket: ready +2ms
Socket: data +199ms
ClientRequest: response +4ms
200
intercepted http.ClientRequest response event { id: '4e2f1e90fc90f4ce' }
IncomingMessage: readable +4ms
Socket: readable +0ms
Socket: end +1ms
Socket: close +2ms
ClientRequest: close +1ms

As can be seen here the response (IncomingMessage) never emits anything else than readable. We currently expect it to emit end at some point. I think that’s a mistake. But I wonder why it’s not emitting anything else when the underlying socket closes. I would have expected it to emit close in that case.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Spans | APM User Guide [8.5] - Elastic
Missing spansedit​​ Agents stream spans to the APM Server separately from their transactions. Because of this, unforeseen errors may cause spans to go...
Read more >
Span (co.elastic.apm:apm-agent-api 1.4.0 API) - javadoc.io
A span contains information about a specific code path, executed as part of a Transaction . If for example a database query happens...
Read more >
Elastic APM Java - Transactions & Spans are recorded but not ...
It appears to me, even though the transactions are being captured successfully, those are not reported(sent) to the APM Server.
Read more >
apm - Go Packages
If there is no transaction or span in the context, then the returned ... Send enqueues the error for sending to the Elastic...
Read more >
elastic-apm-http-client - npm
Data sent to the APM Server as part of the metadata object: ... It's not recommended to set a serverTimeout lower than the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found