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

fix: connected deferred exit parent span with original entry span #1346

Merged
merged 5 commits into from
Sep 27, 2024

Conversation

kirrg001
Copy link
Contributor

@kirrg001 kirrg001 commented Sep 27, 2024

Found while working on #1297

Problem: the deferred http request was not traced correctly. It was not connected to the entry http server span.

  • for httpClient: was already traced, but not correctly connected to the entry parent id
  • for nativeFetch: was not working at all

@kirrg001 kirrg001 marked this pull request as ready for review September 27, 2024 08:24
@kirrg001 kirrg001 requested a review from a team as a code owner September 27, 2024 08:24
@abhilash-sivan
Copy link
Contributor

pre-approving

@@ -20,7 +20,7 @@ const express = require('express');
const fetch = require('node-fetch-v2');
const NATS = require('nats');

const log = require('@instana/core/test/test_util/log').getLogger('NATS Subscriber');
const log = require('@instana/core/test/test_util/log').getLogger('NATS Subscriber: ');
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The log output was broken.

: expect(span.p).to.equal(natsEntry.s),
span => expect(span.k).to.equal(constants.EXIT)
version === 'latest'
? expect(span.t).to.equal(httpEntrySpan.t)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are now able to connect the correct trace.

@kirrg001 kirrg001 changed the title fix: connected entry parent span with deferred http requests fix: connected deferred exit parent span with original entry span Sep 27, 2024
@@ -689,7 +724,8 @@ function verifyHttpExit({
withClientError,
withServerError,
withTimeout,
serverControls
serverControls,
params = null
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added another optional check.
If the test passes params, we test params.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it!

@kirrg001 kirrg001 merged commit 98f99e1 into main Sep 27, 2024
1 check passed
@kirrg001 kirrg001 deleted the fix-deferred-parent branch September 27, 2024 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants