From 4e552a773ee67658cff0d46e1816a40677d2e8f3 Mon Sep 17 00:00:00 2001 From: Tommy Reilly Date: Tue, 3 Mar 2026 10:41:55 -0500 Subject: [PATCH 1/2] Simplify demangling fix --- go.mod | 4 ++-- pkg/profile/decode.go | 19 ++++++++----------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/go.mod b/go.mod index 17b6a5757b0..a444b8ef057 100644 --- a/go.mod +++ b/go.mod @@ -39,6 +39,7 @@ require ( github.com/polarsignals/iceberg-go v0.0.0-20240502213135-2ee70b71e76b github.com/prometheus/client_golang v1.23.2 github.com/prometheus/common v0.67.5 + github.com/prometheus/procfs v0.16.1 github.com/prometheus/prometheus v0.305.0 github.com/stretchr/testify v1.11.1 github.com/thanos-io/objstore v0.0.0-20241028145108-31c0873d5266 @@ -61,6 +62,7 @@ require ( golang.org/x/net v0.49.0 golang.org/x/oauth2 v0.35.0 golang.org/x/sync v0.19.0 + golang.org/x/sys v0.40.0 google.golang.org/api v0.268.0 google.golang.org/genproto/googleapis/api v0.0.0-20260128011058-8636f8732409 google.golang.org/grpc v1.78.0 @@ -225,7 +227,6 @@ require ( github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/polarsignals/wal v0.0.0-20240619104840-9da940027f9c // indirect github.com/prometheus/client_model v0.6.2 // indirect - github.com/prometheus/procfs v0.16.1 // indirect github.com/rivo/uniseg v0.4.7 // indirect github.com/rs/cors v1.8.0 // indirect github.com/rs/xid v1.5.0 // indirect @@ -250,7 +251,6 @@ require ( go.yaml.in/yaml/v3 v3.0.4 // indirect golang.org/x/crypto v0.47.0 // indirect golang.org/x/mod v0.32.0 // indirect - golang.org/x/sys v0.40.0 // indirect golang.org/x/telemetry v0.0.0-20260109210033-bd525da824e2 // indirect golang.org/x/term v0.39.0 // indirect golang.org/x/text v0.33.0 // indirect diff --git a/pkg/profile/decode.go b/pkg/profile/decode.go index 31f57716552..7b4fdf10247 100644 --- a/pkg/profile/decode.go +++ b/pkg/profile/decode.go @@ -155,20 +155,17 @@ func DecodeInto(lw LocationsWriter, data []byte, demangler Demangler) (DecodeRes name, n := decodeString(data[offset:]) offset += n - systemName, n := decodeString(data[offset:]) - offset += n + if demangler != nil { + name = []byte(demangler.Demangle(name)) + } - if demangler != nil && len(systemName) > 0 { - demangled := demangler.Demangle(systemName) - if err := lw.FunctionName.Append([]byte(demangled)); err != nil { - return DecodeResult{}, fmt.Errorf("append function name: %w", err) - } - } else { - if err := lw.FunctionName.Append(name); err != nil { - return DecodeResult{}, fmt.Errorf("append function name: %w", err) - } + if err := lw.FunctionName.Append([]byte(name)); err != nil { + return DecodeResult{}, fmt.Errorf("append function name: %w", err) } + systemName, n := decodeString(data[offset:]) + offset += n + if err := lw.FunctionSystemName.Append(systemName); err != nil { return DecodeResult{}, fmt.Errorf("append function system name: %w", err) } From 4890e258a2b913d16bac577c37f754ea800834ee Mon Sep 17 00:00:00 2001 From: "pre-commit-ci-lite[bot]" <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> Date: Tue, 3 Mar 2026 15:46:56 +0000 Subject: [PATCH 2/2] [pre-commit.ci lite] apply automatic fixes --- go.mod | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index a444b8ef057..17b6a5757b0 100644 --- a/go.mod +++ b/go.mod @@ -39,7 +39,6 @@ require ( github.com/polarsignals/iceberg-go v0.0.0-20240502213135-2ee70b71e76b github.com/prometheus/client_golang v1.23.2 github.com/prometheus/common v0.67.5 - github.com/prometheus/procfs v0.16.1 github.com/prometheus/prometheus v0.305.0 github.com/stretchr/testify v1.11.1 github.com/thanos-io/objstore v0.0.0-20241028145108-31c0873d5266 @@ -62,7 +61,6 @@ require ( golang.org/x/net v0.49.0 golang.org/x/oauth2 v0.35.0 golang.org/x/sync v0.19.0 - golang.org/x/sys v0.40.0 google.golang.org/api v0.268.0 google.golang.org/genproto/googleapis/api v0.0.0-20260128011058-8636f8732409 google.golang.org/grpc v1.78.0 @@ -227,6 +225,7 @@ require ( github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/polarsignals/wal v0.0.0-20240619104840-9da940027f9c // indirect github.com/prometheus/client_model v0.6.2 // indirect + github.com/prometheus/procfs v0.16.1 // indirect github.com/rivo/uniseg v0.4.7 // indirect github.com/rs/cors v1.8.0 // indirect github.com/rs/xid v1.5.0 // indirect @@ -251,6 +250,7 @@ require ( go.yaml.in/yaml/v3 v3.0.4 // indirect golang.org/x/crypto v0.47.0 // indirect golang.org/x/mod v0.32.0 // indirect + golang.org/x/sys v0.40.0 // indirect golang.org/x/telemetry v0.0.0-20260109210033-bd525da824e2 // indirect golang.org/x/term v0.39.0 // indirect golang.org/x/text v0.33.0 // indirect