Documentation ¶
Index ¶
- Constants
- Variables
- func ContainerTagFromAttributes(attr map[string]string) map[string]string
- func ContainerTagsFromResourceAttributes(attrs pcommon.Map) map[string]string
- func OriginIDFromAttributes(attrs pcommon.Map) (originID string)
- func SourceFromAttrs(attrs pcommon.Map) (source.Source, bool)
- func TagsFromAttributes(attrs pcommon.Map) []string
- type Translator
Constants ¶
const ( // AttributeDatadogHostname the datadog host name attribute AttributeDatadogHostname = "datadog.host.name" // AttributeK8sNodeName the datadog k8s node name attribute AttributeK8sNodeName = "k8s.node.name" // Attribute host is a literal host tag. // We check for this to avoid double tagging. AttributeHost = "host" )
Variables ¶
var ( // ContainerMappings defines the mapping between OpenTelemetry semantic conventions // and Datadog Agent conventions for containers. ContainerMappings = map[string]string{ conventions.AttributeContainerID: "container_id", conventions.AttributeContainerName: "container_name", conventions.AttributeContainerImageName: "image_name", conventions.AttributeContainerImageTag: "image_tag", conventions.AttributeContainerRuntime: "runtime", conventions.AttributeCloudProvider: "cloud_provider", conventions.AttributeCloudRegion: "region", conventions.AttributeCloudAvailabilityZone: "zone", conventions.AttributeAWSECSTaskFamily: "task_family", conventions.AttributeAWSECSTaskARN: "task_arn", conventions.AttributeAWSECSClusterARN: "ecs_cluster_name", conventions.AttributeAWSECSTaskRevision: "task_version", conventions.AttributeAWSECSContainerARN: "ecs_container_name", conventions.AttributeK8SContainerName: "kube_container_name", conventions.AttributeK8SClusterName: "kube_cluster_name", conventions.AttributeK8SDeploymentName: "kube_deployment", conventions.AttributeK8SReplicaSetName: "kube_replica_set", conventions.AttributeK8SStatefulSetName: "kube_stateful_set", conventions.AttributeK8SDaemonSetName: "kube_daemon_set", conventions.AttributeK8SJobName: "kube_job", conventions.AttributeK8SCronJobName: "kube_cronjob", conventions.AttributeK8SNamespaceName: "kube_namespace", conventions.AttributeK8SPodName: "pod_name", } )
Functions ¶
func ContainerTagFromAttributes ¶
ContainerTagFromAttributes extracts the value of _dd.tags.container from the given set of attributes. Deprecated: Deprecated in favor of ContainerTagFromResourceAttributes.
func ContainerTagsFromResourceAttributes ¶ added in v0.8.1
ContainerTagFromResourceAttributes extracts container tags from the given set of resource attributes. Container tags are extracted via semantic conventions. Customer container tags are extracted via resource attributes prefixed by datadog.container.tag. Custom container tag values of a different type than ValueTypeStr will be ignored. In the case of duplicates between semantic conventions and custom resource attributes (e.g. container.id, datadog.container.tag.container_id) the semantic convention takes precedence.
func OriginIDFromAttributes ¶
OriginIDFromAttributes gets the origin IDs from resource attributes. If not found, an empty string is returned for each of them.
func SourceFromAttrs ¶ added in v0.1.3
SourceFromAttrs gets a telemetry signal source from its attributes. Deprecated: Use Translator.ResourceToSource or Translator.AttributesToSource instead.
func TagsFromAttributes ¶
TagsFromAttributes converts a selected list of attributes to a tag list that can be added to metrics.
Types ¶
type Translator ¶ added in v0.11.0
type Translator struct {
// contains filtered or unexported fields
}
Translator of attributes.
func NewTranslator ¶ added in v0.11.0
func NewTranslator(set component.TelemetrySettings) (*Translator, error)
NewTranslator returns a new attributes translator.
func (*Translator) AttributesToSource ¶ added in v0.11.0
AttributesToSource gets a telemetry signal source from a set of attributes. As opposed to ResourceToSource, this does not keep track of failed requests.
NOTE: This method SHOULD NOT generally be used: it is only used in the logs implementation because of a fallback logic that will be removed. The attributes detected are resource attributes, not attributes from a telemetry signal.