Skip to content

Commit 5c27c04

Browse files
authored
Update instrumentation sample to use exponential histograms (#364)
* update collector to the latest release * update sample dependencies, which adds http route to http metrics * switch to exponential histograms * expose prometheus exporter for test
1 parent 5985b57 commit 5c27c04

File tree

3 files changed

+22
-13
lines changed

3 files changed

+22
-13
lines changed

samples/instrumentation-quickstart/docker-compose.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,15 @@ services:
2121
- OTEL_EXPORTER_OTLP_ENDPOINT=http://otelcol:4318
2222
- OTEL_SERVICE_NAME=otel-quickstart-python
2323
- OTEL_METRIC_EXPORT_INTERVAL=5000
24+
- OTEL_EXPORTER_OTLP_METRICS_DEFAULT_HISTOGRAM_AGGREGATION=base2_exponential_bucket_histogram
2425
volumes:
2526
- logs:/var/log:rw
2627
depends_on:
2728
- "otelcol"
2829
ports:
2930
- 8080
3031
otelcol:
31-
image: otel/opentelemetry-collector-contrib:0.92.0
32+
image: otel/opentelemetry-collector-contrib:0.115.1
3233
volumes:
3334
- ./otel-collector-config.yaml:/etc/otelcol-contrib/config.yaml:ro
3435
- logs:/var/log:ro

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,12 @@ receivers:
8585
exporters:
8686
# Export logs and traces using the standard googelcloud exporter
8787
googlecloud:
88-
project: $GOOGLE_CLOUD_PROJECT
88+
project: ${GOOGLE_CLOUD_PROJECT}
8989
log:
9090
default_log_name: "opentelemetry.io/collector-exported-log"
9191
# Export metrics to Google Managed service for Prometheus
9292
googlemanagedprometheus:
93-
project: $GOOGLE_CLOUD_PROJECT
93+
project: ${GOOGLE_CLOUD_PROJECT}
9494

9595
processors:
9696
# Batch telemetry together to more efficiently send to GCP
@@ -111,6 +111,14 @@ processors:
111111
detectors: ["env", "gcp"]
112112

113113
service:
114+
telemetry:
115+
metrics:
116+
readers:
117+
- pull:
118+
exporter:
119+
prometheus:
120+
host: '0.0.0.0'
121+
port: 8888
114122
pipelines:
115123
traces:
116124
receivers: ["otlp"]
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Dependencies require for the instrumentation sample
2-
flask==3.0.2
3-
requests==2.31.0
4-
opentelemetry-api==1.24.0
5-
opentelemetry-sdk==1.24.0
6-
opentelemetry-exporter-otlp-proto-http==1.24.0
7-
opentelemetry-instrumentation-flask==0.45b0
8-
opentelemetry-instrumentation-requests==0.45b0
9-
opentelemetry-instrumentation-logging==0.45b0
10-
python-json-logger==2.0.7
11-
gunicorn==22.0.0
2+
flask==3.1.0
3+
requests==2.32.3
4+
opentelemetry-api==1.29.0
5+
opentelemetry-sdk==1.29.0
6+
opentelemetry-exporter-otlp-proto-http==1.29.0
7+
opentelemetry-instrumentation-flask==0.50b0
8+
opentelemetry-instrumentation-requests==0.50b0
9+
opentelemetry-instrumentation-logging==0.50b0
10+
python-json-logger==3.2.0
11+
gunicorn==23.0.0

0 commit comments

Comments
 (0)