grafana / pyroscope-java

pyroscope java integration
Apache License 2.0
75 stars 32 forks source link

Implement support for dynamic tags #14

Closed petethepig closed 2 years ago

petethepig commented 2 years ago

Other integrations have ways to set tags dynamically from the profiled application.

We'd love to be able to support dynamic tags in java for two main use cases:

Use case 1: Supporting Dynamic tags for user-defined scopes

Often users want to tag a region, namespace, pod, container, machine, etc and dynamic tags would allow them to do this. e.g here's how it's done in go: https://github.com/pyroscope-io/pyroscope/blob/main/examples/golang-push/rideshare/utility/utility.go#L46-L57

And we then support using these tags to compare and calculate diffs between profiles. I.e. here we are showing the diff between the region tags:

Comparing two tags

Screen Shot 2022-04-06 at 5 40 17 PM

Diff between two tags

See here for interactive example image

Use case 2: Supporting profile_id tag for profiling exemplars

We recently created a otelpyroscope package which is meant to link trace spans from a distributed tracing system (i.e. jaeger) to profiles

How this works is:

i.e. in this image you can embed a profile for this particular span, because it was conveniently tagged as pyroscope.profile.id = 840f2c4bd6e4a2c4

image

Reference: OTEL issue about standardizing profile formats: https://github.com/open-telemetry/oteps/issues/139 Async-profiler PR attempting to add (a type) of tag: https://github.com/jvm-profiling-tools/async-profiler/pull/576

netamego commented 2 years ago

Hi!!

Could be posible yo use labels/tags and app aggregation without modofing the source code of my app. I don't know if is feadible but would be great we could define tags/labels with an exported variable.

Thanks.

Rperry2174 commented 2 years ago

Hi @netamego I'm going to go ahead and close this issue since this one is complete.

If you dont mind could you create a separate issue around using labels/tags in the way that you'd like (with an example of the use case)?