How grafana/otel-profiling-java works
Project type and purpose
• This is an open-source Java library (not a standalone app) whose purpose is to integrate Pyroscope’s CPU profiler with any Java application using the OpenTelemetry (OTel) standard.
File structure
• Top-level build files: build.gradle, Gradle wrapper, Makefile, GitHub workflows → indicates a Gradle-based Java library with CI for testing & releases.
• src/main/java/io/otel/pyroscope → core bridge code:
• OtelCompat.java
• OtelProfilerSdkBridge.java
• PyroscopeOtelAutoConfigurationCustomizerProvider.java (SPI entry)
• PyroscopeOtelConfiguration.java
• PyroscopeOtelSpanProcessor.java
• src/main/resources/META-INF/services → declares the AutoConfigurationCustomizerProvider service so that OTel’s SDK-autoconfigure picks up this extension.
• src/test/java → unit tests for the SpanProcessor.
README for additional insights
• References the OpenTelemetry Java instrumentation guide and points to a full example in another repo.
Elements
• “Profiles → Bridge → Pyroscope Server”
• “Traces → OTel Exporter → Tracing Backend”
• Application vs. Library vs. External Service
• Data paths (traces vs. profiling)
• Notes or callouts for the SPI registration (META-INF/services) and the sampling rate caveat (~100Hz).
Final recommendations
• Be very detailed: capture both the startup/registration sequence (SPI auto-configure) and the run-time data-flow (span begin/end, sample tagging, export).