Skip to content

Commit 4aa992f

Browse files
authored
migrate instrumentation sample to otlphttp (#459)
* mgirate instrumentation sample to otlphttp * update go version * update quickerstart integration tests * update quickstarttest * update quickstarttest dependency * fix environment variables
1 parent f3e483b commit 4aa992f

File tree

4 files changed

+35
-17
lines changed

4 files changed

+35
-17
lines changed

samples/instrumentation-quickstart/cloudbuild-integration.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@
1313
# limitations under the License.
1414

1515
steps:
16-
- name: golang:1.23
16+
- name: golang:1.25
1717
dir: samples/instrumentation-quickstart/integrationtest
1818
env:
1919
- COMPOSE_OVERRIDE_FILE=../docker-compose.cloudbuild.yaml
2020
# https://github.com/testcontainers/testcontainers-go/issues/2754
2121
- TESTCONTAINERS_RYUK_CONNECTION_TIMEOUT=10m
2222
- TESTCONTAINERS_RYUK_RECONNECTION_TIMEOUT=10m
23+
- GOOGLE_CLOUD_PROJECT=${_GOOGLE_CLOUD_PROJECT}
24+
- GOOGLE_CLOUD_QUOTA_PROJECT=${_GOOGLE_CLOUD_PROJECT}
2325
script: go test -v
2426

2527
logsBucket: gs://opentelemetry-ops-e2e-cloud-build-logs

samples/instrumentation-quickstart/integrationtest/go.mod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module integrationtest
22

33
go 1.24.9
44

5-
require github.com/GoogleCloudPlatform/opentelemetry-operations-e2e-testing/quickstarttest v0.0.0-20250114143142-e149ed7094ab
5+
require github.com/GoogleCloudPlatform/opentelemetry-operations-e2e-testing/quickstarttest v0.0.0-20251208180208-d58ab0851963
66

77
require (
88
dario.cat/mergo v1.0.2 // indirect
@@ -138,7 +138,7 @@ require (
138138
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect
139139
github.com/prometheus/client_golang v1.23.2 // indirect
140140
github.com/prometheus/client_model v0.6.2 // indirect
141-
github.com/prometheus/common v0.67.2 // indirect
141+
github.com/prometheus/common v0.67.4 // indirect
142142
github.com/prometheus/procfs v0.19.2 // indirect
143143
github.com/santhosh-tekuri/jsonschema/v6 v6.0.2 // indirect
144144
github.com/secure-systems-lab/go-securesystemslib v0.9.1 // indirect
@@ -150,8 +150,8 @@ require (
150150
github.com/spf13/cobra v1.10.1 // indirect
151151
github.com/spf13/pflag v1.0.10 // indirect
152152
github.com/stretchr/testify v1.11.1 // indirect
153-
github.com/testcontainers/testcontainers-go v0.39.0 // indirect
154-
github.com/testcontainers/testcontainers-go/modules/compose v0.39.1 // indirect
153+
github.com/testcontainers/testcontainers-go v0.40.0 // indirect
154+
github.com/testcontainers/testcontainers-go/modules/compose v0.40.0 // indirect
155155
github.com/theupdateframework/notary v0.7.0 // indirect
156156
github.com/tilt-dev/fsnotify v1.4.8-0.20220602155310-fff9c274a375 // indirect
157157
github.com/tklauser/go-sysconf v0.3.15 // indirect

samples/instrumentation-quickstart/integrationtest/go.sum

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ
88
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
99
github.com/DefangLabs/secret-detector v0.0.0-20250811234530-d4b4214cd679 h1:qNT7R4qrN+5u5ajSbqSW1opHP4LA8lzA+ASyw5MQZjs=
1010
github.com/DefangLabs/secret-detector v0.0.0-20250811234530-d4b4214cd679/go.mod h1:blbwPQh4DTlCZEfk1BLU4oMIhLda2U+A840Uag9DsZw=
11-
github.com/GoogleCloudPlatform/opentelemetry-operations-e2e-testing/quickstarttest v0.0.0-20250114143142-e149ed7094ab h1:9OXXzInvP4VS3HDWKffd3VWj4R4AF2GAtk32UZpeQGM=
12-
github.com/GoogleCloudPlatform/opentelemetry-operations-e2e-testing/quickstarttest v0.0.0-20250114143142-e149ed7094ab/go.mod h1:rO1zHFu/xDhYgOK4xQWzwwrmyegPn7ywl7R90t7zPcE=
11+
github.com/GoogleCloudPlatform/opentelemetry-operations-e2e-testing/quickstarttest v0.0.0-20251208180208-d58ab0851963 h1:nx9rAzzDqVtOxqULGTGqWCKC51x1f94h3rtczqLFg48=
12+
github.com/GoogleCloudPlatform/opentelemetry-operations-e2e-testing/quickstarttest v0.0.0-20251208180208-d58ab0851963/go.mod h1:3Le6vNcFeKawDXnVmGnk08p2eaxn0U9ZPb+CYyolpD8=
1313
github.com/Masterminds/semver/v3 v3.4.0 h1:Zog+i5UMtVoCU8oKka5P7i9q9HgrJeGzI9SA1Xbatp0=
1414
github.com/Masterminds/semver/v3 v3.4.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM=
1515
github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY=
@@ -424,8 +424,8 @@ github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvM
424424
github.com/prometheus/common v0.0.0-20180110214958-89604d197083/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
425425
github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
426426
github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc=
427-
github.com/prometheus/common v0.67.2 h1:PcBAckGFTIHt2+L3I33uNRTlKTplNzFctXcWhPyAEN8=
428-
github.com/prometheus/common v0.67.2/go.mod h1:63W3KZb1JOKgcjlIr64WW/LvFGAqKPj0atm+knVGEko=
427+
github.com/prometheus/common v0.67.4 h1:yR3NqWO1/UyO1w2PhUvXlGQs/PtFmoveVO0KZ4+Lvsc=
428+
github.com/prometheus/common v0.67.4/go.mod h1:gP0fq6YjjNCLssJCQp0yk4M8W6ikLURwkdd/YKtTbyI=
429429
github.com/prometheus/procfs v0.0.0-20180125133057-cb4147076ac7/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
430430
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
431431
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
@@ -479,10 +479,10 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5
479479
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
480480
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
481481
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
482-
github.com/testcontainers/testcontainers-go v0.39.0 h1:uCUJ5tA+fcxbFAB0uP3pIK3EJ2IjjDUHFSZ1H1UxAts=
483-
github.com/testcontainers/testcontainers-go v0.39.0/go.mod h1:qmHpkG7H5uPf/EvOORKvS6EuDkBUPE3zpVGaH9NL7f8=
484-
github.com/testcontainers/testcontainers-go/modules/compose v0.39.1 h1:/3kEZY3xH/ibgnUGAACmEcqVIqfXzqD1LdXnJqfsBrM=
485-
github.com/testcontainers/testcontainers-go/modules/compose v0.39.1/go.mod h1:qxH8QmljpneFWkGJ7RzjPOnoyRN760OZdq3bE0aG/bg=
482+
github.com/testcontainers/testcontainers-go v0.40.0 h1:pSdJYLOVgLE8YdUY2FHQ1Fxu+aMnb6JfVz1mxk7OeMU=
483+
github.com/testcontainers/testcontainers-go v0.40.0/go.mod h1:FSXV5KQtX2HAMlm7U3APNyLkkap35zNLxukw9oBi/MY=
484+
github.com/testcontainers/testcontainers-go/modules/compose v0.40.0 h1:Bj8W7GieY56sRbVJx1yLh0JVEtOQ8SQMhX+jRtzenLA=
485+
github.com/testcontainers/testcontainers-go/modules/compose v0.40.0/go.mod h1:fEEGqtsoH1KS+sUi1WG4+vH3fqdCyip1U9Hd8P3SRMA=
486486
github.com/theupdateframework/notary v0.7.0 h1:QyagRZ7wlSpjT5N2qQAh/pN+DVqgekv4DzbAiAiEL3c=
487487
github.com/theupdateframework/notary v0.7.0/go.mod h1:c9DRxcmhHmVLDay4/2fUYdISnHqbFDGRSlXPO0AhYWw=
488488
github.com/tilt-dev/fsnotify v1.4.8-0.20220602155310-fff9c274a375 h1:QB54BJwA6x8QU9nHY3xJSZR2kX9bgpZekRKGkLTmEXA=
@@ -655,9 +655,8 @@ gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWD
655655
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
656656
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
657657
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
658+
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
658659
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
659-
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
660-
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
661660
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
662661
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
663662
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

samples/instrumentation-quickstart/otel-collector-config.yaml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,17 @@ exporters:
9191
# Export metrics to Google Managed service for Prometheus
9292
googlemanagedprometheus:
9393
project: ${GOOGLE_CLOUD_PROJECT}
94+
otlphttp:
95+
encoding: proto
96+
endpoint: https://telemetry.googleapis.com
97+
# Use the googleclientauth extension to authenticate with Google credentials
98+
auth:
99+
authenticator: googleclientauth
100+
101+
extensions:
102+
googleclientauth:
103+
project: ${GOOGLE_CLOUD_PROJECT}
104+
quota_project: ${GOOGLE_CLOUD_PROJECT}
94105

95106
processors:
96107
# Batch telemetry together to more efficiently send to GCP
@@ -109,8 +120,14 @@ processors:
109120
# If running on GCP (e.g. on GKE), detect resource attributes from the environment.
110121
resourcedetection:
111122
detectors: ["env", "gcp"]
123+
resource/gcp_project_id:
124+
attributes:
125+
- key: gcp.project_id
126+
value: ${GOOGLE_CLOUD_PROJECT}
127+
action: insert
112128

113129
service:
130+
extensions: [googleclientauth]
114131
telemetry:
115132
metrics:
116133
readers:
@@ -122,8 +139,8 @@ service:
122139
pipelines:
123140
traces:
124141
receivers: ["otlp"]
125-
processors: ["batch", "resourcedetection"]
126-
exporters: ["googlecloud"]
142+
processors: ["batch", "resourcedetection", "resource/gcp_project_id"]
143+
exporters: ["otlphttp"]
127144
metrics:
128145
receivers: ["otlp"]
129146
processors: ["batch", "resourcedetection", "resource"]

0 commit comments

Comments
 (0)