Skip to main content

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.propagateerrors feature gate is now stable and always enabled (as of v0.146.0).

Basic Configuration

ParameterTypeDefault ValueRequiredDescription
detectorslistsystemYesSelect resource detectors to enable
timeoutduration2sNoMaximum time to wait for detection to complete
overrideboolfalseNoWhether 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 Attributes is set to true, the following detectors have additional configuration options: system, ec2, and consul.

System Configuration

ParameterTypeRequiredDescription
hostname_sourceslistNoConfigure hostname sources (OS, DNS, CNAME, Lookup)

EC2 Configuration

EC2 Tags

ParameterTypeRequiredDescription
tagslistNoList of EC2 tag keys to collect as resource attributes

Consul Configuration

ParameterTypeDefault ValueRequiredDescription
addressstringNoAddress of the Consul server
datacenterstringNoDatacenter to use
tokenstringNoACL token (falls back to CONSUL_HTTP_TOKEN environment variable)
token_filestringNoFile containing token (falls back to CONSUL_HTTP_TOKEN_FILE environment variable)
namespacestringNoOptional namespace (falls back to CONSUL_NAMESPACE environment variable)
metamap[string]stringNoAllowlist of Consul Metadata keys to use as resource attributes

k8s Node Configuration

ParameterTypeDefault ValueRequiredDescription
node_from_env_varstringK8S_NODE_NAMENoEnvironment 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
}