You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 1bdfb42
Browse filesBrowse the repository at this point in the historyBrowse files
- METRICS_TOKEN is now required whenever METRICS_ENABLED=true, on Cloud
and self-hosted alike, matching SENTRY_VERIFY_TOKEN's pattern.
- Add a listen() error handler so a taken port logs and leaves metrics
off instead of crashing the backend.
- tool_call_upstream_errors_total now only increments on a 4xx/5xx
upstream status; a success (or no status) is never counted.
- Add METRICS_* to docker-compose.yml and docker-compose.cloud.yml so
Docker users can turn the feature on.
- Fix the sample scrape target to app:9464, the real compose service name.
- Reset package-lock.json to main and reinstall prom-client so the diff
only adds prom-client, tdigest and bintrees.
|`METRICS_ENABLED`| No | Start a second, separate `/metrics` listener for Prometheus (default: `false`) — see [observability.md](operations/observability.md)|
363
363
|`METRICS_PORT`| No | Port for the metrics listener (default: `9464`) |
364
364
|`METRICS_HOST`| No | Bind host for the metrics listener (default: `0.0.0.0`) |
365
-
|`METRICS_TOKEN`|No on self-hosted, **required on Cloud**| Bearer token required to scrape `/metrics`, compared with `timingSafeEqual`|
365
+
|`METRICS_TOKEN`|**Required when `METRICS_ENABLED=true`**| Bearer token required to scrape `/metrics`, compared with `timingSafeEqual`|
366
366
|`METRICS_TOOL_LABELS`| No | Add `connector_id`/`tool` labels to tool-call metrics (default: `false`; ignored on Cloud) |
Copy file name to clipboardExpand all lines: docs/operations/observability.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -185,14 +185,14 @@ Off unless `METRICS_ENABLED=true`. When on, the backend starts a **second, separ
185
185
|`METRICS_ENABLED`|`false`| Starts the listener. |
186
186
|`METRICS_PORT`|`9464`| Metrics listener port. |
187
187
|`METRICS_HOST`|`0.0.0.0`| Metrics listener bind host — a Prometheus container needs to reach it over the compose network, so the port is deliberately **not** published in `docker-compose.yml`. |
188
-
|`METRICS_TOKEN`| unset | Required `Authorization: Bearer` token, compared with `timingSafeEqual`. **Required on Cloud** — without it the listener refuses to start and logs an error. Optional on self-hosted. |
188
+
|`METRICS_TOKEN`| unset |**Required**`Authorization: Bearer` token, compared with `timingSafeEqual`, whenever `METRICS_ENABLED=true` — on Cloud and self-hosted alike. Without it the listener refuses to start and logs an error; the default bind host `0.0.0.0` would otherwise serve `/metrics` to anyone who can reach the host. |
189
189
|`METRICS_TOOL_LABELS`|`false`| Adds `connector_id` (cuid, not name) and `tool` labels to the tool-call metrics. Self-hosted only — **always ignored on Cloud**, even if set, so no series can carry a connector or tool identity across tenant workspaces. |
190
190
191
191
### Metrics (prefix `anythingmcp_`)
192
192
193
193
-`tool_calls_total{connector_type,status}` — counter, `status` is `success` or `error`.
194
194
-`tool_call_duration_seconds{connector_type,status}` — histogram, buckets from 0.05 s to 60 s (tool calls can run 20 s or more).
195
-
-`tool_call_upstream_errors_total{connector_type,upstream_status_class}` — `upstream_status_class` is `4xx`, `5xx`or `none`.
195
+
-`tool_call_upstream_errors_total{connector_type,upstream_status_class}` — only incremented for an actual upstream error; `upstream_status_class` is `4xx`or `5xx`.
196
196
-`tool_calls_in_flight`, `mcp_requests_in_flight`, `registered_tools` — gauges mirrored from the in-process `processGauges` singleton at scrape time (not polled on an interval).
197
197
- The standard `prom-client` Node runtime metrics (`collectDefaultMetrics()`: event loop lag, heap, GC, etc.).
198
198
@@ -204,12 +204,12 @@ scrape_configs:
204
204
scheme: http
205
205
bearer_token: '<METRICS_TOKEN>'
206
206
static_configs:
207
-
- targets: ['anythingmcp-backend:9464']
207
+
- targets: ['app:9464']
208
208
```
209
209
210
210
### Cloud vs self-hosted
211
211
212
-
On Cloud, metrics are instance-wide only: no series may carry an organization id, connector name, tool name or user, which is why `METRICS_TOOL_LABELS` has no effect there and `METRICS_TOKEN` is mandatory. Per-organization usage already exists in the database (`AuditService.getBreakdowns`) and is unaffected by this endpoint. On self-hosted, the operator who sets `METRICS_TOOL_LABELS=true` is the only consumer of their own instance's metrics, so per-connector/per-tool labels are allowed.
212
+
On Cloud, metrics are instance-wide only: no series may carry an organization id, connector name, tool name or user, which is why `METRICS_TOOL_LABELS` has no effect there. Per-organization usage already exists in the database (`AuditService.getBreakdowns`) and is unaffected by this endpoint. On self-hosted, the operator who sets `METRICS_TOOL_LABELS=true` is the only consumer of their own instance's metrics, so per-connector/per-tool labels are allowed. `METRICS_TOKEN` is required on both: the listener's default bind host is `0.0.0.0`.
213
213
214
214
## Fatal crash reports (always on in the Docker image)
0 commit comments