File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change 8
8
otelProfile "github.com/grafana/pyroscope/api/otlp/profiles/v1experimental"
9
9
)
10
10
11
+ const serviceNameKey = "service.name"
12
+
11
13
// ConvertOtelToGoogle converts an OpenTelemetry profile to a Google profile.
12
14
func ConvertOtelToGoogle (src * otelProfile.Profile ) map [string ]* googleProfile.Profile {
13
15
svc2Profile := make (map [string ]* profileBuilder )
@@ -103,7 +105,7 @@ func (p *profileBuilder) addfunc(s string) uint64 {
103
105
func serviceNameFromSample (p * otelProfile.Profile , sample * otelProfile.Sample ) string {
104
106
for _ , attributeIndex := range sample .Attributes {
105
107
attribute := p .AttributeTable [attributeIndex ]
106
- if attribute .Key == "service.name" {
108
+ if attribute .Key == serviceNameKey {
107
109
return attribute .Value .GetStringValue ()
108
110
}
109
111
}
@@ -205,7 +207,7 @@ func (p *profileBuilder) convertSampleAttributesToLabelsBack(os *otelProfile.Sam
205
207
gs .Label = make ([]* googleProfile.Label , 0 , len (os .Attributes ))
206
208
for _ , attribute := range os .Attributes {
207
209
att := p .src .AttributeTable [attribute ]
208
- if att .Key == "service.name" {
210
+ if att .Key == serviceNameKey {
209
211
continue
210
212
}
211
213
if att .Value .GetStringValue () != "" {
You can’t perform that action at this time.
0 commit comments