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, ignoreMissingDatadogFields bool) string
- func GetOTelContainerTags(rattrs pcommon.Map, tagKeys []string) []string
- func GetOTelEnv(span ptrace.Span, res pcommon.Resource, ignoreMissingDatadogFields bool) string
- func GetOTelHostname(span ptrace.Span, res pcommon.Resource, tr *attributes.Translator, ...) string
- func GetOTelStatusCode(span ptrace.Span, res pcommon.Resource, ignoreMissingDatadogFields bool) uint32
- func GetOTelVersion(span ptrace.Span, res pcommon.Resource, ignoreMissingDatadogFields bool) 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, events 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 ( // KeyDatadogService is the key for the service name in the Datadog namespace KeyDatadogService = "datadog.service" // KeyDatadogName is the key for the operation name in the Datadog namespace KeyDatadogName = "datadog.name" // KeyDatadogResource is the key for the resource name in the Datadog namespace KeyDatadogResource = "datadog.resource" // KeyDatadogSpanKind is the key for the span kind in the Datadog namespace KeyDatadogSpanKind = "datadog.span.kind" // KeyDatadogType is the key for the span type in the Datadog namespace KeyDatadogType = "datadog.type" // KeyDatadogError is the key for the error flag in the Datadog namespace KeyDatadogError = "datadog.error" // KeyDatadogErrorMsg is the key for the error message in the Datadog namespace KeyDatadogErrorMsg = "datadog.error.msg" // KeyDatadogErrorType is the key for the error type in the Datadog namespace KeyDatadogErrorType = "datadog.error.type" // KeyDatadogErrorStack is the key for the error stack in the Datadog namespace KeyDatadogErrorStack = "datadog.error.stack" // KeyDatadogVersion is the key for the version in the Datadog namespace KeyDatadogVersion = "datadog.version" // KeyDatadogHTTPStatusCode is the key for the HTTP status code in the Datadog namespace KeyDatadogHTTPStatusCode = "datadog.http_status_code" // KeyDatadogHost is the key for the host in the Datadog namespace KeyDatadogHost = "datadog.host" // KeyDatadogEnvironment is the key for the environment in the Datadog namespace KeyDatadogEnvironment = "datadog.env" // KeyDatadogContainerID is the key for the container ID in the Datadog namespace KeyDatadogContainerID = "datadog.container_id" // KeyDatadogContainerTags is the key for the container tags in the Datadog namespace KeyDatadogContainerTags = "datadog.container_tags" )
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
func GetOTelContainerID(span ptrace.Span, res pcommon.Resource, ignoreMissingDatadogFields bool) string
GetOTelContainerID returns the container ID based on OTel span and resource attributes, with span taking precedence.
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, ignoreMissingDatadogFields bool) string
GetOTelHostname returns the DD hostname based on OTel span and resource attributes, with span taking precedence.
func GetOTelStatusCode ¶ added in v0.68.0
func GetOTelStatusCode(span ptrace.Span, res pcommon.Resource, ignoreMissingDatadogFields bool) uint32
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 otelSpanToDDSpan converts an OTel span to a DD span. The converted DD span only has the minimal number of fields for APM stats calculation and is only meant to be used in OTLPTracesToConcentratorInputs. Do not use them for other purposes.
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 ¶
func Status2Error(status ptrace.Status, events ptrace.SpanEventSlice, metaMap map[string]string) int32
Status2Error checks the given status and events and applies any potential error and messages to the given span attributes.
Types ¶
This section is empty.