Documentation
¶
Overview ¶
Package transform implements mappings from OTLP to DD semantics, and helpers
Index ¶
- Constants
- func GetDDKeyForOTLPAttribute(k string) string
- func GetFirstFromMap(m map[string]string, keys ...string) (string, string)
- func GetOTelContainerID(span ptrace.Span, res pcommon.Resource) string
- func GetOTelContainerOrPodID(span ptrace.Span, res pcommon.Resource) string
- func GetOTelContainerTags(rattrs pcommon.Map, tagKeys []string) []string
- func GetOTelEnv(span ptrace.Span, res pcommon.Resource) string
- func GetOTelHostname(span ptrace.Span, res pcommon.Resource, tr *attributes.Translator, ...) string
- func GetOTelStatusCode(span ptrace.Span, res pcommon.Resource) uint32
- func GetOTelVersion(span ptrace.Span, res pcommon.Resource) string
- func MarshalEvents(events ptrace.SpanEventSlice) string
- func MarshalLinks(links ptrace.SpanLinkSlice) string
- func ObfuscateRedisSpan(o *obfuscate.Obfuscator, span *pb.Span, removeAllArgs bool)
- func ObfuscateSQLSpan(o *obfuscate.Obfuscator, span *pb.Span) (*obfuscate.ObfuscatedQuery, error)
- func ObfuscateValkeySpan(o *obfuscate.Obfuscator, span *pb.Span, removeAllArgs bool)
- func OperationAndResourceNameV2Enabled(conf *config.AgentConfig) bool
- func OtelSpanToDDSpan(otelspan ptrace.Span, otelres pcommon.Resource, ...) *pb.Span
- func OtelSpanToDDSpanMinimal(otelspan ptrace.Span, otelres pcommon.Resource, ...) *pb.Span
- func SetMetaOTLP(s *pb.Span, k, v string)
- func SetMetaOTLPIfEmpty(s *pb.Span, k, v string)
- func SetMetricOTLP(s *pb.Span, k string, v float64)
- func SetMetricOTLPIfEmpty(s *pb.Span, k string, v float64)
- func Status2Error(status ptrace.Status, _ ptrace.SpanEventSlice, metaMap map[string]string) int32
- func TagSpanIfContainsExceptionEvent(otelspan ptrace.Span, ddspan *pb.Span)
Constants ¶
const ( // TagRedisRawCommand represents a redis raw command tag TagRedisRawCommand = "redis.raw_command" // TagValkeyRawCommand represents a redis raw command tag TagValkeyRawCommand = "valkey.raw_command" // TagMemcachedCommand represents a memcached command tag TagMemcachedCommand = "memcached.command" // TagMongoDBQuery represents a MongoDB query tag TagMongoDBQuery = "mongodb.query" // TagElasticBody represents an Elasticsearch body tag TagElasticBody = "elasticsearch.body" // TagOpenSearchBody represents an OpenSearch body tag TagOpenSearchBody = "opensearch.body" // TagSQLQuery represents a SQL query tag TagSQLQuery = "sql.query" // TagHTTPURL represents an HTTP URL tag TagHTTPURL = "http.url" // TagDBMS represents a DBMS tag TagDBMS = "db.type" )
const (
// TextNonParsable is the error text used when a query is non-parsable
TextNonParsable = "Non-parsable SQL query"
)
Variables ¶
This section is empty.
Functions ¶
func GetDDKeyForOTLPAttribute ¶ added in v0.65.0
GetDDKeyForOTLPAttribute looks for a key in the Datadog HTTP convention that matches the given key from the OTLP HTTP convention. Otherwise, check if it is a Datadog APM convention key - if it is, it will be handled with specialized logic elsewhere, so return an empty string. If it isn't, return the original key.
func GetFirstFromMap ¶
GetFirstFromMap checks each key in the given keys in the map and returns the first key-value pair whose key matches, or empty strings if none matches.
func GetOTelContainerID ¶ added in v0.68.0
GetOTelContainerID returns the container ID based on OTel span and resource attributes, with span taking precedence.
func GetOTelContainerOrPodID ¶ added in v0.77.0
GetOTelContainerOrPodID returns the container ID based on OTel span and resource attributes, with span taking precedence.
The Kubernetes pod UID will be used as a fallback if the container ID is not found. This is only done for backward compatibility; consider using GetOTelContainerID instead.
func GetOTelContainerTags ¶ added in v0.68.0
GetOTelContainerTags returns a list of DD container tags in the OTel resource attributes. Tags are always normalized.
func GetOTelEnv ¶ added in v0.68.0
GetOTelEnv returns the environment based on OTel span and resource attributes, with span taking precedence.
func GetOTelHostname ¶ added in v0.68.0
func GetOTelHostname(span ptrace.Span, res pcommon.Resource, tr *attributes.Translator, fallbackHost string) string
GetOTelHostname returns the DD hostname based on OTel span and resource attributes, with span taking precedence.
func GetOTelStatusCode ¶ added in v0.68.0
GetOTelStatusCode returns the HTTP status code based on OTel span and resource attributes, with span taking precedence.
func GetOTelVersion ¶ added in v0.68.0
GetOTelVersion returns the version based on OTel span and resource attributes, with span taking precedence.
func MarshalEvents ¶
func MarshalEvents(events ptrace.SpanEventSlice) string
MarshalEvents marshals events into JSON.
func MarshalLinks ¶
func MarshalLinks(links ptrace.SpanLinkSlice) string
MarshalLinks marshals span links into JSON.
func ObfuscateRedisSpan ¶ added in v0.63.0
func ObfuscateRedisSpan(o *obfuscate.Obfuscator, span *pb.Span, removeAllArgs bool)
ObfuscateRedisSpan obfuscates a Redis span using pkg/obfuscate logic
func ObfuscateSQLSpan ¶ added in v0.63.0
func ObfuscateSQLSpan(o *obfuscate.Obfuscator, span *pb.Span) (*obfuscate.ObfuscatedQuery, error)
ObfuscateSQLSpan obfuscates a SQL span using pkg/obfuscate logic
func ObfuscateValkeySpan ¶ added in v0.64.0
func ObfuscateValkeySpan(o *obfuscate.Obfuscator, span *pb.Span, removeAllArgs bool)
ObfuscateValkeySpan obfuscates a Valkey span using pkg/obfuscate logic
func OperationAndResourceNameV2Enabled ¶ added in v0.61.0
func OperationAndResourceNameV2Enabled(conf *config.AgentConfig) bool
OperationAndResourceNameV2Enabled checks if the new operation and resource name logic should be used
func OtelSpanToDDSpan ¶
func OtelSpanToDDSpan( otelspan ptrace.Span, otelres pcommon.Resource, lib pcommon.InstrumentationScope, conf *config.AgentConfig, ) *pb.Span
OtelSpanToDDSpan converts an OTel span to a DD span.
func OtelSpanToDDSpanMinimal ¶
func OtelSpanToDDSpanMinimal( otelspan ptrace.Span, otelres pcommon.Resource, lib pcommon.InstrumentationScope, isTopLevel, topLevelByKind bool, conf *config.AgentConfig, peerTagKeys []string, ) *pb.Span
OtelSpanToDDSpanMinimal converts an OTel span to a DD span with only the minimal fields needed for APM stats calculation. Only use with OTLPTracesToConcentratorInputs.
func SetMetaOTLP ¶
SetMetaOTLP sets the k/v OTLP attribute pair as a tag on span s.
func SetMetaOTLPIfEmpty ¶ added in v0.68.0
SetMetaOTLPIfEmpty sets the k/v OTLP attribute pair as a tag on span s, if the corresponding value hasn't been set already.
func SetMetricOTLP ¶
SetMetricOTLP sets the k/v OTLP attribute pair as a metric on span s.
func SetMetricOTLPIfEmpty ¶ added in v0.68.0
SetMetricOTLPIfEmpty sets the k/v OTLP attribute pair as a metric on span s, if the corresponding value hasn't been set already.
func Status2Error ¶
Status2Error checks the given status and events and applies any potential error and messages to the given span attributes. Note: This function uses the semantic registry for http.status_code lookup precedence. Previously it used NEW-first precedence (http.response.status_code before http.status_code).
Types ¶
This section is empty.