Documentation
¶
Overview ¶
Package traceutil provides utilities for converting OTel semantics to DD semantics.
Index ¶
- Constants
- Variables
- func GetOTelAttrFromEitherMap(map1 pcommon.Map, map2 pcommon.Map, normalize bool, keys ...string) string
- func GetOTelAttrVal(attrs pcommon.Map, normalize bool, keys ...string) string
- func GetOTelAttrValInResAndSpanAttrs(span ptrace.Span, res pcommon.Resource, normalize bool, keys ...string) string
- func GetOTelContainerTags(rattrs pcommon.Map, tagKeys []string) []string
- func GetOTelOperationNameV1(span ptrace.Span, res pcommon.Resource, lib pcommon.InstrumentationScope, ...) string
- func GetOTelOperationNameV2(span ptrace.Span, res pcommon.Resource) string
- func GetOTelResourceV1(span ptrace.Span, res pcommon.Resource) (resName string)
- func GetOTelResourceV2(span ptrace.Span, res pcommon.Resource) (resName string)
- func GetOTelService(span ptrace.Span, res pcommon.Resource, normalize bool) string
- func GetOTelSpanType(span ptrace.Span, res pcommon.Resource) string
- func GetTopLevelOTelSpans(spanByID map[pcommon.SpanID]ptrace.Span, ...) map[pcommon.SpanID]struct{}
- func IndexOTelSpans(traces ptrace.Traces) (map[pcommon.SpanID]ptrace.Span, map[pcommon.SpanID]pcommon.Resource, ...)
- func OTelSpanIDToUint64(b [8]byte) uint64
- func OTelSpanKindName(k ptrace.SpanKind) string
- func OTelTraceIDToUint64(b [16]byte) uint64
- func SpanKind2Type(span ptrace.Span, res pcommon.Resource) string
Constants ¶
const DefaultOTLPServiceName = "otlpresourcenoservicename"
DefaultOTLPServiceName is the default service name for OTel spans when no service name is found in the resource attributes.
Variables ¶
var ( // SignalTypeSet is the OTel attribute set for traces. SignalTypeSet = attribute.NewSet(attribute.String("signal", "traces")) )
Functions ¶
func GetOTelAttrFromEitherMap ¶
func GetOTelAttrFromEitherMap(map1 pcommon.Map, map2 pcommon.Map, normalize bool, keys ...string) string
GetOTelAttrFromEitherMap returns the matched value as a string in either attribute map with the given keys. If there are multiple keys present, the first matched one is returned. If the key is present in both maps, map1 takes precedence. If normalize is true, normalize the return value with NormalizeTagValue.
func GetOTelAttrVal ¶
GetOTelAttrVal returns the matched value as a string in the input map with the given keys. If there are multiple keys present, the first matched one is returned. If normalize is true, normalize the return value with NormalizeTagValue.
func GetOTelAttrValInResAndSpanAttrs ¶
func GetOTelAttrValInResAndSpanAttrs(span ptrace.Span, res pcommon.Resource, normalize bool, keys ...string) string
GetOTelAttrValInResAndSpanAttrs returns the matched value as a string in the OTel resource attributes and span attributes with the given keys. If there are multiple keys present, the first matched one is returned. If the key is present in both resource attributes and span attributes, resource attributes take precedence. If normalize is true, normalize the return value with NormalizeTagValue.
func GetOTelContainerTags ¶
GetOTelContainerTags returns a list of DD container tags in the OTel resource attributes. Tags are always normalized.
func GetOTelOperationNameV1 ¶
func GetOTelOperationNameV1( span ptrace.Span, res pcommon.Resource, lib pcommon.InstrumentationScope, spanNameAsResourceName bool, spanNameRemappings map[string]string, normalize bool) string
GetOTelOperationNameV1 returns the DD operation name based on OTel span and resource attributes and given configs.
func GetOTelOperationNameV2 ¶
GetOTelOperationNameV2 returns the DD operation name based on OTel span and resource attributes and given configs.
func GetOTelResourceV1 ¶
GetOTelResourceV1 returns the DD resource name based on OTel span and resource attributes.
func GetOTelResourceV2 ¶
GetOTelResourceV2 returns the DD resource name based on OTel span and resource attributes.
func GetOTelService ¶
GetOTelService returns the DD service name based on OTel span and resource attributes.
func GetOTelSpanType ¶
GetOTelSpanType returns the DD span type based on OTel span kind and attributes. This logic is used in ReceiveResourceSpansV2 logic
func GetTopLevelOTelSpans ¶
func GetTopLevelOTelSpans(spanByID map[pcommon.SpanID]ptrace.Span, resByID map[pcommon.SpanID]pcommon.Resource, topLevelByKind bool) map[pcommon.SpanID]struct{}
GetTopLevelOTelSpans returns the span IDs of the top level OTel spans.
func IndexOTelSpans ¶
func IndexOTelSpans(traces ptrace.Traces) (map[pcommon.SpanID]ptrace.Span, map[pcommon.SpanID]pcommon.Resource, map[pcommon.SpanID]pcommon.InstrumentationScope)
IndexOTelSpans iterates over the input OTel spans and returns 3 maps: OTel spans indexed by span ID, OTel resources indexed by span ID, OTel instrumentation scopes indexed by span ID. Skips spans with invalid trace ID or span ID. If there are multiple spans with the same (non-zero) span ID, the last one wins.
func OTelSpanIDToUint64 ¶
OTelSpanIDToUint64 converts an OTel span ID to an uint64
func OTelSpanKindName ¶
OTelSpanKindName converts the given SpanKind to a valid Datadog span kind name.
func OTelTraceIDToUint64 ¶
OTelTraceIDToUint64 converts an OTel trace ID to an uint64
Types ¶
This section is empty.