Skip to content

Commit

Permalink
chore: don't use deprecated pdata.AttributeValueToString (#209)
Browse files Browse the repository at this point in the history
  • Loading branch information
pmalek committed Sep 10, 2021
1 parent 2fd29c8 commit 2a5baaa
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pkg/exporter/sumologicexporter/carbon_formatter.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func carbon2TagString(record metricPair) string {
returnValue = append(returnValue, fmt.Sprintf(
"%s=%s",
sanitizeCarbonString(k),
sanitizeCarbonString(pdata.AttributeValueToString(v)),
sanitizeCarbonString(v.AsString()),
))
return true
})
Expand Down
2 changes: 1 addition & 1 deletion pkg/exporter/sumologicexporter/fields.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func (f fields) string() string {
fmt.Sprintf(
"%s=%s",
f.sanitizeField(k),
f.sanitizeField(pdata.AttributeValueToString(v)),
f.sanitizeField(v.AsString()),
),
)
return true
Expand Down
2 changes: 1 addition & 1 deletion pkg/exporter/sumologicexporter/graphite_formatter.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func (gf *graphiteFormatter) format(f fields, metricName string) string {
attr, ok := f.orig.Get(matchset)
var value string
if ok {
value = pdata.AttributeValueToString(attr)
value = attr.AsString()
} else {
value = ""
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/exporter/sumologicexporter/prometheus_formatter.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func (f *prometheusFormatter) tags2String(attr pdata.AttributeMap, labels pdata.
fmt.Sprintf(
`%s="%s"`,
f.sanitizeKey(k),
f.sanitizeValue(pdata.AttributeValueToString(v)),
f.sanitizeValue(v.AsString()),
),
)
return true
Expand Down
2 changes: 1 addition & 1 deletion pkg/exporter/sumologicexporter/sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ func (s *sender) createRequest(ctx context.Context, pipeline PipelineType, data

// logToText converts LogRecord to a plain text line, returns it and error eventually
func (s *sender) logToText(record pdata.LogRecord) string {
return pdata.AttributeValueToString(record.Body())
return record.Body().AsString()
}

// logToJSON converts LogRecord to a json line, returns it and error eventually
Expand Down
4 changes: 1 addition & 3 deletions pkg/exporter/sumologicexporter/source_format.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ package sumologicexporter
import (
"fmt"
"regexp"

"go.opentelemetry.io/collector/model/pdata"
)

type sourceFormats struct {
Expand Down Expand Up @@ -80,7 +78,7 @@ func (s *sourceFormat) format(f fields) string {
for _, matchset := range s.matches {
v, ok := f.orig.Get(matchset)
if ok {
labels = append(labels, pdata.AttributeValueToString(v))
labels = append(labels, v.AsString())
} else {
labels = append(labels, unrecognizedAttributeValue)
}
Expand Down

0 comments on commit 2a5baaa

Please sign in to comment.