Skip to content

Commit

Permalink
Use RemoveIf
Browse files Browse the repository at this point in the history
  • Loading branch information
mauri870 committed Jan 10, 2025
1 parent 08330da commit f60d701
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions exporter/elasticsearchexporter/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -460,13 +460,16 @@ func (e *elasticsearchExporter) pushSpanEvent(
return bulkIndexerSession.Add(ctx, fIndex, "", bytes.NewReader(docBytes), nil)
}

func (e *elasticsearchExporter) extractDocumentIDAttribute(m pcommon.Map) string {
if e.config.LogsDynamicID.Enabled {
docID, ok := getFromAttributes(documentIDAttributeName, "", m)
m.Remove(documentIDAttributeName)
if docID != "" && ok {
return docID
}
func (e *elasticsearchExporter) extractDocumentIDAttribute(m pcommon.Map) (docID string) {
if !e.config.LogsDynamicID.Enabled {
return
}
return ""
m.RemoveIf(func(k string, value pcommon.Value) bool {
if k == documentIDAttributeName {
docID = value.AsString()
return true
}
return false
})
return
}

0 comments on commit f60d701

Please sign in to comment.