Resource Detection
Overview
The Resource detection processor can be used to detect resource information from the host, in a format that conforms to the OpenTelemetry resource semantic conventions, and append or override the resource value in telemetry data with this information.
Supported types: Logs · Metrics · Traces
Reminder: If a configured resource detector fails, the error will propagate and stop the collector from starting. The
processor.resourcedetection.propagateerrorsfeature gate is now stable and always enabled (as of v0.146.0).
Basic Configuration
| Parameter | Type | Default Value | Required | Description |
|---|---|---|---|---|
| detectors | list | system | Yes | Select resource detectors to enable |
| timeout | duration | 2s | No | Maximum time to wait for detection to complete |
| override | bool | false | No | Whether to override existing resource attributes |
Supported Detectors
- system (default)
- ec2
- consul
- aks
- azure
- eks
- gcp
- openshift
- akamai
- oraclecloud
- heroku
- docker
- k8snode
- env
Note: When
Override Resource Attributesis set totrue, the following detectors have additional configuration options: system, ec2, and consul.
System Configuration
| Parameter | Type | Required | Description |
|---|---|---|---|
| hostname_sources | list | No | Configure hostname sources (OS, DNS, CNAME, Lookup) |
EC2 Configuration
EC2 Tags
| Parameter | Type | Required | Description |
|---|---|---|---|
| tags | list | No | List of EC2 tag keys to collect as resource attributes |
Consul Configuration
| Parameter | Type | Default Value | Required | Description |
|---|---|---|---|---|
| address | string | No | Address of the Consul server | |
| datacenter | string | No | Datacenter to use | |
| token | string | No | ACL token (falls back to CONSUL_HTTP_TOKEN environment variable) | |
| token_file | string | No | File containing token (falls back to CONSUL_HTTP_TOKEN_FILE environment variable) | |
| namespace | string | No | Optional namespace (falls back to CONSUL_NAMESPACE environment variable) | |
| meta | map[string]string | No | Allowlist of Consul Metadata keys to use as resource attributes |
k8s Node Configuration
| Parameter | Type | Default Value | Required | Description |
|---|---|---|---|---|
| node_from_env_var | string | K8S_NODE_NAME | No | Environment variable that contains the Kubernetes node name |
Example Configuration
{
"detectors": ["system"], // required, default: system
"ec2": {
"tags": [], // default: []
},
"k8snode": {
"node_from_env_var": "K8S_NODE_NAME", // default: "K8S_NODE_NAME"
},
"consul": {
"address": "", // default: none
"datacenter": "", // default: none
"token": "", // default: none
"token_file": "", // default: none
"namespace": "", // default: none
"meta": {}, // default: none
},
"system": {
"hostname_sources": {
"os": true, // default: true
"dns": false, // default: false
"cname": false, // default: false
"lookup": false, // default: false
},
},
"timeout": "2s", // default: "2s"
"override": false, // default: false
}