Last active
June 11, 2023 15:33
-
-
Save Marthym/320fb102c473c17ee31367a067988800 to your computer and use it in GitHub Desktop.
Grafana Stack 📈 2. Collecte des métriques avec OpenTelemetry
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
version: "3.9" | |
services: | |
myapp: | |
image: marthym/myapp:latest | |
restart: unless-stopped | |
read_only: true | |
environment: | |
- SPRING_MAIN_BANNER-MODE | |
- SPRING_PROFILES_ACTIVE | |
networks: | |
myappnet: {} | |
prometheus: | |
image: prom/prometheus:v2.44.0 | |
restart: unless-stopped | |
command: | |
- --config.file=/etc/prometheus/prometheus.yml | |
- --storage.tsdb.path=/prometheus | |
- --web.console.libraries=/usr/share/prometheus/console_libraries | |
- --web.console.templates=/usr/share/prometheus/consoles | |
volumes: | |
- /opt/bw/prometheus/:/etc/prometheus/ | |
- prometheus_data:/prometheus | |
networks: | |
metrics: {} | |
opentelemetry: | |
image: otel/opentelemetry-collector-contrib:0.77.0 | |
user: 0:0 | |
command: | |
- --config=/etc/otel/receivers.yaml | |
- --config=/etc/otel/processors.yaml | |
- --config=/etc/otel/exporters.yaml | |
- --config=/etc/otel/service.yaml | |
logging: | |
driver: local | |
options: | |
max-size: 10m | |
volumes: | |
- /opt/opentelemetry:/etc/otel:ro | |
networks: | |
myappnet: {} | |
metrics: {} | |
volumes: | |
prometheus_data: {} | |
networks: | |
metrics: {} | |
myappnet: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exporters: | |
prometheus: | |
endpoint: '0.0.0.0:9091' | |
send_timestamps: true | |
enable_open_metrics: true | |
logging: | |
verbosity: detailed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
processors: | |
batch: | |
send_batch_size: 10000 | |
send_batch_max_size: 11000 | |
timeout: 10s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
receivers: | |
prometheus/myapp: | |
config: | |
scrape_configs: | |
- job_name: 'otel-collector' | |
scrape_interval: 15s | |
metrics_path: '/actuator/prometheus' | |
# Si vous avez sécurisé la route comme précognisé dans l’article précédent | |
# basic_auth: | |
# username: "otel_collector" | |
# password: "otel_password" | |
static_configs: | |
- targets: [myappservice:8081] | |
labels: | |
platform: 'prod' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
service: | |
pipelines: | |
metrics: | |
receivers: [prometheus/myapp] | |
processors: [batch] | |
exporters: [prometheus] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
global: | |
scrape_interval: 15s # By default, scrape targets every 15 seconds. | |
evaluation_interval: 15s # By default, scrape targets every 15 seconds. | |
# scrape_timeout is set to the global default (10s). | |
# A scrape configuration containing exactly one endpoint to scrape: | |
# Here it's Prometheus itself. | |
scrape_configs: | |
# Le job pour se collecter lui même (optionel) | |
- job_name: 'prometheus' | |
static_configs: | |
- targets: ['localhost:9090'] | |
# Le job de collecte OpenTelemetry | |
- job_name: 'otel-exporter' | |
scrape_interval: 15s | |
file_sd_configs: | |
- files: | |
- 'targets/otel_targets.yml' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- targets: | |
- 'opentelemetry:9091' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment