-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Grafana - Prometheus - NGINX - Grafana Agent - OTEL Collector
- Loading branch information
Showing
7 changed files
with
300 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
apiVersion: 1 | ||
|
||
datasources: | ||
- name: Prometheus | ||
type: prometheus | ||
uid: prometheus | ||
access: proxy | ||
orgId: 1 | ||
url: http://prometheus:9090 | ||
basicAuth: false | ||
isDefault: true | ||
version: 1 | ||
editable: true | ||
jsonData: | ||
httpMethod: POST | ||
exemplarTraceIdDestinations: | ||
- datasourceUid: Azure | ||
name: traceID | ||
urlDisplayLabel: View Trace in Azure | ||
- name: Azure | ||
type: grafana-azure-monitor-datasource | ||
uid: azure | ||
access: proxy | ||
orgId: 1 | ||
version: 1 | ||
editable: true | ||
jsonData: | ||
tenantId: $TENANT_ID # Directory (tenant) ID | ||
clientId: $CLIENT_ID # Application (tenant) ID | ||
cloudName: azuremonitor | ||
|
||
secureJsonData: | ||
clientSecret: $CLIENT_SECRET | ||
- name: Tempo | ||
type: tempo | ||
access: proxy | ||
orgId: 1 | ||
url: http://tempo:3200 | ||
basicAuth: false | ||
isDefault: false | ||
version: 1 | ||
editable: true | ||
apiVersion: 1 | ||
uid: tempo | ||
jsonData: | ||
httpMethod: GET | ||
serviceMap: | ||
datasourceUid: prometheus | ||
tracesToLogs: | ||
datasourceUid: "Loki" | ||
mapTagNamesEnabled: true | ||
tags: ["traceId"] | ||
mappedTags: [{ key: "traceId", value: "tid" }] | ||
spanStartTimeShift: "1h" | ||
spanEndTimeShift: "1h" | ||
filterByTraceID: true | ||
filterBySpanID: false | ||
- name: Loki | ||
type: loki | ||
access: proxy | ||
url: http://gateway:3100 | ||
jsonData: | ||
httpHeaderName1: "X-Scope-OrgID" | ||
secureJsonData: | ||
httpHeaderValue1: "tenant1" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,152 @@ | ||
--- | ||
networks: | ||
grafana: | ||
|
||
services: | ||
grafana: | ||
image: grafana/grafana:latest | ||
container_name: grafana | ||
environment: | ||
- GF_PATHS_PROVISIONING=/etc/grafana/provisioning | ||
- GF_AUTH_ANONYMOUS_ENABLED=true | ||
- GF_AUTH_ANONYMOUS_ORG_ROLE=Admin | ||
- GF_AUTH_DISABLE_LOGIN_FORM=true | ||
- GF_FEATURE_TOGGLES_ENABLE=traceqlEditor,azureMonitorPrometheusExemplars | ||
- TENANT_ID=${TENANT_ID} | ||
- CLIENT_ID=${CLIENT_ID} | ||
- CLIENT_SECRET=${CLIENT_SECRET} | ||
depends_on: | ||
- gateway | ||
ports: | ||
- "3002:3000" | ||
healthcheck: | ||
test: | ||
[ | ||
"CMD-SHELL", | ||
"wget --no-verbose --tries=1 --spider http://localhost:3000/api/health || exit 1", | ||
] | ||
interval: 10s | ||
timeout: 5s | ||
retries: 5 | ||
volumes: | ||
- ./datasources.yaml:/etc/grafana/provisioning/datasources/datasources.yaml | ||
networks: | ||
grafana: | ||
|
||
gateway: | ||
image: nginx:latest | ||
container_name: grafana-gateway | ||
depends_on: | ||
- loki-read | ||
- loki-write | ||
entrypoint: | ||
- sh | ||
- -euc | ||
- | | ||
cat <<EOF > /etc/nginx/nginx.conf | ||
user nginx; | ||
worker_processes 5; ## Default: 1 | ||
events { | ||
worker_connections 1000; | ||
} | ||
http { | ||
resolver 127.0.0.11; | ||
server { | ||
listen 3100; | ||
location = / { | ||
return 200 'OK'; | ||
auth_basic off; | ||
} | ||
location = /api/prom/push { | ||
proxy_pass http://loki-write:3100\$$request_uri; | ||
} | ||
location = /api/prom/tail { | ||
proxy_pass http://loki-read:3100\$$request_uri; | ||
proxy_set_header Upgrade \$$http_upgrade; | ||
proxy_set_header Connection "upgrade"; | ||
} | ||
location ~ /api/prom/.* { | ||
proxy_pass http://loki-read:3100\$$request_uri; | ||
} | ||
location = /loki/api/v1/push { | ||
proxy_pass http://loki-write:3100\$$request_uri; | ||
} | ||
location = /loki/api/v1/tail { | ||
proxy_pass http://loki-read:3100\$$request_uri; | ||
proxy_set_header Upgrade \$$http_upgrade; | ||
proxy_set_header Connection "upgrade"; | ||
} | ||
location ~ /loki/api/.* { | ||
proxy_pass http://loki-read:3100\$$request_uri; | ||
} | ||
} | ||
} | ||
EOF | ||
/docker-entrypoint.sh nginx -g "daemon off;" | ||
ports: | ||
- "3100:3100" | ||
healthcheck: | ||
test: ["CMD", "service", "nginx", "status"] | ||
interval: 10s | ||
timeout: 5s | ||
retries: 5 | ||
networks: | ||
grafana: | ||
loki: | ||
|
||
agent: | ||
image: grafana/agent:v0.27.1 | ||
container_name: grafana-agent | ||
volumes: | ||
- ./grafana-agent.yaml:/etc/agent.yaml | ||
- /var/run/docker.sock:/var/run/docker.sock:ro | ||
entrypoint: | ||
- /bin/agent | ||
- -config.file=/etc/agent.yaml | ||
networks: | ||
grafana: | ||
tempo: | ||
|
||
prometheus: | ||
image: prom/prometheus:latest | ||
container_name: prometheus | ||
command: | ||
- --config.file=/etc/prometheus.yaml | ||
- --web.enable-remote-write-receiver | ||
- --enable-feature=exemplar-storage | ||
volumes: | ||
- ./prometheus.yaml:/etc/prometheus.yaml | ||
ports: | ||
- "9090:9090" | ||
networks: | ||
grafana: | ||
|
||
otel-collector: | ||
image: otel/opentelemetry-collector-contrib | ||
command: [--config=/etc/otel-collector-config.yaml] | ||
container_name: otel-collector | ||
volumes: | ||
- ./otel-config.yaml:/etc/otel-collector-config.yaml | ||
environment: | ||
- APPLICATIONINSIGHTS_CONNECTION_STRING=${APPLICATIONINSIGHTS_CONNECTION_STRING} | ||
ports: | ||
- 1888 # pprof extension | ||
- 8888 # Prometheus metrics exposed by the collector | ||
- 8889 # Prometheus exporter metrics | ||
- 13133 # health_check extension | ||
- 4317 # OTLP gRPC receiver | ||
- 4318 # OTLP http receiver | ||
- 55679 # zpages extension | ||
networks: | ||
tempo: | ||
grafana: |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
server: | ||
log_level: debug | ||
|
||
traces: | ||
configs: | ||
- name: default | ||
receivers: | ||
otlp: | ||
protocols: | ||
grpc: | ||
remote_write: | ||
- endpoint: tempo:4317 | ||
insecure: true | ||
batch: | ||
timeout: 5s | ||
send_batch_size: 100 | ||
automatic_logging: | ||
backend: logs_instance | ||
logs_instance_name: default | ||
roots: true | ||
|
||
logs: | ||
configs: | ||
- name: default | ||
positions: | ||
filename: /tmp/positions.yaml | ||
clients: | ||
- url: http://grafana-gateway:3100/loki/api/v1/push | ||
tenant_id: tenant1 | ||
scrape_configs: | ||
- job_name: docker_scrape | ||
docker_sd_configs: | ||
- host: unix:///var/run/docker.sock | ||
refresh_interval: 5s | ||
relabel_configs: | ||
- source_labels: ["__meta_docker_container_name"] | ||
regex: "/(.*)" | ||
target_label: "container" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
receivers: | ||
otlp: | ||
protocols: | ||
grpc: | ||
endpoint: 0.0.0.0:4317 | ||
http: | ||
exporters: | ||
logging: | ||
otlp: | ||
endpoint: "http://agent:4317" | ||
tls: | ||
insecure: true | ||
azuremonitor: | ||
|
||
service: | ||
pipelines: | ||
traces: | ||
receivers: [otlp] | ||
exporters: [otlp, azuremonitor] | ||
telemetry: | ||
logs: | ||
level: "debug" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
global: | ||
scrape_interval: 15s | ||
evaluation_interval: 15s | ||
|
||
scrape_configs: | ||
- job_name: "prometheus" | ||
static_configs: | ||
- targets: ["localhost:9090"] | ||
- job_name: "exemplars" | ||
static_configs: | ||
- targets: ["exemplars:8081"] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
docker compose \ | ||
-f docker-compose.main.yml \ | ||
-f ./docker-compose.tempo.yml \ | ||
-f ./docker-compose.loki.yml \ | ||
-f ./docker-compose.exemplars.yml up -d |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
docker-compose \ | ||
-f docker-compose.main.yml \ | ||
-f ./docker-compose.tempo.yml \ | ||
-f ./docker-compose.loki.yml \ | ||
-f ./docker-compose.exemplars.yml down |