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

profiler: support using custom profiler labels in our UI #2282

Merged
merged 9 commits into from Jan 3, 2024

Conversation

nsrip-dd
Copy link
Contributor

@nsrip-dd nsrip-dd commented Oct 20, 2023

What does this PR do?

Add an API for specifying profiler label keys which should show up in the UI.
There is a limit today to avoid worst-case situations with massive numbers of
labels.

This PR has a unit test, and I also tested it on our staging environment (with
help from Alex)

Motivation

Users can use profiler labels to add annotations to CPU and goroutine profiles.
Those labels will be in the profiles we upload, but won't currently be
available as attributes for filtering flame graphs in our UI. We have support
for that now in our backend & UI, so we just need a way to make it
available to users.

Screenshot 2023-10-20 at 9 07 10 AM

(for internal use: see PROF-8379)

Reviewer's Checklist

  • Changed code has unit tests for its functionality at or near 100% coverage.
  • There is a benchmark for any new code, or changes to existing code.
  • If this interacts with the agent in a new way, a system test has been added.

For Datadog employees:

  • If this PR touches code that handles credentials of any kind, such as Datadog API keys, I've requested a review from @DataDog/security-design-and-guidance.
  • This PR doesn't touch any of that.

Unsure? Have a question? Request a review!

@pr-commenter
Copy link

pr-commenter bot commented Oct 20, 2023

Benchmarks

Benchmark execution time: 2024-01-02 17:24:12

Comparing candidate commit 78e3abf in PR branch nick.ripley/profiler-custom-context with baseline commit e3f8e9e in branch main.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 41 metrics, 0 unstable metrics.

Users can use profiler labels to add annotations to CPU and goroutine
profiles. Those labels will be in the profiles we upload, but won't
currently be available as attributes for filtering frames in flame
graphs in our UI. Add an API for specifying pprof label keys which
should show up in the UI. There is a limit today to avoid worst-case
situations with massive numbers of unique label keys.
@nsrip-dd nsrip-dd force-pushed the nick.ripley/profiler-custom-context branch from 3b6917b to 742c1b3 Compare October 20, 2023 09:47
@nsrip-dd nsrip-dd changed the title profiler: support using custom pprof labels in our UI profiler: support using custom profiler labels in our UI Oct 20, 2023
@nsrip-dd nsrip-dd marked this pull request as ready for review October 20, 2023 10:02
@nsrip-dd nsrip-dd requested a review from a team as a code owner October 20, 2023 10:02
@nsrip-dd nsrip-dd marked this pull request as draft October 31, 2023 17:19
Copy link

This PR is stale because it has been open 20 days with no activity. Remove stale label or comment or this will be closed in 10 days.

@github-actions github-actions bot added the stale Stuck for more than 1 month label Nov 21, 2023
@nsrip-dd nsrip-dd removed the stale Stuck for more than 1 month label Nov 27, 2023
Copy link

This PR is stale because it has been open 20 days with no activity. Remove stale label or comment or this will be closed in 10 days.

@github-actions github-actions bot added the stale Stuck for more than 1 month label Dec 18, 2023
@nsrip-dd nsrip-dd removed the stale Stuck for more than 1 month label Dec 18, 2023
@nsrip-dd
Copy link
Contributor Author

The backend changes are deployed, and I tested this again with Alex, using the updated custom_attributes name.

@nsrip-dd nsrip-dd marked this pull request as ready for review December 21, 2023 19:22
@felixge felixge self-requested a review January 2, 2024 12:11
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, but see comments. 🙇

profiler/options.go Outdated Show resolved Hide resolved
profiler/profiler.go Show resolved Hide resolved
To clarify that these are *just* keys, not key/value pairs like for the
pprof.Labels API.
Just record that they keys are used. We can keep them in the startup
logs since those belong to the user, but I think we shouldn't send more
specific user data than we need for the telemetry since that doesn't go
to the user's org.
Alex has suggested to start with a low limit and track usage to see if
it's worth increasing. Modify the telemetry to record the number of keys
so we can see typical usage.
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.

Thanks for the updates. LGTM 🙇 – Ship it!

@nsrip-dd nsrip-dd merged commit 3b8c352 into main Jan 3, 2024
153 checks passed
@nsrip-dd nsrip-dd deleted the nick.ripley/profiler-custom-context branch January 3, 2024 13:47
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.

None yet

2 participants