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

ddtrace/tracer, internal/traceprof/traceproftest: update profile endpoint label when SetTag updates resource name for a span #1203

Merged
merged 4 commits into from
Apr 13, 2022

Conversation

nsrip-dd
Copy link
Contributor

@nsrip-dd nsrip-dd commented Mar 7, 2022

If a user calls SetTag to change the resource name for a span, subsequent CPU profile samples should have the new resource name as the endpoint label if endpoint labels are enabled. Note that if the resource name is updated close to the end of a span, it is possible that there will be no samples with the new label. I don't think there's anything we can do about this.

The test for this change can possibly be flaky due to the nature of sample-based profiling, so I have it run progressively longer if needed to give a chance for the desired samples to show up.

If a user calls SetTag to change the resource name for a span,
subsequent CPU profile samples should have the new resource name as the
endpoint label if endpoint labels are enabled.
up in CPU profiles

Updating the resource name for a span after it's created (using SetTag)
should be reflected in the CPU profile.

This test can possibly be flaky due to the nature of sample-based
profiling, so we try to run longer if needed to give a chance for the
desired samples to show up.
@nsrip-dd nsrip-dd added this to the Triage milestone Mar 7, 2022
@nsrip-dd nsrip-dd requested a review from a team as a code owner March 7, 2022 20:34
@nsrip-dd nsrip-dd requested a review from a team March 7, 2022 20:34
Copy link
Member

@felixge felixge left a comment

Choose a reason for hiding this comment

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

The change itself LGTM, but I think the test has a problem.

break
}
duration *= 2
}
Copy link
Member

Choose a reason for hiding this comment

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

🐞 This test passes if I comment out the changes in ddtrace/tracer/span.go. I think the break should be a return and a t.Fatal(...) needs to be put after the loop.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, great catch, thank you! originally had the test just run forever (avoiding flakiness by just trying longer and longer to get the samples) and relied on the timeout to catch failure. I decided against that but forgot to add a failure. I've pushed an update.

Copy link
Member

Choose a reason for hiding this comment

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

No worries. One of my default code review techniques is to break the implementation and see if the included tests start failing. I might have missed this otherwise myself. 😅

Originally had the test run forever but forgot to add failure after
changing it to a limited duration.
Copy link
Member

@felixge felixge left a comment

Choose a reason for hiding this comment

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

LGTM, thanks! contrib test fail seems like an unrelated flake?

break
}
duration *= 2
}
Copy link
Member

Choose a reason for hiding this comment

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

No worries. One of my default code review techniques is to break the implementation and see if the included tests start failing. I might have missed this otherwise myself. 😅

Copy link
Contributor

@dianashevchenko dianashevchenko left a comment

Choose a reason for hiding this comment

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

LGTM 🙌

@nsrip-dd nsrip-dd merged commit 09021bd into v1 Apr 13, 2022
@nsrip-dd nsrip-dd deleted the nick.ripley/trace-allow-chaning-endpoint-profile-label branch April 13, 2022 12:46
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