Skip to content

Commit f24f931

Browse files
committed
proton-bridge: support /metrics and quiet scrape pipe noise
1 parent 9d69aa8 commit f24f931

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

images/proton-bridge/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,14 @@ The container `HEALTHCHECK` script validates:
8585
- `gpg-agent` control socket responsiveness (`gpg-connect-agent /bye`)
8686
- listening state for SMTP/IMAP container ports
8787
- lightweight SMTP and IMAP banner-level handshake probes on local forwarded ports
88-
- metrics endpoint HTTP readiness (`/cgi-bin/metrics`)
88+
- metrics endpoint HTTP readiness (`/metrics`)
8989

9090
## Metrics
9191

9292
The image now exposes Prometheus-formatted metrics from inside the container.
9393

9494
- listen port: `${CONTAINER_METRICS_PORT}` (default `9154`)
95-
- scrape path: `/cgi-bin/metrics`
95+
- scrape path: `/metrics` (`/cgi-bin/metrics` also supported)
9696

9797
Current metrics include:
9898

images/proton-bridge/healthcheck.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ netstat -ltn 2>/dev/null | grep -q "[.:]${CONTAINER_METRICS_PORT}[[:space:]]"
1313

1414
printf 'QUIT\r\n' | nc -w 3 127.0.0.1 "${CONTAINER_SMTP_PORT}" | grep -Eq '^220 '
1515
printf 'a1 LOGOUT\r\n' | nc -w 3 127.0.0.1 "${CONTAINER_IMAP_PORT}" | grep -Eq '^\* (OK|PREAUTH|BYE) '
16-
printf 'GET /cgi-bin/metrics HTTP/1.0\r\nHost: localhost\r\n\r\n' \
17-
| nc -w 3 127.0.0.1 "${CONTAINER_METRICS_PORT}" \
18-
| grep -Eq '^HTTP/[0-9.]+ 200 '
16+
metrics_resp="$(printf 'GET /metrics HTTP/1.0\r\nHost: localhost\r\n\r\n' \
17+
| nc -w 3 127.0.0.1 "${CONTAINER_METRICS_PORT}")"
18+
printf '%s\n' "${metrics_resp}" | grep -Eq '^HTTP/[0-9.]+ 200 '

images/proton-bridge/metrics/serve-http.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ while IFS= read -r header; do
1414
esac
1515
done
1616

17-
if [ "${method}" = "GET" ] && [ "${path}" = "/cgi-bin/metrics" ]; then
17+
if [ "${method}" = "GET" ] && { [ "${path}" = "/metrics" ] || [ "${path}" = "/cgi-bin/metrics" ]; }; then
1818
printf 'HTTP/1.1 200 OK\r\n'
1919
printf 'Content-Type: text/plain; version=0.0.4\r\n'
2020
printf 'Connection: close\r\n'

0 commit comments

Comments
 (0)