Skip to content

Commit

Permalink
Update container images to launch a otel collector and a prometheus s…
Browse files Browse the repository at this point in the history
…erver
  • Loading branch information
inean committed Sep 13, 2024
1 parent dd64330 commit 6fb2c58
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,14 @@
"8080": {
"label": "Traefik Dashboard",
"onAutoForward": "notify"
},
"4317": {
"label": "Telemetry",
"onAutoForward": "notify"
},
"9090": {
"label": "Prometheus",
"onAutoForward": "notify"
}
},

Expand Down
20 changes: 20 additions & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ services:
dockerfile: .devcontainer/Dockerfile
environment:
- PYTHONUNBUFFERED=1
- OTEL_EXPORTER_OTLP_ENDPOINT=telemetry:4317
volumes:
- "..:/workspace:cached"
cap_add:
Expand All @@ -17,6 +18,7 @@ services:
- label=disable
- apparmor=unconfined
depends_on:
- telemetry
- traefik
- whoami
# Override the default command so things don't shut down after the process ends.
Expand All @@ -42,6 +44,24 @@ services:
- "label=disable"
- "apparmor=unconfined"

telemetry:
image: otel/opentelemetry-collector:latest
container_name: telemetry
volumes:
- ./opentelemetry.yml:/etc/otelcol/config.yaml:ro
ports:
- "4317:4317" # OTLP gRPC receiver
- "8888:8888" # Prometheus metrics exposed by the collector
- "8889:8889" # Prometheus exporter metrics

prometheus:
image: prom/prometheus:latest
restart: always
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
ports:
- "9090:9090"

whoami:
image: "containous/whoami"
container_name: "whoami"
Expand Down
25 changes: 25 additions & 0 deletions .devcontainer/opentelemetry.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
receivers:
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317

exporters:
prometheus:
endpoint: "0.0.0.0:8889"
const_labels:
label1: value1
debug:

service:
pipelines:
logs:
receivers: [otlp]
exporters: [debug]
traces:
receivers: [otlp]
exporters: [debug]
metrics:
receivers: [otlp]
exporters: [debug, prometheus]
6 changes: 6 additions & 0 deletions .devcontainer/prometheus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
scrape_configs:
- job_name: "otel-collector"
scrape_interval: 10s
static_configs:
- targets: ["telemetry:8889"]
- targets: ["telemetry:8888"]

0 comments on commit 6fb2c58

Please sign in to comment.