diff --git a/exporter/googlecloudexporter/README.md b/exporter/googlecloudexporter/README.md index 566b6ff716b7..b70f2152da0a 100644 --- a/exporter/googlecloudexporter/README.md +++ b/exporter/googlecloudexporter/README.md @@ -235,6 +235,34 @@ following proxy environment variables: If set at Collector start time then exporters, regardless of protocol, will or will not proxy traffic as defined by these environment variables. +### Monitored Resources + +For metrics and logs, this exporter maps the OpenTelemetry Resource to a Google +Cloud [Logging\(https://cloud.google.com/logging/docs/api/v2/resource-list) or +[Monitoring](https://cloud.google.com/monitoring/api/resources) Monitored Resource. + +The complete mapping logic can be found [here](https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/blob/main/internal/resourcemapping/resourcemapping.go). +That may be the most helpful reference if you want to map to a specific monitored +resource. + +#### On GCP + +If running on GCP, using the GCP resource detector, as shown above, will populate +the resource attributes required to map to the appropriate monitored resource. + +#### Off GCP + +If you are not running on GCP, you still need to choose a [GCP zone or +region](https://cloud.google.com/compute/docs/regions-zones) to send telemetry to +by setting `cloud.availability_zone` or `cloud.region`. In addition, you should use the detector associated with other cloud providers, if applicable. + +If running on Kubernetes, it is recommended to additionally set `k8s.pod.name`, +`k8s.namespace.name`, and `k8s.container.name` using the `k8sattributes` processor. + +If you are getting "duplicate timeseries encountered" errors, it is likely because +you are missing a required resource attribute, causing a metric from two different +instances of an application to end up with the same monitored resource. + ### Preventing metric label collisions The metrics exporter can add metric labels to timeseries, such as when setting @@ -274,6 +302,9 @@ processors: - delete_key(attributes, "instrumentation_version") ``` +**Note** It is not recommended to use these transformations with the googlecloud +exporter in a logging or trace pipeline. + The same method can be used for any resource attributes being filtered to metric labels, or metric labels which might collide with the GCP monitored resource used with resource detection.