diff --git a/.env.example b/.env.example index 910d31ca3..e164f4b33 100644 --- a/.env.example +++ b/.env.example @@ -1198,28 +1198,28 @@ PAGINATION_INCLUDE_LINKS=true # Enable observability tracing and metrics collection # When enabled, all HTTP requests will be traced with detailed timing, status codes, and context -# OBSERVABILITY_ENABLED=false +OBSERVABILITY_ENABLED=false # Automatically trace HTTP requests -# OBSERVABILITY_TRACE_HTTP_REQUESTS=true +OBSERVABILITY_TRACE_HTTP_REQUESTS=true # Number of days to retain trace data -# OBSERVABILITY_TRACE_RETENTION_DAYS=7 +OBSERVABILITY_TRACE_RETENTION_DAYS=7 # Maximum number of traces to retain (prevents unbounded growth) -# OBSERVABILITY_MAX_TRACES=100000 +OBSERVABILITY_MAX_TRACES=100000 # Trace sampling rate (0.0-1.0) - 1.0 means trace everything, 0.1 means trace 10% -# OBSERVABILITY_SAMPLE_RATE=1.0 +OBSERVABILITY_SAMPLE_RATE=1.0 # Paths to exclude from tracing (comma-separated regex patterns) -# OBSERVABILITY_EXCLUDE_PATHS=/health,/healthz,/ready,/metrics,/static/.* +OBSERVABILITY_EXCLUDE_PATHS='["/health", "/healthz", "/ready", "/metrics", "/static/.*"]' # Enable metrics collection -# OBSERVABILITY_METRICS_ENABLED=true +OBSERVABILITY_METRICS_ENABLED=true # Enable event logging within spans -# OBSERVABILITY_EVENTS_ENABLED=true +OBSERVABILITY_EVENTS_ENABLED=true ##################################### # Ed25519 Key Support diff --git a/mcpgateway/config.py b/mcpgateway/config.py index 9d3017876..24c8bb46a 100644 --- a/mcpgateway/config.py +++ b/mcpgateway/config.py @@ -768,7 +768,7 @@ def _parse_allowed_origins(cls, v: Any) -> Set[str]: observability_sample_rate: float = Field(default=1.0, ge=0.0, le=1.0, description="Trace sampling rate (0.0-1.0)") # Exclude paths from tracing (regex patterns) - observability_exclude_paths: List[str] = Field(default_factory=lambda: ["/health", "/healthz", "/ready", "/metrics", "/static/.*"], description="Paths to exclude from tracing (regex)") + observability_exclude_paths: List[str] = Field(default_factory=lambda: ["/health", "/healthz", "/ready", "/metrics", "/static/.*"], description="Paths to exclude from tracing") # Enable performance metrics observability_metrics_enabled: bool = Field(default=True, description="Enable metrics collection") @@ -1102,6 +1102,7 @@ def _auto_enable_security_txt(cls, v: Any, info: ValidationInfo) -> bool: "sso_auto_admin_domains", "sso_github_admin_orgs", "sso_google_admin_domains", + "observability_exclude_paths", mode="before", ) @classmethod