otel-profiling-agent icon indicating copy to clipboard operation
otel-profiling-agent copied to clipboard

reporter: Set sample.Value based on size of timestamps

Open liaol opened this issue 8 months ago • 2 comments

In Pdata.setProfile(), we currently set sample.Value to 1. However, a single sample can be captured multiple times within the same report period.

https://github.com/open-telemetry/opentelemetry-ebpf-profiler/blob/4377c7485ec426eb1210098593e6175d2d53bcd8/reporter/internal/pdata/generate.go#L114

In baseReporter.ReportTraceEvent(), we append timestamps to the list.

https://github.com/open-telemetry/opentelemetry-ebpf-profiler/blob/4377c7485ec426eb1210098593e6175d2d53bcd8/reporter/base_reporter.go#L126

So, should we instead set sample.Value to the size of events.Timestamps?

liaol avatar May 04 '25 09:05 liaol

Oh, I see https://github.com/open-telemetry/opentelemetry-ebpf-profiler/issues/63

Is it the server's responsibility to sum the value based on the timestamps when converting to raw Google pprof format?

Thanks!

liaol avatar May 04 '25 09:05 liaol

At the moment, there is a conflict between Profile.SampleType, Sample.Value and Sample.timestamps_unix_nano. The resolution of https://github.com/open-telemetry/opentelemetry-ebpf-profiler/issues/63 was to have the same number of Sample.Value as Profile.SampleType - this might conflict in some situations with Sample.timestamps_unix_nano. At the moment there are discussions to change the handling of timestamps and their assigned value - see https://github.com/open-telemetry/opentelemetry-proto/issues/633#issuecomment-2772648117 and https://github.com/open-telemetry/opentelemetry-proto/pull/649. So this might change. To not conflict with https://github.com/open-telemetry/opentelemetry-ebpf-profiler/issues/63, I think the number of Sample.Value should stay for the moment the same as the number of Profile.SampleType.

florianl avatar May 05 '25 06:05 florianl

Closing as resolved with the changes to the protocol in v1.8.0 and its implementation in this code base.

florianl avatar Sep 30 '25 06:09 florianl