Skip to content

Commit 327df76

Browse files
committed
docs: add Prometheus metrics env vars to .env.example
Add comprehensive documentation for Prometheus metrics configuration variables to .env.example: - ENABLE_METRICS: Toggle metrics collection (default: true) - METRICS_EXCLUDED_HANDLERS: Regex patterns for endpoint exclusion - METRICS_NAMESPACE: Metrics name prefix (default: "default") - METRICS_SUBSYSTEM: Secondary metrics prefix - METRICS_CUSTOM_LABELS: Static labels for app_info gauge Includes examples, security warnings about high-cardinality labels, and formatting consistent with existing configuration sections. Related to PR #1313 Signed-off-by: Mihai Criveti <[email protected]>
1 parent a1ce94c commit 327df76

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

.env.example

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -765,6 +765,45 @@ OTEL_BSP_MAX_QUEUE_SIZE=2048
765765
OTEL_BSP_MAX_EXPORT_BATCH_SIZE=512
766766
OTEL_BSP_SCHEDULE_DELAY=5000
767767

768+
# Prometheus Metrics Configuration
769+
# Enable Prometheus-compatible metrics exposition for monitoring and alerting
770+
# Options: true (default), false
771+
# When true: Exposes metrics at /metrics/prometheus in Prometheus format
772+
# When false: Returns HTTP 503 on metrics endpoint
773+
ENABLE_METRICS=true
774+
775+
# Comma-separated regex patterns for endpoints to exclude from metrics collection
776+
# Use this to avoid high-cardinality issues with dynamic paths or reduce overhead
777+
# Examples:
778+
# - Exclude SSE endpoints: /servers/.*/sse
779+
# - Exclude static files: /static/.*
780+
# - Exclude health checks: .*health.*
781+
# - Multiple patterns: /servers/.*/sse,/static/.*,.*health.*
782+
# Default: "" (no exclusions)
783+
METRICS_EXCLUDED_HANDLERS=
784+
785+
# Prometheus metrics namespace (prefix for all metric names)
786+
# Used to group metrics by application or organization
787+
# Example: mycompany_gateway_http_requests_total
788+
# Default: "default"
789+
METRICS_NAMESPACE=default
790+
791+
# Prometheus metrics subsystem (secondary prefix for metric names)
792+
# Used for further categorization within namespace
793+
# Example: mycompany_api_http_requests_total (if subsystem=api)
794+
# Default: "" (no subsystem)
795+
METRICS_SUBSYSTEM=
796+
797+
# Custom static labels for app_info gauge metric
798+
# Format: comma-separated "key=value" pairs (low-cardinality values only)
799+
# WARNING: Never use high-cardinality values (user IDs, request IDs, timestamps)
800+
# Examples:
801+
# - Single label: environment=production
802+
# - Multiple labels: environment=production,region=us-east-1,team=platform
803+
# - K8s example: cluster=prod-us-east,namespace=mcp-gateway
804+
# Default: "" (no custom labels)
805+
METRICS_CUSTOM_LABELS=
806+
768807
# Plugin Framework Configuration
769808
# Enable the plugin system for extending gateway functionality
770809
# Options: true, false (default)

0 commit comments

Comments
 (0)