Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exporter/datadogexporter: enhance example #24231

Merged
merged 4 commits into from
Jul 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 76 additions & 4 deletions exporter/datadogexporter/examples/collector.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,21 @@ receivers:
# static_configs:
# - targets: ['0.0.0.0:8888']

# The Docker Stats receiver will add support for Container Metrics, making the "Containers Overview" dashboard available.
# Container Metrics has support in the Datadog Exporter starting v0.78.0.
docker_stats:
metrics:
container.network.io.usage.rx_packets:
enabled: true
container.network.io.usage.tx_packets:
enabled: true
container.cpu.usage.system:
enabled: true
container.memory.rss:
enabled: true
container.blockio.io_serviced_recursive:
enabled: true

# Read more about the filelog receiver here https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/filelogreceiver.
filelog:
include_file_path: true
Expand Down Expand Up @@ -82,6 +97,62 @@ processors:
send_batch_size: 100
timeout: 10s

# k8sattributes processor adds the necessary attributes to enable trace/metrics
# correlation by means of container tags.
k8sattributes:
passthrough: false
auth_type: "serviceAccount"

pod_association:
- sources:
- from: resource_attribute
name: k8s.pod.ip

extract:
metadata:
- k8s.pod.name
- k8s.pod.uid
- k8s.deployment.name
- k8s.node.name
- k8s.namespace.name
- k8s.pod.start_time
- k8s.replicaset.name
- k8s.replicaset.uid
- k8s.daemonset.name
- k8s.daemonset.uid
- k8s.job.name
- k8s.job.uid
- k8s.cronjob.name
- k8s.statefulset.name
- k8s.statefulset.uid
- container.image.name
- container.image.tag
- container.id
- k8s.container.name
- container.image.name
- container.image.tag
- container.id

labels:
- tag_name: kube_app_name
key: app.kubernetes.io/name
from: pod
- tag_name: kube_app_instance
key: app.kubernetes.io/instance
from: pod
- tag_name: kube_app_version
key: app.kubernetes.io/version
from: pod
- tag_name: kube_app_component
key: app.kubernetes.io/component
from: pod
- tag_name: kube_app_part_of
key: app.kubernetes.io/part-of
from: pod
- tag_name: kube_app_managed_by
key: app.kubernetes.io/managed-by
from: pod

# The resource detection processor adds context related to the cloud provider the Collector is running on.
# It is necessary **only** on gateway deployment mode, to correctly identify the host that telemetry data comes from.
resourcedetection:
Expand Down Expand Up @@ -297,21 +368,22 @@ service:
# Pipelines starting with `metrics` or `metrics/` define a metrics pipeline.
metrics:
# This pipeline has an OTLP receiver, a batch processor and a Datadog exporter.
receivers: [hostmetrics, otlp]
processors: [batch]
# It also has additional receivers which generate valuable metrics.
receivers: [hostmetrics, docker_stats, otlp]
processors: [k8sattributes, batch]
exporters: [datadog]
# Pipelines starting with `traces` or `traces/` define a traces pipeline.
traces:
# This pipeline has an OTLP receiver, a batch processor and a Datadog exporter.
receivers: [otlp]
processors: [batch]
processors: [k8sattributes, batch]
exporters: [datadog]

# Pipelines starting with `logs` or `logs/` define a logs pipeline.
logs:
# This pipeline has an OTLP receiver, filelog receiver, a batch processor and a Datadog exporter.
receivers: [otlp, filelog]
processors: [batch]
processors: [k8sattributes, batch]
exporters: [datadog]

# # To send data to the gateway on gateway deployment mode, define these pipelines instead.
Expand Down
2 changes: 2 additions & 0 deletions exporter/datadogexporter/examples_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (

"github.com/open-telemetry/opentelemetry-collector-contrib/processor/k8sattributesprocessor"
"github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/dockerstatsreceiver"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/filelogreceiver"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver"
)
Expand Down Expand Up @@ -89,6 +90,7 @@ func newTestComponents(t *testing.T) otelcol.Factories {
[]receiver.Factory{
otlpreceiver.NewFactory(),
hostmetricsreceiver.NewFactory(),
dockerstatsreceiver.NewFactory(),
filelogreceiver.NewFactory(),
}...,
)
Expand Down
7 changes: 7 additions & 0 deletions exporter/datadogexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ require (
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/resourcetotelemetry v0.81.0
github.com/open-telemetry/opentelemetry-collector-contrib/processor/k8sattributesprocessor v0.81.0
github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor v0.81.0
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/dockerstatsreceiver v0.81.0
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/filelogreceiver v0.81.0
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver v0.81.0
github.com/stretchr/testify v1.8.4
Expand Down Expand Up @@ -91,6 +92,7 @@ require (
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.1 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/gobwas/glob v0.2.3 // indirect
github.com/godbus/dbus/v5 v5.0.6 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
Expand Down Expand Up @@ -134,6 +136,7 @@ require (
github.com/mostynb/go-grpc-compression v1.2.0 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/internal/common v0.81.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/internal/docker v0.81.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/internal/filter v0.81.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza v0.81.0 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
Expand Down Expand Up @@ -258,3 +261,7 @@ replace github.com/outcaste-io/ristretto v0.2.0 => github.com/outcaste-io/ristre
replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatatest => ../../pkg/pdatatest

replace github.com/open-telemetry/opentelemetry-collector-contrib/internal/k8stest => ../../internal/k8stest

replace github.com/open-telemetry/opentelemetry-collector-contrib/receiver/dockerstatsreceiver => ../../receiver/dockerstatsreceiver

replace github.com/open-telemetry/opentelemetry-collector-contrib/internal/docker => ../../internal/docker
12 changes: 11 additions & 1 deletion exporter/datadogexporter/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.