This recipe shows how to do basic trace enhancement by inserting values with the attributes processor.
- OpenTelemetry Operator installed in your cluster
- Running un-instrumented application (such as one of the sample apps).
- An
Instrumentation
object already created such as the one from the main README
Apply the OpenTelemetryCollector
object from collector-config.yaml
:
kubectl apply -f collector-config.yaml
Similar to the attributes processor, you can use the resource processor to parse resource attributes.
Combine the resource processor with the GCE/GKE resource detection recipe to auto-populate a new attribute dynamically based on where the app is running.
The config file collector-config-resource-detection.yaml
creates a new location
attribute that is parsed from the cloud zone or region the pod is running in.
Create this config with:
kubectl apply -f collector-config-resource-detection.yaml
(Optionally, also enable Cloud Trace integration to see the traces in your GCP dashboard.)
The regex in this config parses the first section of your node's zone or region to
its own location
attribute, for example us-central1
becomes us
and asia-south1-b
becomes asia
.