Skip to content

Commit d1c4066

Browse files
authored
fix: use the provided name when it's not empty in JSON conversion. (#861)
1 parent 4a11f7d commit d1c4066

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pkg/adhoc/server/convert.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,17 @@ import (
1616
"github.com/pyroscope-io/pyroscope/pkg/structs/flamebearer"
1717
)
1818

19-
func JSONToProfileV1(b []byte, _ string, _ int) (*flamebearer.FlamebearerProfile, error) {
19+
func JSONToProfileV1(b []byte, name string, _ int) (*flamebearer.FlamebearerProfile, error) {
2020
var profile flamebearer.FlamebearerProfile
2121
if err := json.Unmarshal(b, &profile); err != nil {
2222
return nil, fmt.Errorf("unable to unmarshall JSON: %w", err)
2323
}
2424
if err := profile.Validate(); err != nil {
2525
return nil, fmt.Errorf("invalid profile: %w", err)
2626
}
27+
if name != "" {
28+
profile.Metadata.Name = name
29+
}
2730
return &profile, nil
2831
}
2932

0 commit comments

Comments
 (0)