feat: update Traefik metrics configuration for Prometheus scraping to use dedicated entrypoint on port 8082

This commit is contained in:
2026-07-12 10:23:57 +08:00
parent ee5858d538
commit 239adbbef9
2 changed files with 8 additions and 8 deletions
+4 -5
View File
@@ -46,10 +46,6 @@ services:
- target: 8033
published: 8033
mode: host
# Metrics endpoints for Prometheus scraping
- target: 8080
published: 8080
mode: host
deploy:
placement:
constraints:
@@ -151,6 +147,8 @@ services:
- --entrypoints.web-socket-secure.address=:8084
- --entrypoints.bolt-socket.address=:7687
- --entrypoints.xiaozhi-ws.address=:8033
# Create an entrypoint "metrics" for Prometheus scraping (port 8082)
- --entrypoints.metrics.address=:8082
# Create the certificate resolver "le" for Let's Encrypt, uses the environment variable EMAIL
- --certificatesresolvers.le.acme.email=${EMAIL?Variable not set}
# Store the Let's Encrypt certificates in the mounted volume
@@ -167,8 +165,9 @@ services:
# Enable the Dashboard and API
- --api=true
# Enable Prometheus metrics for scraping by Prometheus
# Metrics are served on the default API port (8080)
# Metrics are served on the dedicated "metrics" entrypoint (port 8082)
- --metrics.prometheus=true
- --metrics.prometheus.entryPoint=metrics
- --metrics.prometheus.buckets=0.1,0.3,1.2,5.0
- --metrics.prometheus.addEntryPointsLabels=true
- --metrics.prometheus.addServicesLabels=true
+4 -3
View File
@@ -11,9 +11,10 @@ scrape_configs:
- targets: ['localhost:9090']
# Scrape Traefik Prometheus metrics
# Both services are on the traefik-public overlay network,
# so 'traefik' resolves via Swarm DNS.
# Both services are on the traefik-public overlay network.
# Traefik is in the 'core' stack, so the Swarm DNS name is core_traefik.
# Metrics are served on the dedicated "metrics" entrypoint (port 8082).
- job_name: 'traefik'
static_configs:
- targets: ['core_traefik:8080']
- targets: ['core_traefik:8082']
metrics_path: /metrics