Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove usages of deprecated Map.Delete method #9723

Merged
merged 1 commit into from
May 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/coreinternal/attraction/attraction.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ func (ap *AttrProc) Process(ctx context.Context, logger *zap.Logger, attrs pcomm
// and could impact performance.
switch action.Action {
case DELETE:
attrs.Delete(action.Key)
attrs.Remove(action.Key)
case INSERT:
av, found := getSourceAttributeValue(ctx, action, attrs)
if !found {
Expand Down
16 changes: 8 additions & 8 deletions pkg/translator/jaeger/jaegerproto_to_traces.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func translateHostnameAttr(attrs pcommon.Map) {
_, convHostNameFound := attrs.Get(conventions.AttributeHostName)
if hostnameFound && !convHostNameFound {
attrs.Insert(conventions.AttributeHostName, hostname)
attrs.Delete("hostname")
attrs.Remove("hostname")
}
}

Expand All @@ -117,7 +117,7 @@ func translateJaegerVersionAttr(attrs pcommon.Map) {
_, exporterVersionFound := attrs.Get(occonventions.AttributeExporterVersion)
if jaegerVersionFound && !exporterVersionFound {
attrs.InsertString(occonventions.AttributeExporterVersion, "Jaeger-"+jaegerVersion.StringVal())
attrs.Delete("jaeger.version")
attrs.Remove("jaeger.version")
}
}

Expand Down Expand Up @@ -163,7 +163,7 @@ func jSpanToInternal(span *model.Span, spansByLibrary map[instrumentationLibrary
setInternalSpanStatus(attrs, dest.Status())
if spanKindAttr, ok := attrs.Get(tracetranslator.TagSpanKind); ok {
dest.SetKind(jSpanKindToInternal(spanKindAttr.StringVal()))
attrs.Delete(tracetranslator.TagSpanKind)
attrs.Remove(tracetranslator.TagSpanKind)
}

dest.SetTraceState(getTraceStateFromAttrs(attrs))
Expand Down Expand Up @@ -204,7 +204,7 @@ func setInternalSpanStatus(attrs pcommon.Map, dest ptrace.SpanStatus) {
if errorVal, ok := attrs.Get(tracetranslator.TagError); ok {
if errorVal.BoolVal() {
statusCode = ptrace.StatusCodeError
attrs.Delete(tracetranslator.TagError)
attrs.Remove(tracetranslator.TagError)
statusExists = true

if desc, ok := extractStatusDescFromAttr(attrs); ok {
Expand Down Expand Up @@ -235,7 +235,7 @@ func setInternalSpanStatus(attrs pcommon.Map, dest ptrace.SpanStatus) {
// Regardless of error tag value, remove the otel.status_code tag. The
// otel.status_message tag will have already been removed if
// statusExists is true.
attrs.Delete(conventions.OtelStatusCode)
attrs.Remove(conventions.OtelStatusCode)
} else if httpCodeAttr, ok := attrs.Get(conventions.AttributeHTTPStatusCode); !statusExists && ok {
// Fallback to introspecting if this span represents a failed HTTP
// request or response, but again, only do so if the `error` tag was
Expand Down Expand Up @@ -265,7 +265,7 @@ func setInternalSpanStatus(attrs pcommon.Map, dest ptrace.SpanStatus) {
func extractStatusDescFromAttr(attrs pcommon.Map) (string, bool) {
if msgAttr, ok := attrs.Get(conventions.OtelStatusDescription); ok {
msg := msgAttr.StringVal()
attrs.Delete(conventions.OtelStatusDescription)
attrs.Remove(conventions.OtelStatusDescription)
return msg, true
}
return "", false
Expand Down Expand Up @@ -342,7 +342,7 @@ func jLogsToSpanEvents(logs []model.Log, dest ptrace.SpanEventSlice) {
jTagsToInternalAttributes(log.Fields, attrs)
if name, ok := attrs.Get(tracetranslator.TagMessage); ok {
event.SetName(name.StringVal())
attrs.Delete(tracetranslator.TagMessage)
attrs.Remove(tracetranslator.TagMessage)
}
}
}
Expand Down Expand Up @@ -370,7 +370,7 @@ func getTraceStateFromAttrs(attrs pcommon.Map) ptrace.TraceState {
// TODO Bring this inline with solution for jaegertracing/jaeger-client-java #702 once available
if attr, ok := attrs.Get(tracetranslator.TagW3CTraceState); ok {
traceState = ptrace.TraceState(attr.StringVal())
attrs.Delete(tracetranslator.TagW3CTraceState)
attrs.Remove(tracetranslator.TagW3CTraceState)
}
return traceState
}
Expand Down
2 changes: 1 addition & 1 deletion processor/groupbyattrsprocessor/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func (gap *groupByAttrsProcessor) processMetrics(ctx context.Context, md pmetric

func deleteAttributes(attrsForRemoval, targetAttrs pcommon.Map) {
attrsForRemoval.Range(func(key string, _ pcommon.Value) bool {
targetAttrs.Delete(key)
targetAttrs.Remove(key)
return true
})
}
Expand Down