From 162de1fa24407105398ab2c6aa87cef99cdaef06 Mon Sep 17 00:00:00 2001 From: Florian Lehner Date: Tue, 24 Sep 2024 08:12:08 +0200 Subject: [PATCH] reporter: use semantic convention to report frame type With https://github.com/open-telemetry/semantic-conventions/pull/1188 a semantic convention for frame types was defined and https://github.com/open-telemetry/opentelemetry-proto/pull/578 removed Location.type_index from the OTel profiling signal in favor of the semantic convention. Update the reporter to use this semantic convention. Signed-off-by: Florian Lehner --- libpf/interpretertype.go | 4 ++-- reporter/otlp_reporter.go | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/libpf/interpretertype.go b/libpf/interpretertype.go index 48db6474..392bb701 100644 --- a/libpf/interpretertype.go +++ b/libpf/interpretertype.go @@ -55,13 +55,13 @@ var interpreterTypeToString = map[InterpreterType]string{ UnknownInterp: "unknown", PHP: "php", PHPJIT: "phpjit", - Python: "python", + Python: "cpython", Native: "native", Kernel: "kernel", HotSpot: "jvm", Ruby: "ruby", Perl: "perl", - V8: "v8", + V8: "v8js", Dotnet: "dotnet", APMInt: "apm-integration", } diff --git a/reporter/otlp_reporter.go b/reporter/otlp_reporter.go index f23968e9..e991dcce 100644 --- a/reporter/otlp_reporter.go +++ b/reporter/otlp_reporter.go @@ -547,13 +547,16 @@ func (r *OTLPReporter) getProfile() (profile *profiles.Profile, startTS, endTS u // Walk every frame of the trace. for i := range traceInfo.frameTypes { + frameAttributes := addProfileAttributes(profile, []attrKeyValue{ + {key: "profile.frame.type", value: traceInfo.frameTypes[i].String()}, + }, + attributeMap) + loc := &profiles.Location{ // Id - Optional element we do not use. - TypeIndex: getStringMapIndex(stringMap, - traceInfo.frameTypes[i].String()), Address: uint64(traceInfo.linenos[i]), // IsFolded - Optional element we do not use. - // Attributes - Optional element we do not use. + Attributes: frameAttributes, } switch frameKind := traceInfo.frameTypes[i]; frameKind {