Repository navigation
fix(profiles): count timestamps-only OTLP samples instead of storing 0 - #1006
Merged
rita7lopes merged 1 commit intoSep 30, 2026
Merged
rita7lopes merged 1 commit into
rita7lopes merged 1 commit into
Conversation
A profiles/v1development Sample may carry only timestamps_unix_nano, one entry per observation, with an empty values list. The OpenTelemetry eBPF profiler emits CPU samples this way. The writer (buildOTLPTree) and the reader (otlpToPProf) only summed values, so every such sample was stored as 0 and flamegraphs showed "total samples = 0". When a sample has no values, use the number of timestamps as its value. Samples that carry values are unchanged.
Contributor
|
Hello @sam0392in |
Contributor
Author
|
CLA signed. |
rita7lopes
approved these changes
Sep 30, 2026
rita7lopes
left a comment
Contributor
There was a problem hiding this comment.
@sam0392in thank you for your fix! Merging
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Count a timestamps-only OTLP profile sample as one observation per timestamp, instead of storing it as 0.
Why
In
profiles/v1development, aSamplecan carry its observations intimestamps_unix_nanoand leavevaluesempty. The OpenTelemetry eBPF profiler (otel/opentelemetry-collector-ebpf-profiler) does this for its CPU samples: it only fillsvalueswhen a profile type reports explicit values.The writer (
buildOTLPTree) and the reader (otlpToPProf) only summedvalues. So every sample from the eBPF profiler was stored with a value of 0. Labels and stack trees were ingested correctly, but Grafana's Pyroscope datasource showedtotal samples = 0 / max = 0for every flamegraph.Change
writer/utils/unmarshal/otlp_profile.go: when a sample has no values,buildOTLPTreeuses the number of timestamps as its value.reader/service/otlp_pprof.go:otlpToPProfdoes the same, so pprof exports match.Testing
TestBuildOTLPTreeTimestampsOnly(writer) andTestOtlpToPProfTimestampsOnly(reader). Both fail without the fix and pass with it.go test ./...passes.values_agg = [('samples:count', 0, 1)]. After the fix, rows carry the real sample counts, andSelectMergeStacktracesreturns non-zero flamegraph totals in Grafana.