Skip to content

Commit ad56611

Browse files
committed
make fmt
1 parent e345ace commit ad56611

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pkg/ingester/otlp/convert.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import (
88
otelProfile "github.com/grafana/pyroscope/api/otlp/profiles/v1experimental"
99
)
1010

11+
const serviceNameKey = "service.name"
12+
1113
// ConvertOtelToGoogle converts an OpenTelemetry profile to a Google profile.
1214
func ConvertOtelToGoogle(src *otelProfile.Profile) map[string]*googleProfile.Profile {
1315
svc2Profile := make(map[string]*profileBuilder)
@@ -103,7 +105,7 @@ func (p *profileBuilder) addfunc(s string) uint64 {
103105
func serviceNameFromSample(p *otelProfile.Profile, sample *otelProfile.Sample) string {
104106
for _, attributeIndex := range sample.Attributes {
105107
attribute := p.AttributeTable[attributeIndex]
106-
if attribute.Key == "service.name" {
108+
if attribute.Key == serviceNameKey {
107109
return attribute.Value.GetStringValue()
108110
}
109111
}
@@ -205,7 +207,7 @@ func (p *profileBuilder) convertSampleAttributesToLabelsBack(os *otelProfile.Sam
205207
gs.Label = make([]*googleProfile.Label, 0, len(os.Attributes))
206208
for _, attribute := range os.Attributes {
207209
att := p.src.AttributeTable[attribute]
208-
if att.Key == "service.name" {
210+
if att.Key == serviceNameKey {
209211
continue
210212
}
211213
if att.Value.GetStringValue() != "" {

0 commit comments

Comments
 (0)