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

feat: k6 middleware #3580

Merged
merged 23 commits into from
Oct 3, 2024
Merged

feat: k6 middleware #3580

merged 23 commits into from
Oct 3, 2024

Conversation

bryanhuhta
Copy link
Contributor

This is a continuation on work done in collaboration with the k6 team. This PR adds a new configuration option to Pyroscope

-self-profiling.use-k6-middleware
      Read k6 labels from request headers and set them as dynamic profile tags.

which enables an http middleware to tag profiles with k6-specific labels parsed from the request baggage. By default this is disabled.

Go SDK PR: grafana/pyroscope-go#99
k6 PR: https://github.com/grafana/grafana-k6-app/pull/1151

@bryanhuhta bryanhuhta self-assigned this Sep 20, 2024
@bryanhuhta bryanhuhta requested a review from a team as a code owner September 20, 2024 21:42
@bryanhuhta bryanhuhta requested a review from a team as a code owner September 23, 2024 18:13
Copy link
Collaborator

@kolesnikovae kolesnikovae left a comment

Choose a reason for hiding this comment

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

LGTM

@kolesnikovae
Copy link
Collaborator

How are these labels being propagated down the communication stream?

@bryanhuhta
Copy link
Contributor Author

How are these labels being propagated down the communication stream?

😅 I missed that critical part. I made a few more changes, part of them are dependent on this grafana/pyroscope-go#131.

In c794044, I added a mechanism to propagate baggage found in the context as an http header when making a request. This should send the baggage all the way down the call chain when resolving a query.

In the pryoscope-go PR, I modified the middleware to add the OTEL baggage to the request context if it didn't already exist.

With these two changes, any incoming baggage will get read, labeled, and propagated along network calls. Of course, if a service doesn't have self_profiling.use_k6_middleware enabled, the baggage will stop being propagated.

@bryanhuhta bryanhuhta merged commit 733af53 into main Oct 3, 2024
18 checks passed
@bryanhuhta bryanhuhta deleted the test-k6-integration branch October 3, 2024 20:51
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.

2 participants