The following configuration example shows how you configure Kafka to read data from topics and relay this data via OTLP.
kafkareceiver component.BROKER_ADDRESS.
For more information, see the Kafka Apache quickstart guide.Here is an example YAML file for a basic Collector configuration that can be used to receive OpenTelemetry traces, metrics, and logs from Kafka.
receivers:kafka:tls:insecure: true # Only necessary if your Kafka server does not provide a certificate that's trusted by the OTel Collector.traces:metrics:logs:brokers: ["${env:BROKER_ADDRESS}"]exporters:otlp_http:endpoint: ${env:DT_ENDPOINT}headers:Authorization: "Bearer ${env:DT_PLATFORM_TOKEN}"service:pipelines:traces:receivers: [kafka]exporters: [otlp_http]metrics:receivers: [kafka]exporters: [otlp_http]logs:receivers: [kafka]exporters: [otlp_http]
Assign the scope that matches your signal type: openpipeline:logs:ingest for logs, openpipeline:metrics:ingest for metrics, or openpipeline:traces:ingest for traces.
For this configuration to work, you need to set the following environment variables.
BROKER_ADDRESS: Specific to your Kafka server.DT_ENDPOINT: The base URL of the Dynatrace API endpoint (for example, https://{your-environment-id}.live.dynatrace.com/api/v2/otlp).DT_PLATFORM_TOKEN or DT_API_TOKEN: Your platform token or Classic access token, depending on the token type you use.Validate your settings to avoid any configuration issues.
For our configuration, we configure certain components as described in the sections below.
Under receivers, we specify kafka as the active receiver component for our deployment.
This is required to receive data from Kafka server.
Under exporters, we specify the otlp_http exporter to forward data into Dynatrace.
For this purpose, we set the following two environment variables and reference them in the configuration values for endpoint and Authorization.
DT_ENDPOINT contains the base URL of the Dynatrace API endpoint (for example, https://{your-environment-id}.live.dynatrace.com/api/v2/otlp).
One token variable, depending on the token type you use:
DT_PLATFORM_TOKEN contains your platform token with the openpipeline:logs:ingest, openpipeline:metrics:ingest, and openpipeline:traces:ingest scopes.DT_API_TOKEN contains your Classic access token with the Ingest logs (logs.ingest), Ingest metrics (metrics.ingest), and Ingest OpenTelemetry traces (openTelemetryTrace.ingest) scopes.Under service, we assemble our receiver, and exporter objects into service pipelines, which will perform these steps: