diff --git a/otel-collector/cmd/otel-collector/kodata/config.yaml b/otel-collector/cmd/otel-collector/kodata/config.yaml index ee67ed35..06221720 100644 --- a/otel-collector/cmd/otel-collector/kodata/config.yaml +++ b/otel-collector/cmd/otel-collector/kodata/config.yaml @@ -7,6 +7,8 @@ receivers: static_configs: # TODO: make this configurable - targets: ["localhost:2112"] + # Do not relabel job and instance labels if existed. + honor_labels: true metric_relabel_configs: - source_labels: [ __name__ ] regex: '^prometheus_.*' @@ -39,17 +41,22 @@ processors: resource: attributes: - # add instance_id as a resource attribute - - key: service.instance.id - from_attribute: faas.id + # The `gcp` resourcedetection processor sets `faas.name` to the name of the + # Cloud Run service or the Cloud Run job. + - from_attribute: faas.name + # The googlemanagedprometheus exporter consumes `service.name` attribute + # and set the `job` resource label to this value. (See + # https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/pull/764) + key: "service.name" action: upsert - # parse service name from K_SERVICE Cloud Run variable - - key: service.name - value: ${env:K_SERVICE} - action: insert exporters: googlemanagedprometheus: + sending_queue: + enabled: true + # we are handling metrics for a single pod, no need to have + # too many senders. this will also avoid out-of-order data. + num_consumers: 1 extensions: health_check: