Skip to content

Commit 589d6ab

Browse files
authored
Add instance to metrics (#128)
Previously I removed this because it didn't seem important to know the instance ID. However, `instance` turns out to be a uniqueness constraint that GMP treats specially. Adding back to avoid time series collision issue. Signed-off-by: Nghia Tran <[email protected]>
1 parent 6a39e30 commit 589d6ab

File tree

1 file changed

+7
-2
lines changed
  • modules/otel-collector/cmd/otel-collector/kodata

1 file changed

+7
-2
lines changed

modules/otel-collector/cmd/otel-collector/kodata/config.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,15 @@ processors:
3636
# automatically detect Cloud Run resource metadata
3737
resourcedetection:
3838
detectors: [env, gcp]
39-
timeout: 2s
40-
override: false
4139

4240
resource:
4341
attributes:
42+
# Add instance_id as a resource attribute, so to avoid race conditions
43+
# between multiple otel sidecar instance uploading overlapping time series
44+
# to the same buckets.
45+
- key: service.instance.id
46+
from_attribute: faas.id
47+
action: upsert
4448
# The `gcp` resourcedetection processor sets `faas.name` to the name of the
4549
# Cloud Run service or the Cloud Run job.
4650
- from_attribute: faas.name
@@ -69,6 +73,7 @@ service:
6973
level: "error"
7074
# Stack trace is less useful and break lines.
7175
disable_stacktrace: true
76+
encoding: json
7277

7378
extensions: [health_check]
7479
pipelines:

0 commit comments

Comments
 (0)