attributes

package module
v0.16.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2024 License: Apache-2.0 Imports: 12 Imported by: 12

Documentation

Index

Constants

View Source
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

View Source
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

func ContainerTagFromAttributes(attr map[string]string) map[string]string

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

func ContainerTagsFromResourceAttributes(attrs pcommon.Map) map[string]string

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

func OriginIDFromAttributes(attrs pcommon.Map) (originID string)

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

func SourceFromAttrs(attrs pcommon.Map) (source.Source, bool)

SourceFromAttrs gets a telemetry signal source from its attributes. Deprecated: Use Translator.ResourceToSource or Translator.AttributesToSource instead.

func TagsFromAttributes

func TagsFromAttributes(attrs pcommon.Map) []string

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

func (p *Translator) AttributesToSource(_ context.Context, attrs pcommon.Map) (source.Source, bool)

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.

func (*Translator) ResourceToSource added in v0.11.0

func (p *Translator) ResourceToSource(ctx context.Context, res pcommon.Resource, set attribute.Set) (source.Source, bool)

ResourceToSource gets a telemetry signal source from its resource attributes.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL