|
|
||
|---|---|---|
| .. | ||
| src | ||
| README.md | ||
| build.gradle.kts | ||
| gradle.properties | ||
README.md
GCP Resource Detectors for OpenTelemetry
This module provides GCP resource detectors for OpenTelemetry.
The following OpenTelemetry semantic conventions will be detected:
| Resource attribute | GCE | GKE | GCR | GCF | GAE |
|---|---|---|---|---|---|
| cloud.platform | gcp_compute_engine | gcp_kubernetes_engine | gcp_cloud_run | gcp_cloud_run | gcp_app_engine |
| cloud.provider | gcp | gcp | gcp | gcp | gcp |
| cloud.account.id | auto | auto | auto | auto | auto |
| cloud.availability_zone | auto | auto | auto | auto | auto |
| cloud.region | auto | auto | auto | auto | auto |
| host.id | auto | auto | |||
| host.name | auto | auto | |||
| host.type | auto | auto | |||
| k8s.pod.name | downward API or auto | ||||
| k8s.namespace.name | downward API | ||||
| k8s.container.name | hardcoded (manual) | ||||
| k8s.cluster.name | auto | ||||
| faas.name | auto | auto | auto | ||
| faas.version | auto | auto | auto | ||
| faas.instance | auto | auto | auto |
Downward API
For GKE applications, some values must be passed via the environment variable using k8s
"downward API". For example, the following spec will ensure k8s.namespace.name and
k8s.pod.name are correctly discovered:
spec:
containers:
- name: my-application
image: gcr.io/my-project/my-image:latest
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: CONTAINER_NAME
value: my-application
Additionally, the container name will only be discovered via the environment variable CONTAINER_NAME
which much be included in the environment.
Usage with Manual Instrumentation
It is recommended to use this resource detector with the OpenTelemetry Autoconfiguration SPI. The GCP resource detector automatically provides the detected resources via the autoconfigure-spi SDK extension.
For a reference example showcasing the detected resource attributes and usage with autoconfigure-spi, see the Resource detection example.
Usage with Auto-Instrumentation
With the release of v2.2.0 of the OpenTelemetry Java Instrumentation, the GCP resource detector is now included with the Java agent.
For users of Java Agent v2.2.0 and later, the GCP resource detectors can be enabled by following the instructions provided here.
Component Owners
- Josh Suereth, Google
- Pranav Sharma, Google
Learn more about component owners in component_owners.yml.