Wire contract
The wire format every WizeLens add-on, the hub, and the cloud follow: headers, endpoints, types, storage, and rules.
On this page 34 sections
- Base path
- Versioning
- HTTP headers
- Endpoints
- Types
- Attribute names (OTel semantic conventions)
- Trace context in messages
- Host modes and capabilities
- Add-on options
- Metrics
- Hosts and Kubernetes
- Redaction
- Packages
- Analysis (shared logic, same results in .NET and JS)
- Security analysis
- Timing
- Sampling
- Logs outside a request
- Not traced
- Clocks
- MCP tools (read-only)
- Issue states
- NoSQL calls
- Project settings
- Team (cloud)
- Users
- Saved views and dashboards
- SLOs and Apdex
- Search
- Source maps
- Tags
- Storage
- Local hub
- Cloud
Every add-on (.NET, Node, browser) MUST follow this. The UI depends only on this contract.
Base path
/_wizelens (configurable). All paths below are relative to it.
Versioning
This is protocol 1. api/info answers protocol: 1; no protocol means 1.
- A receiver ignores fields, capabilities, and enum values it does not know. A sender may add new optional fields in protocol 1, so an old receiver keeps working.
- A change that breaks protocol 1 (a field removed, renamed, or given a new meaning) is protocol 2, served at
api/v2/…. Protocol 1 stays atapi/…as long as SDKs that speak it are supported. - An error answer is
{ error: string, code?: string }:erroris a sentence for a person,codea fixed name a program can test (PLAN_REQUIRED). The cloud'sapi/auth/*is Better Auth and answers its own{ message, code }(SSO_REQUIRED).
HTTP headers
| Header | Direction | Meaning |
|---|---|---|
traceparent |
request | W3C trace context. |
X-WizeLens-Trace |
response | Trace id (32 hex) of the request that produced this response. |
X-WizeLens-Endpoint |
response | Absolute URL of this service's wizelens base, e.http:/. |
X-WizeLens-Hop |
request (federation) | Integer hop count. |
Server-Timing |
response | Appended: wl-trace;desc=. |
Every app response that the add-on sees also gets
Access-Control-Expose-Headers: X-WizeLens-Trace, X-WizeLens-Endpoint (append, do not replace). The names must
survive a CORS layer that sets the same header later (for example @fastify/cors or Express cors), so the Node add-on
merges them in again when the response headers are written.
When an outgoing HTTP call gets a response with X-WizeLens-Endpoint, the add-on adds that URL to
the current trace's remotes list (de-duplicated, and never its own endpoint).
Federation and hub sends run with tracing suppressed (OTel suppressTracing), so no layer above the HTTP client (for
example the Next.js fetch wrapper) records them as app traffic.
Browser spans and the server that owns their trace
A browser span sets wizelens.browser.remote to the WizeLens endpoint of the server that holds its trace, when that is not the
endpoint the page is set up with: from wl-endpoint (page load) or X-WizeLens-Endpoint (fetch). The page then sends the
span (and the logs of that trace) to {remote}/api/client-spans when the remote is on the page's own origin, and to its own
endpoint otherwise. A server that gets a browser span whose wizelens.browser.remote is on the request's Origin (same
origin, http or https) adds it to the trace's remotes, unless it is one of its own endpoints; a remote on any other origin
is ignored, so a page cannot point federation at a URL of its choice, unless the developer trusts that origin
(TrustedRemotes in .NET, trustedRemotes in Node, or the comma-separated WIZELENS_TRUSTED_REMOTES; each entry counts by
its origin), for an API on its own port. A trace page whose trace has no server span but a browser span with an http(s)
wizelens.browser.remote says that the server part is there, links to it, and names the option (in-app dashboards only).
gRPC uses the same key as metadata: a gRPC server sends x-wizelens-endpoint in its response headers (merged into any
headers the handler sends) and in its trailers, and a gRPC client reads either one into remotes.
Endpoints
All api/* endpoints return JSON (camelCase) and send Access-Control-Allow-Origin: *.
| Method + path | Returns |
|---|---|
GET / and static files |
Dashboard UI (from @wizeworks/ build).#/, #/, #/, #/, #/, #/, #/, #/, #/, #/, #/, #/ (hub and in-app; tags is one section), and on the cloud #/, #/, and #/.#/ and #/ links open their new place (docs/{view} is one of timeline, sql, http, messages, logs, errors, insights, security. |
GET api/ |
ServiceInfo (see Types) |
GET api/ |
TraceSummary[], newest first.session, only traces that have a span whose wizelens. equals {id}.full= includes them. |
GET api/ |
Trace[] from this service only (no federation), newest first.limit max 5000.since, only traces whose last activity (startMs + durationMs) is at or after {ms}. |
GET api/ |
Trace (404 if unknown and no remote has it) |
POST api/ |
Body { spans: Span[], logs?: (LogRecord & { traceId })[], sentMs?: number }. |
GET api/ |
TagList (see "Tags"): the built-ins and the rules of the tags option, editable: false |
POST api/ |
Body { kind, items: { traceId, owner, timeMs }[] } (up to 200).{ matches }: tag names per row (see "Tags") |
POST mcp (+ GET for SSE if SDK needs) |
MCP streamable HTTP. |
GET wizelens., GET wizelens. |
.@wizeworks/ script-tag bundle (application/) and its source map, Cache-Control: no-cache. |
The HUD on served pages
While an add-on serves the dashboard and its HUD switch is on (.NET Hud, Node hud, both default true, or
WIZELENS_HUD), an answer gets
<script src="{base}/wizelens.js" data-endpoint="{base}" data-hud="true" data-source="inject" defer></script> right
before its last </body> when the request is a GET outside {base}, the answer is 200 with Content-Type: text/html
and no Content-Encoding, and the body has a </body>. Anything else passes through untouched. The body streams; a
Content-Length is dropped or set to the new length. A page navigation (Accept takes text/html) reaches the app
without Accept-Encoding, so a compressing layer answers it in plain HTML (.NET puts the header back once the answer
reaches the HUD, so compression placed before the add-on still compresses the tagged page).
In the browser, hud is boolean | "auto" (script tag: data-hud, default auto; data-slow-ms). "auto" asks
GET {endpoint}/api/info once and shows the HUD when it answers 200 with a JSON object; readServer follows hud unless
set. One instance per page: each started instance registers at globalThis[Symbol.for("wizelens.browser")] as
{ source: "app" | "inject", stop() }. An injected tag starts after the page's load event and does nothing when an
instance is registered; an app instance stops an injected one and takes over. See docs/HUD-PLAN.md.
Federation (federate=true)
- Load the local trace (may be missing).
- For each URL in
remotes,GET {remote}/api/traces/{traceId}?federate=truewithX-WizeLens-Hop: n+1. Timeout 2 s. Ignore failures. - Merge: union spans by
spanId, union logs, union remotes. Recompute summary fields.serviceandrootNamecome from the span with no parent (or the earliest span).
Types
Times are Unix epoch milliseconds as floating point numbers (sub-ms precision allowed).
type SpanKind = "server" | "client" | "internal" | "producer" | "consumer";
type SpanStatus = "unset" | "ok" | "error";
type SpanCategory = "http.server" | "http.client" | "db" | "messaging" | "browser" | "internal" | "uptime";
interface Span {
traceId: string; // 32 lowercase hex
spanId: string; // 16 lowercase hex
parentSpanId: string | null;
name: string; // "GET /api/orders", "SELECT customers", "fetch /api/orders"
kind: SpanKind;
category: SpanCategory;
service: string; // "gateway-api", "orders-api", "browser"
startMs: number;
durationMs: number;
status: SpanStatus;
statusMessage: string | null;
attributes: Record<string, string | number | boolean | null>;
events: SpanEvent[];
}
interface SpanEvent {
name: string; // "exception" uses OTel exception.* attributes
timeMs: number;
attributes: Record<string, string | number | boolean | null>;
}
interface LogRecord {
timeMs: number;
level: "trace" | "debug" | "info" | "warn" | "error" | "critical";
category: string;
message: string;
service: string;
spanId: string | null;
attributes: Record<string, string | number | boolean | null>;
}
interface TraceSummary {
traceId: string;
rootName: string;
service: string;
startMs: number;
durationMs: number; // max(end) - min(start) over spans
status: SpanStatus; // "error" if any span is error, leaving out 4xx and expected answers
spanCount: number;
dbCount: number;
httpClientCount: number;
errorCount: number;
services: string[]; // distinct, sorted
rootMethod: string | null; // http.request.method of the root span
rootUrl: string | null; // url.path, else url.full, of the root span
rootStatusCode: number | null; // http.response.status_code of the root span
}
**Failures.** A span is an error when its status is `error` or it has an `exception` event, unless its
`http.response.status_code` is 400–499: a 4xx answer is never a failure, on server and client spans alike. `errorCount`,
the trace `status`, request `errors` (failed: `errors > 0` or status 500 and above), error groups, service and endpoint
error counts, the search `error` field, and `keepErrors` sampling all use this rule, in Node and .NET; the Go, Java, and Python
samplers use it too.
**Expected answers.** A span is *expected* when `wizelens.expected` is `true` (or `"1"`/`"true"`), or when its
`http.response.header.x-wizelens-expected` is set to anything but empty, `0`, `false`, or `no`. An expected span's `error`
status and its 5xx status code are not a failure; an `exception` event on it still is. A request row carries `expected`
from its entry server span (else its browser fetch span) and is failed when `errors > 0`, or when its status is 500 or more
and it is not expected; `health` is then not `critical` for the status alone. Stored request facts keep only `failed`, so a
row read back from a store reports `expected` only for a 5xx (`status >= 500 && !failed`). The Node add-on and the .NET
add-on set `wizelens.expected` and leave the span status unset when the app calls `expected()` / `Expected()` or answers
with the `X-WizeLens-Expected` header; the Node add-on lists that header in `Access-Control-Expose-Headers`, and the
browser package does not fail a fetch whose answer carries it.
interface Trace extends TraceSummary {
spans: Span[]; // sorted by startMs
logs: LogRecord[]; // sorted by timeMs
remotes: string[];
}
type HostMode = "in-app" | "hub" | "cloud";
type Capability =
| "federation" | "environments" | "registry" | "accounts" | "alerts" | "sharing"
| "serverStats" | "metrics" | "serverMetrics" | "changes" | "search" | "issues"
| "infra" | "uptime" | "statusPages" | "packages" | "sourcemaps" | "slos" | "saved" | "tags" | "settings";
interface ServiceInfo {
protocol?: number; // absent = 1
mode?: HostMode; // absent = "in-app"
capabilities?: Capability[]; // absent = ["federation"]
service: string;
version: string;
runtime: string;
mcp: boolean;
environment?: string; // ASPNETCORE_ENVIRONMENT / NODE_ENV, e.g. "Development"
host?: string; // machine name
startedMs?: number;
storage?: { kind: "sqlite" | "memory" | "postgres"; maxTraces?: number; maxAgeMs: number }; // no maxTraces = no count limit
analysis?: { slowQueryMs: number; nPlusOneThreshold: number };
redactKeys?: string[];
captureResponseBody?: boolean;
project?: string;
sendTo?: string; // the hub or cloud this add-on also sends to
send?: SendState; // how sending to `sendTo` goes; absent on add-ons that do not report it
sampling?: SamplingInfo; // absent = every trace is kept
}
interface SendState {
state: "waiting" | "ok" | "failing"; // waiting = no batch sent yet
reason?: string | null; // failing: why, and what to change ("The hub at … needs a key (401). Set WIZELENS_TOKEN …")
lastSentMs?: number | null; // when a batch last went through
}
interface SamplingInfo {
rate: number; // 0..1
keepErrors: boolean;
keepSlowMs: number | null; // server-side spans only
}
Attribute names (OTel semantic conventions)
| Category | Attributes |
|---|---|
| http. |
http., http., url., url., http., server., client. (first X-Forwarded-For value, else the socket), user_, http. /http. (lower-case names, values joined with , , max 50 headers, 1 KB each, redacted), http., http., wizelens., enduser. (when known), wizelens. (app tags), wizelens. (the app expected the answer: see Expected answers), wizelens. (when the runtime can tell), wizelens. + wizelens. (only with body capture on: text and JSON, first 16 KB), wizelens. + wizelens. (the Java, Python, and Go SDKs, with WIZELENS_; complete JSON has sensitive keys redacted), wizelens. + wizelens. (a stream answer: see Streams) |
| any span | service.: the version of the app that ran it, so Problems can name a new release.release, else WIZELENS_, else OTEL_, else npm_.Release, else WIZELENS_, else OTEL_, else the entry assembly's informational version.service., copied onto that service's spans that have none |
| internal | wizelens. =handler for a controller action or endpoint handler span |
| gRPC (on http. |
rpc. =grpc, rpc. (e.orders.), rpc. (e.GetOrder), rpc. (number).{service}/. |
| messaging | Kind producer (send) or consumer (receive /messaging. (rabbitmq, kafka, servicebus), messaging. (send, receive, process), messaging. (queue, topic, or exchange), messaging., messaging., messaging..{operation} {destination}. |
| http. |
http., url., server., server., http. |
| db | A span is db when it has any of db., db., db., db., db. (some libraries, such as Better Auth, send only the operation and the table).db. (e.sqlite, postgresql, microsoft.), db., db., db., db., db., wizelens. (JSON string, redacted), wizelens. (ado., efcore, pg, mysql2, better-sqlite3, node-sqlite, prisma, typeorm, drizzle, . |
| exception event | exception., exception., exception.; browser errors also wizelens. (see "Source maps") |
| browser (all) | wizelens. (fetch when absent, pageview, react, error), wizelens. (per-tab id, kept in sessionStorage key wizelens.), wizelens. (path shape of the page), url., service. (the app release, when the app or its build plugin sets it), user_ (on pageview and error spans) |
| browser fetch | http., http., wizelens., wizelens. (ms from the response to the next paint; absent when not measured), wizelens. (aborted, cut off as the page was hidden or closed, or offline: no error, no exception), wizelens. (a Next._, RSC: 1, or Next-Router-Prefetch: 1; never an error). |
| browser pageview | Own trace per page view.wizelens. (load /spa), wizelens., . (responseStart − requestStart), . (FCP − responseEnd), ., ., ., ., ., . (first React commit), ., . (slowest image), ., . (images bigger than shown and not lazy) |
| browser react | In the page view's trace.wizelens., wizelens. ={ name, renders, actualMs, selfMs, wasted, context }[] since the last report |
| browser error | In the page view's trace.error, one exception event (exception., ., .) |
Trace context in messages
A producer writes traceparent into the message headers (RabbitMQ headers, Kafka headers, Service Bus
application properties). A consumer reads it: the process span joins the producer's trace as a child of the
send span, so one trace follows a message across services. Without the header, the consumer starts a new trace.
| Library | . |
Node |
|---|---|---|
| Npgsql, MySqlConnector, Microsoft. |
automatic (their activity sources and diagnostics) | — |
| gRPC | automatic (Grpc. |
instrumentGrpc(wizelens, grpc) for @grpc/ |
| RabbitMQ | automatic (RabbitMQ. |
instrumentAmqplib(wizelens, amqplib) |
| Kafka | WizeLens. package (Confluent. |
instrumentKafkaJs(wizelens, kafka) |
| Azure Service Bus | automatic (Azure. |
instrumentServiceBus(wizelens, client) |
| MassTransit | automatic | — |
| Fastify / |
— | wizeLensFastify(wizelens), wizeLensKoa(wizelens), wizeLensHono(wizelens) |
Host modes and capabilities
The same dashboard and HUD run in every mode. They read mode and capabilities from api/info and show or hide
features by capability, never by the mode name. The badge in the top bar shows the mode, the service, and how long data is kept.
Time ranges longer than storage.maxAgeMs are hidden.
| Capability | Means | In-app | Hub | Cloud |
|---|---|---|---|---|
federation |
The dashboard finds other services through trace remotes and reads them directly |
✅ | ✅ (services that do not send to the hub) | |
environments |
The host holds more than one environment and project; the top-bar picker filters by them | ✅ | ✅ | |
registry |
The host knows its services (api/): online state, project, environment, runtime |
✅ | ✅ | |
accounts |
People sign in; the top bar shows the user, and the People & access and Organization pages take the place of Settings | ✅ | ||
alerts |
The host runs alert rules; the Alerts page and the bell show them.api/, the cloud at api/ |
✅ | ✅ | |
sharing |
Traces can be shared by a read-only link | ✅ | ||
serverStats |
The host computes page numbers itself (api/); ranges reach 7 and 30 days |
✅ | ✅ | |
metrics |
The host keeps metrics; the Metrics page appears | ✅ | ✅ | ✅ |
serverMetrics |
The host computes the Metrics page itself (api/).api/ |
✅ | ✅ | |
search |
The host answers the search language (api/, api/); the Search page and Ctrl+K use it. |
✅ | ✅ | ✅ |
infra |
The host answers api/ and api/ from OpenTelemetry Collector metrics (see "Hosts and Kubernetes"); the Hosts and Kubernetes pages appear |
✅ | ✅ | |
sourcemaps |
The host resolves browser stacks at api/ (see "Source maps"). |
✅ (Node) | ✅ | ✅ |
tags |
The host answers api/ and api/ (see "Tags"); lists show tag chips, Settings shows Tags, and "Tag this" appears.editable in api/ says whether rules can change there |
✅ | ✅ | ✅ |
changes |
The host streams api/ (server-sent events): an event: data line each time the project gets new stats, at most every 2 s (the hub: each settle round), and a comment every 25 s. |
✅ | ✅ | |
saved |
The host keeps saved views, saved searches (log searches charted on the Logs page), and dashboards. |
✅ | ✅ | |
slos |
The host keeps SLOs and Apdex targets. |
✅ | ✅ | |
issues |
The host keeps issue states: error groups and insights can be resolved, ignored, and (cloud) assigned. |
✅ | ✅ | |
uptime |
The host runs uptime checks (api/ on the hub, api/ in the cloud) and serves the uptime page model; the Uptime page appears. |
✅ (unless --no-uptime) |
✅ | |
statusPages |
A project can turn on a public status page (api/) |
✅ | ||
packages |
The host checks the packages services report against OSV (see "Packages"); the Security page lists known-vulnerable ones | ✅ (unless --no-osv) |
✅ (unless --no-osv) |
|
settings |
The host keeps settings per project (thresholds, extra redacted keys, retention) at api/; Settings shows them |
✅ | ✅ |
Add-ons answer mode: "in-app" and capabilities: ["federation", "search", "tags"], plus metrics when metrics are on and sourcemaps (Node) unless sourceMaps: false. The hub
answers mode: "hub" and capabilities: ["federation", "environments", "registry", "metrics", "serverMetrics", "serverStats", "search", "changes", "issues", "alerts", "slos", "infra", "sourcemaps", "saved", "tags", "settings", "uptime", "packages"] (uptime only while checks are on, packages only while OSV checks are on). Add-ons also report project and sendTo (the hub or cloud they send to) when set.
Add-on options
| Option | . |
Node | Default |
|---|---|---|---|
| Service name | Service |
service |
.OTEL_, else the application name; Node: required |
| Read-only MCP endpoint | Mcp |
mcp |
false |
| Capture response bodies | CaptureResponseBody |
captureResponseBody |
false |
| Sampling rate (0. |
Sampling. |
sampling. |
1, or WIZELENS_ |
| Keep traces with an error | Sampling. |
sampling. |
true, or WIZELENS_ |
| Keep traces with a slow server-side span (ms) | Sampling. |
sampling. |
1000 (null =WIZELENS_ |
| Keep log lines outside a request | Logs. |
logs. |
true, or WIZELENS_ |
| Lowest level kept outside a request | Logs. (LogLevel) |
logs. |
info, or WIZELENS_ |
| Share kept outside a request, below warn (0. |
Logs. |
logs. |
1, or WIZELENS_ |
| Tag the current request | WizeLensRequest. |
wizelens. |
— |
| Tag rules (see "Tags") | Tags. |
tags. |
none; a bad rule throws at startup |
| Turn off built-in tags | Tags. |
tags. |
all on |
| Set the current user | automatic from HttpContext. |
wizelens. |
— |
The app's version (service. on every span) |
Release |
release (React: release prop) |
WIZELENS_, else the entry assembly's informational version (.npm_ (Node) |
Metrics
WizeLens keeps OpenTelemetry metrics next to traces. A point (MetricPoint, @wizeworks/lens-core):
{ name, kind: "gauge" | "sum" | "histogram", unit, description?, service,
monotonic?, // sums: true for counters
temporality?: "delta" | "cumulative", // sums and histograms
attributes, timeMs, startMs?,
value?, // gauges and sums
histogram?: { count, sum, min?, max?, bounds: number[], counts: number[] } } // counts has bounds.length + 1 entries
A series is one name, one service, and one attribute set. Exponential histograms become explicit buckets (the upper bound of
positive bucket i is base^(offset+i+1), base = 2^(2^-scale); zero and negative counts go to the first bucket). A summary
becomes a histogram with count and sum and no buckets.
How the page draws them (metricsModelOf, the same code everywhere): gauges and up-down sums as their value; counters as a rate
per second (a drop means the counter restarted); histograms as p50, p95, and p99 from the bucket counts (cumulative points are
turned into the change since the previous point). Lines can be split by service or by an attribute.
Metric rollups. The model reads per-series rollups, never a capped set of points. Hubs and the cloud write them at ingest,
in the same transaction as the raw points, into three tiers: metric_10s (kept 6 h 10 min), metric_5m (kept 50 h), and
metric_1h (kept for the retention). A tier row holds, per series and bucket, the point count and the sum, min, and max of the
values, the first and last value with their times, a counter's change and the time it took (rate_delta, rate_ms), and a
histogram's change (h_count, h_sum, h_min, h_max, and h_bounds / h_counts as JSON). metric_series keeps what each
series is (name, service, kind, unit, attributes, from its newest point) and its newest point, so a cumulative counter or
histogram gets the change since its previous point across batches and window edges: the first point of a series inside a window
counts its change from the point before the window. A point that is not newer than the stored one adds its value but no change.
Pages read the tiers the way they read the stats rollups (see "Stats tables"); meta.sampled is always null. In-app hosts send
raw points and the browser builds the same rollups in memory (metricsModel({ points, range, now, params })).
The runtime strip shows, per service, the first of these that it sends:
| Tile | Metric names |
|---|---|
| CPU | process., dotnet., process. |
| Memory | process., dotnet. |
| Heap | v8js., dotnet., jvm. |
| Event loop delay | nodejs. |
| GC | dotnet., v8js., jvm. |
| Thread pool queue | dotnet. |
| Request time | http. (p95) |
Add-ons collect every 10 seconds and keep one hour in memory (at most 50,000 points and 1,000 series).
GET {base}/api/metrics/points?since=<epoch ms> answers { points: MetricPoint[] }, oldest first. Batches to a hub carry the
same points in IngestBatch.metrics.
- Node collects
process.cpu.utilization,process.cpu.time,process.memory.usage,v8js.memory.heap.usedand.limit,nodejs.eventloop.utilization,nodejs.eventloop.delay.p50/.p99/.max, andv8js.gc.duration. App metrics come in throughwizeLensMetricExporter(wizelens)in an OpenTelemetryPeriodicExportingMetricReader. - .NET listens to every
Meterwith aMeterListener: the .NET runtime (dotnet.*), ASP.NET Core (http.server.request.duration,kestrel.*),HttpClient, and the app's own meters. Counters are sent as cumulative totals, histograms as delta per interval, with the instrument's advised bucket bounds.
| Option | . |
Node | Default |
|---|---|---|---|
| Turn metrics on | CaptureMetrics |
captureMetrics |
true |
| How often | MetricsInterval |
metricsIntervalMs |
10 s |
| How long they are kept | MetricsMaxAge |
metricsMaxAgeMs |
1 h |
MCP: list_metrics (range?, service?, q?) and get_metric (name, range?, service?, group?, stat?), read-only.
Hosts and Kubernetes
There is no WizeLens agent. The OpenTelemetry Collector (contrib) sends host and cluster metrics over OTLP; the recipe is
deploy/helm/wizelens-collector (a DaemonSet with kubeletstats, hostmetrics, and an OTLP receiver; a one-replica
Deployment with k8s_cluster; both with k8sattributes) and deploy/collector/host.yaml for one machine.
Ingest. These resource attributes are copied onto every OTLP metric point, under the point's own (so one host, node,
or pod is one series): host.name, os.type, k8s.cluster.name, k8s.node.name, k8s.namespace.name, k8s.pod.name,
k8s.container.name, k8s.deployment.name, k8s.statefulset.name, k8s.daemonset.name, k8s.job.name,
k8s.cronjob.name, and k8s.container.status.last_terminated_reason (INFRA_RESOURCE_KEYS). OTLP spans get the
k8s.cluster/node/namespace/pod/deployment/statefulset/daemonset names the same way (SPAN_RESOURCE_KEYS), so a span links to
its pod and node. A resource with no service.name but host.name or k8s.* attributes is the service "infrastructure"
(INFRA_SERVICE) and is not written to the service registry. The sender gains k8s?: { cluster?, namespace?, pod?, node? }
from the resource (add-ons may send it too), and its host falls back to k8s.pod.name, so each pod is its own registry row.
Read. infraSteps(dialect, scope, range, now, params) reads the series of the metrics below over the window (totals and
first and last values), plus 60 line buckets for the chosen host (host), node (node), or pod (pod = namespace/name)
only; infraDataOf(points, ...) does the same from raw points. hostsModelOf(data, registry) and kubeModelOf(data, registry)
build the pages; the registry gives the services on each host and in each pod (by host name, by k8s.node, by k8s.pod, or
by a host name that is a pod's name). Other parameters: q, cluster, ns, workload (namespace/Kind/name), service.
| Page | Metrics read |
|---|---|
| Hosts | system. (or system.), system., system., system. /., system. /., system., system. |
| Kubernetes | k8s. (or .), k8s., k8s., k8s. /_, k8s., k8s. (or .), k8s., k8s., k8s., k8s. /. /. /., k8s. /., k8s. /., k8s. /., k8s. /. |
CPU busy is 1 minus the average idle share per CPU. A pod's restarts are its containers' newest k8s.container.restarts;
restarts in the range are the growth since the first point in the window. An out-of-memory kill is a container whose last
exit reason is OOMKilled. A pending pod has k8s.pod.phase 1. A pod not reported within 5 minutes of the newest data is
"Gone" and is not counted. Parity: core/src/testing/infra-scenario.ts (INFRA_PARAM_SETS) runs on memory, SQLite,
Postgres, and ClickHouse.
Redaction
Before storing, replace values with "[redacted]" when the key (case-insensitive) contains any of:
authorization, cookie, password, passwd, secret, token, apikey, api_key, connectionstring.
Applies to attributes, DB parameter names, and header names. List is configurable.
Redaction keeps the evidence the security rules need (docs/redact-vectors.json, run by the TS and .NET tests):
set-cookiekeeps each cookie's name and flags:sid=[redacted]; Path=/; Secure; HttpOnly.url.queryandurl.fullkeep every key and lose the values of sensitive keys:token=[redacted]. OAuth's one-time grantscode,code_verifierandoauth_verifierlose theirs too, matched as whole names.- Values by pattern. Every string value (attributes, event attributes, log messages and attributes) has these
replaced with a typed marker:
[redacted:jwt],[redacted:signed-token](a base64 JSON part and a signature, such asv1.eyJ….sigWebSocket tickets),[redacted:aws-key],[redacted:private-key],[redacted:stripe-key],[redacted:github-token],[redacted:slack-token],[redacted:google-key],[redacted:email](an email address anywhere in the text; values ofenduser.*keys keep theirs, so Users can group by them), and[redacted:card](13 to 19 digits, spaces or dashes allowed, first digit 3 to 6, Luhn valid). The patterns areVALUE_PATTERNSincore/src/redact-values.ts. An email is personal data, not a secret: the secret leak rule does not count it. - Span names lose the query and fragment after a path (
GET /m/a?token=xisGET /m/a; SQL's?stays) and then get the value patterns, soGET /m/eyJ…isGET /m/[redacted:signed-token]. This isredactSpanName, run by the SDKs and by the hub's OTLP andapi/ingestpaths. The secret leak rule counts a kind in the name only when the span's data does not already have it. - SQL parameters are redacted by their name or by the column the SQL binds them to (compared with, set to, or
inserted into), so
"t"."token" = $1hides the first value. Placeholders are$1,?,%s(by position) and@name,:name,%(name)s(by name). A column matches a redact key,email, orsecuritystamp/security_stamp(ASP.NET Identity's SecurityStamp). The parser isparamColumnsincore/src/redact-sql-params.ts; theparamsvectors run in the TS, .NET, Go, and Python tests.
Packages
Every SDK sends the packages it runs once at start: POST {hub}/_wizelens/api/packages with the hub token or ingest key
as Authorization: Bearer, body PackagesReport (core/src/packages.ts): { sender: HubSender, packages: { ecosystem, name, version }[] }, at most 5000. The set replaces the service's last one; a package it still runs keeps its first seen
time. Answers 204, or 400 with what is wrong. A failed send retries up to 5 times, a minute apart. WIZELENS_PACKAGES=false
(or reportPackages: false, ReportPackages = false) turns it off. Sources, with OSV ecosystem names:
| SDK | Ecosystem | Read from |
|---|---|---|
| Node | npm |
node_ (npm, yarn, and pnpm . layouts, nested to 4 levels) |
| . |
NuGet |
the app's deps., package libraries |
| Python | PyPI |
importlib. |
| Java | Maven (groupId:artifactId) |
META-INF/ in class path jars, and in BOOT-INF/ and WEB-INF/ jars inside them |
| Go | Go |
debug. dependencies, with replacements |
Hubs keep them in SQLite (service_packages), the cloud in Postgres (migration PACKAGES_MIGRATION).
The check. Hosts with the packages capability (hub unless --no-osv / WIZELENS_HUB_OSV=false, cloud unless
--no-osv / WIZELENS_CLOUD_OSV=false) send OSV (POST https://api.osv.dev/v1/querybatch, up to 1000 package versions
a round) every package version not checked for a day, every 5 minutes, and fetch each new advisory once
(GET /v1/vulns/{id}, up to 200 a round). Only ecosystems, names, and versions leave the host. The cache is shared by
every project (package_checks, advisories). OSV database_specific.severity maps CRITICAL and HIGH to error,
LOW to info, and the rest (MODERATE, none) to warning.
On the Security page. Each package version with advisories is a vulnerable-package group (A03): key
vulnerable-package|ecosystem|name|version, shape ecosystem name@version, the worst advisory's severity, the services
that run it as endpoints, count the advisories, exampleTraceId null, and advisories ({ id, summary, severity, aliases, fixed, url }[], fixed the versions that fix it for this package). The description names the highest fixed
version. scan is { packages, services, checkedMs } (null without the capability). Hosts pass packages and
packageScan in the page context; under "All projects" each project's services carry its label and one version's
entries merge. find_security_issues adds advisories ({ id, severity, fixed }[]) to a package's row.
Analysis (shared logic, same results in .NET and JS)
- Duplicate query: ≥ 2
dbspans in one trace with identicaldb.query.textAND identicalwizelens.db.parameters. A span with placeholders in its text (?,$1,%s,%(name)s,:name,@name) and nowizelens.db.parameters(the OpenTelemetry agents sanitize SQL) is never a duplicate: its values are unknown. Neither is one whose parameters hold a redacted value. - N+1 query: ≥ 5 (configurable)
dbspans in one trace with identicaldb.query.text(params may differ). - Session statements (
SET,RESET,BEGIN,START TRANSACTION,COMMIT,END,ROLLBACK,SAVEPOINT,RELEASE,DISCARD,USE) are never duplicates or N+1. Apps that setSET LOCAL app.tenant_idper query repeat them by design. - N+1 HTTP: ≥ 5
http.clientspans in one trace with the same method + host + path shape (path shape = path with numeric / guid segments and query values replaced by{}). - Slow query:
dbspan withdurationMs≥ 100 (configurable). - Database wait (dashboard and HUD): 3 or more slow queries in one trace that overlap in time are one
db-waitfinding, not 3 slow queries. So is a slow session statement on its own (aSETdoes almost no work, so it waited). Its time is wall time: queries that waited together waited once. The MCPfind_slow_queriestool still lists each query.
Security analysis
Security findings are Findings with the kinds below (docs/SECURITY-PLAN.md). analyzeTrace returns them; insightsOf
leaves them out, so request health and insight counts do not change. Shared vectors: docs/security-vectors.json.
Each kind has one OWASP Top 10:2025 category (OWASP_OF). Findings name what was found, never a secret value.
- The request is the entry server span (
entryServerSpan). Its response headers are known when it has anyhttp.response.header.*attribute; rules that read them skip a request without. It is HTTPS whenurl.schemeishttpsor the firstx-forwarded-protovalue ishttps. - Inputs of the request:
url.queryvalues (decoded,+is a space), path values (each{name}or:namesegment ofhttp.routeagainst the same segment ofurl.path, decoded), and the string and number leaves ofwizelens.request.bodywhen it is complete JSON (depth 5, 100 values). A value counts when it is 3 to 200 characters, or 2 or more digits, and is not a redaction marker. sql-injection(error): a SQLdbspan (not NoSQL) whosedb.query.texthas a literal equal to an input. Literals:'...'strings (''is a quote; leading and trailing%trimmed), and numbers after=,<>,!=,<=,>=,<,>, orIN (. One finding per query text; shape the query text.missing-headers(warning): a 2xx answer with headers known that lacksx-content-type-options; with atext/htmlcontent type, alsocontent-security-policyandx-frame-options(unless the CSP hasframe-ancestors); over HTTPS, alsostrict-transport-security. Shape: the missing names, sorted, joined by,.version-header(info):x-powered-by,x-aspnet-version, orx-aspnetmvc-versionpresent, orserverwith\d+\.\d+. Shapename: value(value cut to 80), one per header.cors(warning):access-control-allow-originis*andaccess-control-allow-credentialsistrue, or it isnull. Shapeaccess-control-allow-origin: *, with credentialsoraccess-control-allow-origin: null.cookie-flags(warning): each cookie inhttp.response.header.set-cookie(split at,beforename=), unless it is redacted whole or hasMax-Age=0. MissingSecureover HTTPS or withSameSite=None; missingHttpOnlywhen the name matchessess|sid|auth|token|jwt|login|remember|identity|\.aspnetcore\.. Shapecookie {name}: missing HttpOnly, Secure.secret-in-url(warning): the request'surl.query, or anhttp.clientspan'surl.fullquery, has a key that is a default redact key. Shape:{method} {route or path}?{key}={}with only those keys for the request,httpShapefor a call.plain-http(warning): anhttp.clientspan tohttp://(url.full, elseurl.scheme) whose host is public: notlocalhost,::1, an IPv4 in0.,10.,127.,169.254.,172.16-31., or192.168., an IPv6 infc,fd, orfe80:, a name without a dot, or a name ending in.local,.internal,.svc,.cluster.local, or.localhost. ShapehttpShape.ssrf(error): anhttp.clientspan whose host equals an input, or whoseurl.fullstarts with an input, or whose host equals the host of an input that is a URL. Only inputs with a.,:, or/count. ShapehttpShape.stack-exposed(warning): a 4xx or 5xx answer whosewizelens.response.bodyholds a stack trace (STACK_RE: Python "Traceback (most recent call last)", Go "goroutine N [", Java.java:N), .NET:line Norat Name(, Nodeat name (file:N:N), PHP "Stack trace:" + "#0"). Shape: the endpoint.exposed-path(error): a 2xx answer to a sensitive path (EXPOSED_PATHS:.envand.env.*,.git/,.svn/,.aws/,.ds_store,web.config,phpinfo.php,server-status,elmah.axd,trace.axd,debug/pprof, and theactuatorendpointsenv,heapdump,threaddump,configprops,mappings,beans,loggers,shutdown,jolokia). Shape: the path, lower case.open-admin(warning): a 2xx answer to a path with anadmin,internal, ormanagementsegment (not a sign-in path:login,signin,sign-in,logon), with noenduser.idin the trace and noauthorization,cookie,x-api-key, orapi-keyrequest header. A GET counts only when its headers are known and it did not answertext/html(an app shell). Shape: the endpoint.secret-leak: redaction markers (see "Redaction") in log lines (in logs), span attributes and events (in span data), orwizelens.response.body(in a response; notjwt, which login answers send). Error, exceptjwt(warning). Shape{label} {where}, for exampleCard number in logs; count the markers.auth-guessing(rollups, not one trace):sec.authrows (service|endpoint|address) with 10 or more 401 or 403 answers in the window. Requests count there when they answer 401, 403, or 429, or their path matcheslogin|signin|sign-in|logon|auth|token|session|password|otp|2fa|mfa|verify. One group per endpoint; high at 100. With no 429 at that endpoint, it says there may be no rate limit.- Facts (
FACTS_VERSION10):sec(kind|shape, with SQL asnormalizeQuerytext; count, newest top),sec.ep,sec.u, per servicesec@svcandsec.ep@svc, andsec.auth. A request's risks come from its row, a job's from the trace; loose traces add none. A risk found in log lines stays counted after the lines are pruned. - The
securitypage model (api/models/security):totals(count, high, endpoints),prevTotals,found, the 10categorieswith counts,groups,matching,selected,issues,releases, andselectedUsers. Params:service,status(as Insights),release(withservice),category(A01..A10),severity(error,warning,info),endpoint,q, andkey. Each group haskind,owasp,severity,impact,title,description,shape,occurrences,count,endpoints,firstSeenMs,lastSeenMs,exampleTraceId, andaddresses(sign-in guessing only). Issue states are kept asinsightissues with the group key.
Timing
-
Streams. A server span is a stream when it has
wizelens.stream, answeredtext/event-stream, or answered 101. Its request time iswizelens.stream.first_byte_ms(0 when unknown), not the minutes it stayed open, in requests, services, endpoints, and releases. A client that closes a stream does not abort it. Thesvc.streamandreq.streamstats count streams and their open time; the Service and Endpoint pages show them as Streams. -
Late browser spans. A request without a browser call is timed by its entry server span. A browser span that starts more than 10 minutes after its server answer ended is left out of the trace.
Server-Timingcarrieswl-start;desc={epoch ms}; a page that opened more than 5 minutes after it, or came from a cache (transferSize0), starts its own trace. -
Database and outbound times are wall time: spans that overlap count once. "All queries added up" is shown next to it when queries ran at the same time. A request can never show more database time than server time.
-
Span start and end times keep sub-millisecond precision, so queries that start in the same millisecond keep their order.
Sampling
A trace is kept by rate when parseInt(last 8 hex digits of traceId, 16) / 2^32 < rate, so every add-on keeps the same
traces. A trace outside the rate is held (spans, logs, remotes) until its local root span ends (no parent, or a parent in
another process); it is kept when any span has status error (with keepErrors), an error log line, or a non-browser span
at least keepSlowMs long. Otherwise it is dropped. A held trace whose root never ends is dropped after 60 s. Items that come
after the choice follow it; an error after a drop keeps the rest of the trace. Sampling applies to the store, the SQLite
file, and the hub sends alike.
The Node add-on does not keep Fastify's own per-request pino lines ("incoming request" and "request completed" at info or
below): the server span already holds the method, path, status, and time. Lines the app writes with request.log are kept.
Logs outside a request
A log line written while no span is current (startup, background jobs, timers) is kept as a loose line when the add-on's
options allow it: Logs.Outside / logs.outside is on, its level is at or above Logs.MinLevel / logs.minLevel, and,
below warn, a random draw falls inside Logs.Rate / logs.rate (warn and up are always kept). Trace sampling
never applies to loose lines. Categories that start with wizelens (and [wizelens] console notices) are never kept.
- Loose lines go into a loose batch: a trace with no spans whose id is 16 zeros plus 16 random hex digits
(
LOOSE_TRACE_PREFIX,isLooseTraceId). An add-on starts a new batch for each 5-minute window (LOOSE_WINDOW_MS) or when the batch holds its per-trace log limit (1000).spanIdis null; service, category, attributes, redaction, and length limits are those of request lines. - Loose batches are stored, persisted, and sent to the hub as ordinary traces (no new wire field). In-app stores cap them
apart from traces: at most max(10,
MaxTraces/ 4) batches, so neither pushes the other out. - They are not traces to list:
api/tracessummaries, trace lists, the Traces page,tracerollups, andtraces/requestssearch leave them out. Their lines are on the Logs page, inlogssearch, and infull=truereads. A Logs row of a loose line has an emptytraceName. - The Logs page filter
origin=request|outside(list filterlogOrigin) keeps one side.
Log patterns
logPattern(message) takes the first line, masks uuids (<uuid>), quoted values (<str>), hex and mixed ids (<id>),
and numbers (<num>), collapses spaces, and cuts it at 200 characters. patternIdOf(message) is its 14-hex-digit hash. Log
facts carry it in fact_logs.pattern; the list filter pattern (URL pattern=) keeps one pattern. The log.p rollup counts
lines by service␟level␟pattern␟origin (r or o), with the newest line as its top ({ pattern, message, category, traceId }).
log, log.s, and log.p are the log kinds (LOG_KINDS): they follow the log retention.
Not traced
- CORS preflights (
OPTIONSwithAccess-Control-Request-Method). The browser sends them with notraceparent, so they could never join a trace, and in a cross-origin app they are half of all requests. - Health checks: a
User-Agentthat starts withkube-probe/,GoogleHC/,ELB-HealthChecker/, orGoogleStackdriverMonitoring-UptimeChecks. They come every few seconds with the same answer, and buried every visit in the trace list. The request runs with tracing off, so no framework or database span starts a trace of its own.
Clocks
- The browser sends
sentMs(itsDate.now()) with eachPOST api/client-spans. When the server's clock differs by more than 10 s, the add-on moves the posted span starts, event times, and log times by the difference. WithoutsentMs, times are kept. - Building a trace, a span that starts before its parent in the same service starts with its parent. A server span that
starts outside the call from another service that started it is moved inside that call. A server span with no parent counts as
started by the one browser call in another service whose
url.fullpath is itsurl.path: a cross-origin fetch sends notraceparentand joins the server's trace fromX-WizeLens-Trace. Only the clock uses this; the parent links stay as sent.
MCP tools (read-only)
Server name wizelens. Disabled by default. Every call is written to the app log as an audit line.
| Tool | Args | Returns |
|---|---|---|
list_ |
limit?=, minDurationMs?, status?, q?, range?= |
Node hosts: TraceItem[] ({ traceId, path, durationMs, health, status, services, startMs, spanCount, slow }); . |
get_ |
traceId, federate?= |
Trace (spans + logs, redacted) |
find_ |
thresholdMs?=, limit?=, range?= (Node hosts) |
{ traceId, spanId, durationMs, query, service }[], slowest first |
find_ |
severity?= (lowest: error, warning, info), limit?=, range?= |
{ kind, owasp, severity, title, shape, endpoints, requests, count, lastSeen, exampleTraceId }[], most severe first, then most requests.security page (status all), else the traces in memory; . |
find_ |
minRepeats? (the project's threshold), limit?=, range?= |
Node hosts: groups { kind: "db"|"http", shape, endpoints, requests, repeats, totalMs, lastSeen, exampleTraceId }[], most time first: from the insight stats at the project's threshold, else from the requests with that many calls (up to 200 read whole).{ traceId, kind, shape, count, totalMs }[] |
get_ |
limit?=, range?= (Node hosts) |
{ traceId, spanId, service, name, message, type, stack }[] |
search |
q, kind?=, range?=, limit?=, cursor? |
SearchPage (below) plus tags (tag names per row, as api/ answers) and unknownTags; a bad q is an error with start/end |
list_ |
none | { name, query, builtIn, enabled }[]: the names tag: reads |
search_ |
field?, prefix?, range?= |
{ value, help?, count? }[] |
get_ |
range?= (1h, 6h, 24h, 7d) |
Hub and cloud.{ window, stillSettling, requests, errorRatePercent, avgDurationMs (each { value, previous, changePercent }), needsAttention, services, exceptions, topErrors (10, most first), insights }, from the overview, services, and errors page models.project: { range, totals, projects[] }, one report per project, those needing attention first |
get_ |
range?= (1h, 6h, 24h, 7d, 30d) or from + to (ISO 8601), service?, endpoint?, buckets?= (16, 24, 48) |
Hub and cloud, from the traffic page model.{ window: { from, to, stillSettling }, scope: { service, endpoint, found }, bucketMinutes, totals, points[] }; totals and each point are { requests, errors, errorRatePercent, avgMs, p95Ms }, points with start.endpoint and service: every request (req); with service: that service (svc); with endpoint: that endpoint (svc.), of one service or all.project: { projects[] }, one per project |
group_ |
range?= or from + to, service?, sort?= (requests, errors, errorRate, p95, avg), limit?= (up to 200), minRequests?= |
Hub and cloud, from the traffic page model.{ window, endpoints, requests, shown, rows[] }: endpoints and requests count every endpoint kept by minRequests; each row is { project?, service, endpoint, requests, errors, errorRatePercent, avgMs, p95Ms } for the endpoints of APIs and web apps (svc.).project on a multi-project reader, across every project |
list_ |
range?= (1h, 6h, 24h, 7d) |
Hub and cloud.{ window, baseline, problems, ongoing, list[] } from the problems page model: each problem { id, title, started, ended, ongoing, services, suspectedCause, otherCauses, anomalies[] ({ metric, service, endpoint, started, ongoing, value, normal, alertsAbove }), moreAnomalies }, ongoing first.project: { range, projects[] } |
get_ |
page, params? (text values), range?= |
Node hosts.api/ answers. |
get_ |
none | Hub and cloud.{ firing, rules, events }: rules with channel kinds only (no URLs or keys), newest 50 events |
list_ |
none | Cloud, when the reader has more than one project; the hub, when it holds more than one (the one with no project is "default"): { id, name }[] |
Every tool that takes a search expands tag: with the host's tags first.
On the hub, the cloud, and the Node add-on, list_traces, get_errors, and find_slow_queries read the whole store
through search (the newest traces in memory are merged in, since the store indexes a trace once it goes quiet), not the
newest 500 traces. find_slow_queries reads up to 5,000 matching queries, newest first, and returns the slowest.
Issue states
Hosts with the issues capability keep a state per error group (kind: "error", key service|type|message) and per
insight (kind: "insight", the insight key): open, resolved (with the time), or ignored (until a time, or for good),
and an assignee (cloud). A resolved issue that happens after it was resolved is regressed. The hub answers
GET api/issues?project= and POST api/issues?project=; the cloud answers GET api/projects/:project/issues (with the
members issues can be assigned to) and POST api/projects/:project/issues (members who can write; each change writes an
audit line issue.<action>). A POST body is { kind, key, action: "resolve" | "ignore" | "reopen" | "assign", untilMs?, assignee? }.
The Errors model takes status (unresolved by default, resolved, ignored, all) and new=1 (first seen in the
range), and returns issues (status, first seen over all kept data, new, assignee) and hasIssues. The Insights model
takes status the same way. The Overview model returns freshErrors, the newest new and regressed groups.
NoSQL calls
Redis, MongoDB, and Elasticsearch calls are db spans with db.system.name redis, mongodb, or elasticsearch,
db.operation.name, and db.query.text with ids and values as ? (Redis GET user:?, Mongo find orders {"status":?} from
Node or the command JSON from .NET, Elasticsearch GET /orders/_doc/?). Values are never stored. wizelens.db.fingerprint
(Node) or wizelens.db.parameters = {"fingerprint":…} (.NET) is a per-process salted hash of the values: the duplicate check
groups by parameters, then fingerprint. A NoSQL call with neither is never a duplicate. Redis connection and transaction commands
(MULTI, EXEC, PING, SELECT…) and MongoDB cursor and session commands (getMore, killCursors, commitTransaction…) are session
statements, never N+1; a Redis SET is not. On the Database page NoSQL operations map to SELECT, INSERT, UPDATE, DELETE, or OTHER.
Project settings
Hosts with the settings capability keep per project: slowQueryMs, nPlusOneThreshold, redactKeys (added to the
host's list), and retentionDays (never longer than the host or organization keeps). Hub: GET/PUT api/settings?project=.
Cloud: GET/PUT api/projects/:project/settings (PUT needs manage). Both answer { defaults, settings, effective }. Traces
settle with the project's thresholds (TraceState.facts, FactOptions.nPlusOneThreshold); writes hide the project's
keys too (redactSignals). Thresholds and keys apply to new data. Prunes and page ranges use the project's retention.
Hub start options: --slow-query-ms, --n-plus-one, --redact-keys; cloud: --slow-query-ms, --n-plus-one.
Team (cloud)
- Project roles:
PUT api/orgs/:org/projects/:project/roles/:userwithrolenone, viewer, member, admin, or null. Only members and viewers; owners and admins keep their org role.nonehides the project from lists, joins, apps, digests, and MCP.GET api/orgs/:orgaddsprojectRolesfor managers;api/megives each project'srole. - Keys:
expiresInDays(1 to 3650), orexpiresMs(an exact time after now and within 3650 days, for a picked date), andscopes(ingest: traces, logs, metrics; read: api, mcp) on create;POST api/orgs/:org/keys/:key/rotatewithgraceHours(0 to 168, default 24) returns the new secret (same end date as the old key) andoldExpiresMs. - Audit:
GET api/orgs/:org/audit?limit=&offset=&before=&from=&action=&actor=(actionending in "." is a group),GET api/orgs/:org/audit/count({ total }for the same filter),GET api/orgs/:org/audit/facets, andGET api/orgs/:org/audit/export?format=csv|jsonwith the same filter (plan gated).
Users
Requests carry the signed-in user (enduser.id), from the entry server span, else from any span of the trace that has one (a
browser span). Facts keep usr (per user: requests, failures, durations; the top is the newest display name, user.full_name
else user.name, not [redacted]), and one key per item
and user for error groups (err.u), insights (ins.u), and endpoints (ep.u, service|endpoint|user), so pages count distinct
users. The Error and Endpoint pages return users ({ count, top }), Insights selectedUsers for its key. Errors and Logs
take user (Requests already did). The users page lists users by requests (q, page, size); the user page (user) has
their totals, requests over time, newest and slowest requests, and the error groups they hit. User rows carry name. FACTS_VERSION 6.
Saved views and dashboards
Hosts with saved keep items per project at api/saved?project= (hub) or api/projects/:project/saved (cloud):
{ kind: "view" | "search" | "dashboard", name, href, panels, chart, shared }. Views and searches keep a dashboard address (href,
starting #/) with its filters and time range; dashboards keep up to 24 charts. A search of the Logs page (href #/logs?…, with
the filters level, exact, service, category, q, pattern, origin) with chart: true is drawn on the Logs page as a
chart of the lines it matches (Log Metrics); chart is false on every other item. The Logs page saves its charts here
(shared with the project by default on the cloud), so they are saved searches too: in the sidebar, Search, and Ctrl+K. A chart (panels[]) has 1 to 6 metrics
({ name, stat }), a type (line, area, bar stacked, number, or table), a where filter (key=value, comma-separated,
service included), a group to split lines by, and a width (1 half, 2 whole). On the cloud an item belongs to the person who
made it and is shared with the project only when shared; on the hub every item is shared. The metrics model takes where too
and returns it with values, the values each key has (at most 50 per key).
SLOs and Apdex
An SLO covers one service (display name) or one endpoint of it, over the last 7 or 30 days. A request is good when it did not
fail (kind: "success"), or did not fail and took at most thresholdMs (kind: "latency", from the duration histograms, so
within about 4%). target is the percent that must be good (above 0, below 100). The error budget is the bad requests the target
allows; budgetLeft is 1 minus the bad requests over that budget (0 is spent, below 0 is over). The burn rate over a window is the
bad share over the allowed bad share: 1 spends the budget exactly over the SLO's window. Hosts answer GET api/slos?project= (hub)
or api/projects/:project/slos (cloud) with every SLO's report (status over its window, with 48 buckets of good share and budget
left, and the burn rate over the last 1 and 6 hours) and the Apdex targets; POST adds one, and GET, PATCH, and DELETE work
on …/slos/:id. An alert rule with metric: "slo" and sloId watches an SLO's burn rate over its own window.
Apdex scores requests against a target time per service (GET and PUT api/apdex?project= or api/projects/:project/apdex,
{ apdex: { service: ms } }; 500 ms without one): at or under the target is satisfied, under four times it tolerating, and
slower or failed requests frustrated; the score is (satisfied + tolerating / 2) / all. The Overview model returns apdex for the
services that run your code, each against its own target, and the Service page returns the service's.
Search
The Requests, Traces, and Logs page models read q in the search language too. Free words keep the old text filter; a
search with fields, attributes, NOT, or OR makes the host run it (up to 1000 trace ids; searchIds on the page context) and
the list keeps only those traces. Hubs, the cloud, and in-app hosts (in the browser) all do it. The Search page counts every kind
(up to 1000 each, "1000+" past that) and shows when the chosen kind's results happened, through the same api/search.
One language on every host; the grammar, fields, and plan are in docs/SEARCH-PLAN.md, the shared test cases in
docs/search-vectors.json (the TS and .NET suites both run them). Hosts with the search capability answer:
| Endpoint | Params | Returns |
|---|---|---|
GET api/ |
q, kind (requests, traces, spans, logs), range or from/to (epoch ms), env, project (hub, cloud), limit (1–200, default 50), cursor |
{ kind, items, next, tookMs, settling, unknownTags }; 400 { ok: false, error, start?, end? } |
GET api/ |
field (none: fields and attribute keys; service; @user.; tag: the host's enabled tags), prefix, range, limit (1–50) |
{ items: { value, help?, count? }[] } |
- Items: RequestItem, TraceItem, SpanItem (
traceId, spanId, startMs, durationMs, service, name, kind, category, status, method, path, route, httpStatus, user), or LogRow. Order: newest first, then trace id and part (span id or log index) in code-unit order.nextis an opaque cursor; pass it back for the next page. - Text matches are case-insensitive "contains";
field:valueis case-insensitive equality;*is any text. A field a kind does not have never matches (so-field:xdoes). Request and trace text includes their spans' error messages; their@attributefilters match any span of the trace. tag:namestands for the tag rulenameOR the app tag@wizelens.tag.name:*;tag:key:valueis the app tag@wizelens.tag.key:value;tag:pat*is every rule whose name fits;tag:*is any rule. Hosts expand it before the search runs, so every engine sees plain fields.unknownTagslists names aftertag:that no rule has.- Hub and cloud: settling writes one
fact_searchrow per request, trace, span, and log line, and onefact_attrsrow per present attribute value (lowercased, cut at 512 characters, plus its number). Both come from the same document builders as the memory search, so all hosts return the same results.
Source maps
Browser stacks from a production build are minified. Every host maps them back to the original source; the raw stack is
always kept as sent (exception.stacktrace).
Release. The browser package sends service.version on every browser span: the release prop (React), or
globalThis.__WIZELENS_RELEASE__ that the build plugins set. Uploaded maps are stored per project, release, and file, so a
stack finds the maps of the build that threw it.
Upload. POST api/sourcemaps?release=<version>&file=<path> with the map JSON as the body (Content-Encoding: gzip
allowed), at most 64 MB after unzip. file is the minified file's path as served, for example assets/index-abc.js (no
origin, query, ~/, leading slash, or ..; a trailing .map is dropped). Answers 201 { release, file, bytes }; 400 when
the body is not a v3 source map or release/file is missing. The same release and file replace the old map. Each project
keeps its newest 20 releases; older ones are dropped on upload. GET api/sourcemaps[?release=] answers
{ maps: { release, file, bytes, uploadedMs }[] }, newest first. The cloud authorizes both with an ingest key
(Authorization: Bearer wl_ik_...) and stores into the key's project; the hub takes its token (when set) and an optional
project (default "", which every project also reads). @wizeworks/lens-cli (wizelens sourcemaps upload <dir>) and its
Vite, webpack, and Next.js plugins send every *.js.map below a build folder this way, each keyed by the script whose
sourceMappingURL names it (Turbopack names maps apart from their scripts), else by the map's own name without .map.
Matching. A frame's script URL matches a stored file when its path, or a trailing part of it, equals the file:
https://shop.test/app/assets/index-abc.js tries app/assets/index-abc.js, assets/index-abc.js, then index-abc.js; the
longest match wins.
No upload (hub and in-app Node). Maps are also read from build folders (hub --sourcemaps <dir>, Node
sourceMaps: { dirs }) by the same path rule (the .map next to the file, or the one its sourceMappingURL names), and from
dev servers on this machine: the host fetches the script (only localhost, 127.x, ::1, *.localhost, plus Node
sourceMaps.origins), follows its sourceMappingURL (inline data: maps too), or tries <script>.map. The browser package
does the same for scripts on the page's own origin (resolveFrames, default on). Hosts without the sourcemaps capability
(.NET) get resolved stacks from the dashboard, which reads the maps the site serves.
Grouping. When a browser error arrives (browser package, Node api/client-spans, hub and cloud api/ingest), the first
frame that a map covers and that is app code (not node_modules or bundler runtime) is written to the exception event as
wizelens.error.frame = <source>:<function> (the function holding the line, read from the map's sourcesContent; the
line number when there is none), for example src/cart/Checkout.tsx:applyCoupon. A host never replaces a frame already
set. The error group key is service|type|message shape, plus |<frame> for browser errors that have one, so the same
message thrown in two places is two groups, and one error stays one group across builds. Errors whose map was not found keep
the key without a frame. This changed the facts: FACTS_VERSION 7.
Resolve on read. POST api/sourcemaps/resolve (?project= on the hub and cloud) with { stack, release, traceId?, spanId? } (the stack cut at 64 KB) answers { frames: ResolvedFrame[] }. The maps are those of the project the error belongs
to: on the hub, the project its trace was sent to (so "All projects" resolves too); on the cloud, the project its span was sent
to among the projects the caller may join (a browser error on another project's trace page). Without traceId, or when it is
not found, ?project= decides. The dashboard sends the error's traceId and spanId from the errors panel, the error page,
and the trace page's Errors tab.
interface ResolvedFrame {
raw: { fn: string | null; url: string; line: number; column: number; raw: string }; // the frame as sent
source: string | null; // original file for display; null when no map covers the frame
line: number | null; // 1-based original line and column
column: number | null;
fn: string | null; // the function holding the line, or the raw name
inApp: boolean; // false for node_modules and bundler runtime
context: { start: number; lines: string[] } | null; // 3 lines before and after, from sourcesContent
}
Stack lines in Chrome, Edge, and Node (at fn (url:line:col)), Firefox, and Safari (fn@url:line:col) formats are read;
native and eval frames are skipped. Index maps (sections) and sourceRoot are supported.
Tags
A tag is a rule: a name, a color, and a search (docs/TAGS-PLAN.md). Hosts keep rules in settings, never in telemetry, and check them each time data is shown, so a tag covers old and new data alike and outlives what it matched.
TagRule:{ id, name, color, query, builtIn, enabled }.name: 1–40 ofa-z 0-9 - _, starting with a letter or digit, unique.color:blue,green,amber,orange,red,violet,slate.query: 1–2000 characters of the search language that parse, match less than everything, and never usetag:. At most 50 rules per project (hub: per hub).- Built-ins, ids
builtin:{name}, on until turned off; onlyenabledchanges:stream(text/event-streamresponses),probe(Kubernetes, Google, and AWS health checks by user agent),bot(crawlers by user agent). Their searches are in docs/search-vectors.json, and both suites check them. GET api/tags→TagList{ tags: TagRule[] (built-ins first, then by name), editable, max }. In-app: thetagsoption, read-only. Hub:POST{ name, color, query },PATCH /{id}(what is sent changes; a built-in takes only{ enabled }),DELETE /{id}; 400 answers{ ok: false, field, error }.POST api/tags/match{ kind, items: { traceId, owner, timeMs }[] }→{ matches: { "traceId owner": name[] } }, rows without a tag left out, names in rule order.owneris the span id (spans), log index (logs), or"". Each enabled rule runs as a search ofkindover just those traces, from an hour before the firsttimeMsto an hour after the last, on the host's own engine, so a tag shows exactly where the same search finds the row. The dashboard gives trace rows the tags their request matches too (route and user are request fields).- Rows that count many requests (endpoints, services, error groups) show a rule only when every field it names describes the
row:
service,method,route,path(endpoints);service(services);service,error, and free words on the type and message (error groups). The dashboard checks these itself with the same compiler.
Storage
Every add-on keeps a hot in-memory store (the read path) and, optionally, a SQLite file behind it.
| Option | . |
Node | Default |
|---|---|---|---|
| Storage kind | Storage = |
storage: "sqlite" | "memory" |
sqlite when enabled |
| File | StoragePath |
storagePath |
{contentRoot or cwd}/ |
| Max traces | MaxTraces |
maxTraces |
2000 |
| Max age | MaxAge |
maxAgeMs |
24 h |
Behavior:
- On startup: open the file (create folder + schema), enable WAL, delete rows past the limits, load
the newest
MaxTracestraces into memory. - While running: changed traces are marked dirty. A background flusher writes dirty traces in one transaction every 500 ms, and once more on shutdown. Spans and logs are upserted / inserted, never rewritten in full.
- After each flush: prune by age and count (same rules as the memory ring buffer).
- If the file cannot be opened or written, log one warning and fall back to memory only. Never break the app.
Schema (shared: wizelens-hub --import <file> copies any add-on's file into the hub):
CREATE TABLE IF NOT EXISTS meta (key TEXT PRIMARY KEY, value TEXT NOT NULL); -- ('schema','1'), ('service', name)
CREATE TABLE IF NOT EXISTS traces (
trace_id TEXT PRIMARY KEY, start_ms REAL NOT NULL, updated_ms REAL NOT NULL,
remotes TEXT NOT NULL DEFAULT '[]' -- JSON string[]
);
CREATE TABLE IF NOT EXISTS spans (
trace_id TEXT NOT NULL, span_id TEXT NOT NULL, parent_span_id TEXT,
name TEXT NOT NULL, kind TEXT NOT NULL, category TEXT NOT NULL, service TEXT NOT NULL,
start_ms REAL NOT NULL, duration_ms REAL NOT NULL, status TEXT NOT NULL,
session TEXT, -- wizelens.browser.session
json TEXT NOT NULL, -- full contract Span
PRIMARY KEY (trace_id, span_id)
);
CREATE TABLE IF NOT EXISTS logs (
trace_id TEXT NOT NULL, seq INTEGER NOT NULL, time_ms REAL NOT NULL, level TEXT NOT NULL,
json TEXT NOT NULL, -- full contract LogRecord
PRIMARY KEY (trace_id, seq)
);
CREATE INDEX IF NOT EXISTS ix_traces_start ON traces(start_ms);
CREATE INDEX IF NOT EXISTS ix_spans_session ON spans(session) WHERE session IS NOT NULL;
CREATE INDEX IF NOT EXISTS ix_spans_cat_dur ON spans(category, duration_ms);
Summaries are always computed from spans, never stored. Deleting a trace deletes its spans and logs.
Local hub
One process (@wizeworks/lens-hub, command wizelens-hub, default port 5960) that every service sends to.
It serves the same dashboard at /_wizelens/, the same read API, OTLP/HTTP, and MCP.
Sending to the hub
| Option | . |
Node | Environment variable |
|---|---|---|---|
| Where to send | Endpoint |
endpoint |
WIZELENS_ (for example http:/) |
| Token (hub token or ingest key) | Token |
token |
WIZELENS_ |
| Project | Project |
project |
WIZELENS_ |
| Trusted remotes | TrustedRemotes |
trustedRemotes |
WIZELENS_ (comma-separated, for example https:/) |
| On or off | Enabled |
enabled |
WIZELENS_ (true/1/on/yes, false/0/off/no) |
| Dashboard | Dashboard |
dashboard |
WIZELENS_ (same words) |
| HUD on served pages | Hud |
hud |
WIZELENS_ (same words; default on, only while the dashboard is served) |
Send-only. The dashboard is on in development and off elsewhere (.NET: outside the Development environment; Node: when
NODE_ENV=production), unless the option or variable says otherwise. With it off, only POST {basePath}/api/client-spans
answers (and its CORS preflight); every other path under {basePath} (UI, api/info, api/traces, metrics, MCP) is a 404.
Storage defaults to memory, MCP is off, and sender.endpoint is left out of every IngestBatch, so the hub never tries to
read from the service. The browser package skips its reads (api/traces) when hud is false, or "auto" and api/info does not answer
(readServer follows hud). A send-only add-on puts no HUD on its pages.
The add-on keeps working as before (its own store and dashboard). In addition, it queues every new span, log, and remote
and sends them every second in one IngestBatch (at most 1000 of each). With nothing to send, it sends an empty batch every
10 seconds as a heartbeat. When the hub is down, it keeps the queue (at most 20000 items, oldest dropped first), backs off
up to 30 seconds, and logs one warning. The calls to the hub are never traced.
// POST {hub}/_wizelens/api/ingest → 204, or 400 without sender.service
interface IngestBatch {
sender: {
service: string; project?: string;
version?: string; // the WizeLens add-on's version (OTLP senders: the app's)
release?: string; // the app's version, `service.version` on its spans
runtime?: string; environment?: string; host?: string;
k8s?: { cluster?: string; namespace?: string; pod?: string; node?: string };
endpoint?: string; // the add-on's own /_wizelens URL
startedMs?: number;
};
spans?: Span[]; // checked and redacted again by the hub
logs?: { traceId: string; log: LogRecord }[]; // messages are cut at 10,000 characters
remotes?: { traceId: string; endpoint: string }[];
metrics?: MetricPoint[]; // their `service` is replaced by the sender's
}
The hub keeps at most 5,000 items of each kind from one batch.
Hub endpoints
| Method | Path | Notes |
|---|---|---|
| GET | / |
mode: "hub" |
| GET | / |
Like the add-on, plus filters env, project, before.since means changed since (hub clock), so late spans are found |
| GET | / |
With federate=, also reads services that do not send to the hub |
| GET | / |
{ services: HubService[], environments, projects, traces, spans } |
| POST | / |
IngestBatch.wizelens. first (see "Source maps") |
| POST | / |
PackagesReport (see "Packages"). |
| POST / |
/ |
Upload one map, or list them; project is optional (""). |
| POST | / |
{ stack, release, traceId?, spanId? } → { frames }; the maps of the trace's project, else ?project= |
| POST | /, /, / |
OTLP// |
| GET | / |
The Metrics page: range, project, env, service, metric, group, stat, q. |
| GET | /, / |
The Hosts and Kubernetes pages (see "Hosts and Kubernetes"): range, project, env, host, node, pod, cluster, ns, workload, service, q |
| GET | / |
One page model (see "Page models"): range, project, env, and the page's own parameters.serverStats |
| POST | / |
With --mcp.list_, get_, get_, list_, get_, and group_ |
| GET / |
/ |
UptimeList /project in the body).--no-uptime |
| PATCH / |
/ |
Change (only the fields sent) or delete a check |
| POST | / |
Run a check now; answers the check |
| GET / |
/ |
Tag rules for the whole hub (see "Tags").Origin of another site gets 403), and with the token when one is set |
| POST | / |
?project=; see "Tags" |
| GET | / |
ok |
Uptime changes with an Origin header must come from the hub's own origin, so another site open in the browser cannot add
checks to a hub without a token.
HubService is the sender plus via ("addon", "otlp", or "uptime" for the host's own checks), firstSeenMs, lastSeenMs, and online (heard from in the
last 30 seconds). OTLP apps send only when they have data, so the dashboard shows a quiet OTLP app as "Idle", not "Offline".
There is one row per service, environment, and host, so each Kubernetes pod is its own row. The dashboard groups them into one row per service; a click shows the hosts, and hosts offline for more than a day hide until asked for. The hub drops rows not heard from within its retention; the cloud does the same with each organization's retention.
Trace remotes that point at a service which sends to the hub are hidden, so the dashboard does not read that service twice.
OTLP mapping
- Resource
service.name→ service;service.namespace(orwizelens.project) → project;deployment.environment.name(ordeployment.environment) → environment;host.name(ork8s.pod.name) → host;k8s.cluster.name,k8s.namespace.name,k8s.pod.name,k8s.node.name→k8s. Host and Kubernetes resource attributes are copied onto metric points and spans (see "Hosts and Kubernetes"). - Span kind, status, events, and attributes map one to one. Category uses the same rules as the add-ons.
- Older attribute names are copied to the current ones when the current one is missing:
http.method,http.status_code,http.url,http.target,http.scheme,db.statement,db.system,db.name,db.operation,net.peer.name,net.peer.port. Alsohttp.user_agent,http.client_ip,http.flavor,http.request_content_length,http.response_content_length,db.sql.table/db.mongodb.collection/db.cassandra.table/db.cosmosdb.container(→db.collection.name),net.host.name,net.host.port,net.sock.peer.addr,net.sock.peer.port,messaging.operation,messaging.destination,code.function,code.filepath,code.lineno. The first older name wins. url.paththat holds a query (fromhttp.target) is split intourl.pathandurl.query.- Captured headers: a list value is joined with
,, and_in the name becomes-(http.request.header.content-type). - SQL parameters:
db.query.parameter.<key>(Java agent) becomewizelens.db.parameters, a JSON array when every key is a position, else an object, redacted by name and column (see "Redaction"); the per-key attributes are removed. Python'sdb.statement.parameters(thestr()of a tuple or dict) is read as JSON the same way, or kept as text (redacted whole when it names a secret). A value an SDK already set wins. - A
dbspan whose parent in the same export is also adbspan (an ORM over its driver, such as SQLAlchemy over sqlite3) becomesinternal, so the query counts once; its parameters move to the parent when the text matches. - Log records keep their trace id. Records without one (startup, jobs) go into a loose batch:
looseTraceIdOf(project|service|environment|host, time), one per source and 5-minute window, withspanIdnull. Severity 1–4 trace, 5–8 debug, 9–12 info, 13–16 warn, 17–20 error, 21–24 critical. - Metrics: gauge, sum, histogram, exponential histogram, and summary, as described in "Metrics". Metric attributes are redacted.
Access
The hub listens on 127.0.0.1 by default. For a team network, start it with --host 0.0.0.0 --token <text>.
With a token, every call needs Authorization: Bearer <token> (add-ons: WIZELENS_TOKEN; OTLP:
OTEL_EXPORTER_OTLP_HEADERS=Authorization=Bearer <token>). In a browser, open /_wizelens/?token=<token> once:
the hub keeps it in an HttpOnly cookie and removes it from the address.
Hub storage
One SQLite file (default ~/.wizelens/hub/hub.db), newest 50000 traces or 7 days. Traces are built from rows when read.
CREATE TABLE traces (trace_id TEXT PRIMARY KEY, start_ms REAL, end_ms REAL, updated_ms REAL, env TEXT, project TEXT);
CREATE TABLE spans (trace_id TEXT, span_id TEXT, service TEXT, start_ms REAL, duration_ms REAL, session TEXT, json TEXT,
PRIMARY KEY (trace_id, span_id));
CREATE TABLE logs (trace_id TEXT, key TEXT, time_ms REAL, json TEXT, PRIMARY KEY (trace_id, key)); -- key = hash of the log identity
CREATE TABLE remotes (trace_id TEXT, endpoint TEXT, PRIMARY KEY (trace_id, endpoint));
CREATE TABLE services (project TEXT, service TEXT, environment TEXT, host TEXT, via TEXT, info TEXT, first_seen REAL, last_seen REAL,
PRIMARY KEY (project, service, environment, host)); -- '' for unknown
CREATE TABLE metrics (time_ms REAL, project TEXT, env TEXT, service TEXT, name TEXT, series_key TEXT, json TEXT); -- series_key = sha1
CREATE TABLE sourcemaps (project TEXT, release TEXT, file TEXT, map BLOB, bytes INTEGER, uploaded_ms REAL,
PRIMARY KEY (project, release, file)); -- map gzipped
CREATE TABLE saved (id TEXT PRIMARY KEY, project TEXT, kind TEXT, json TEXT, created_ms REAL); -- SavedItem as JSON
CREATE TABLE tag_rules (id TEXT PRIMARY KEY, name TEXT UNIQUE, color TEXT, query TEXT, created_ms REAL, updated_ms REAL);
CREATE TABLE tag_builtins (name TEXT PRIMARY KEY, enabled INTEGER); -- built-ins turned off
Log retention: --log-retention <time> (WIZELENS_HUB_LOG_RETENTION, default --retention). Each prune drops loose batches
older than it (through the trace prune, so they leave the rollups), raw log rows older than it, their fact_logs, logs
search rows, and log attributes, and the log kinds' rollup buckets past it. Loose batches do not count toward
--max-traces and are not pruned by --retention; the 1 h tier ages trace kinds by --retention and log kinds by
--log-retention. fact_logs gained pattern (added to older files when opened).
Metric points older than the trace age limit are dropped, then the oldest past --max-metric-points
(WIZELENS_HUB_MAX_METRIC_POINTS, default 2,000,000). That cap is for raw points only: the metric rollup tiers drop buckets past
their keep (10 s and 5 min tiers) or the trace age limit (1 h tier and metric_series) once a minute. A file from before metric
rollups gets its stored raw points rolled up once, oldest first, for half a second each minute (meta('metric_backfill') holds
the progress, then done); points that arrive meanwhile are rolled up as usual.
Schema version 3 adds the stats tables (see "Stats tables"): traces gains settled_ms and contrib, and the fact, rollup, hist,
and metric rollup tables use project in place of project_id ('' for unknown), SQLite types, and keys that start with the
trace id (facts) or (kind, bucket_ms, project, env, key) (rollups), since hub reads often have no project. Files from older hubs
upgrade by themselves when opened: the new columns and tables are added, and the settle job backfills the stats, newest traces
first. The hub settles every 2 seconds for at most 150 ms at a time. Pruning by age or by count takes the dropped traces out of
the rollups. Page answers are cached per page, parameters, scope, 10-second "now", and settle generation (200 entries).
Schema version 4 adds uptime_checks (one row per check: its settings, project, state, the newest result, tls_expires_ms,
and next_ms) and uptime_incidents (check_id, start_ms, end_ms or null while open, reason). Results themselves are
traces. Incidents that ended more than 90 days ago are dropped.
Cloud
@wizeworks/lens-cloud (command wizelens-cloud, default port 5970) is the hosted service. It serves the same dashboard,
answers mode: "cloud" with capabilities: ["environments", "registry", "accounts", "alerts", "sharing", "serverStats", "metrics", "serverMetrics", "search", "changes", "issues", "infra", "uptime", "statusPages", "sourcemaps", "slos", "saved", "tags", "settings", "packages"]
(packages only while OSV checks are on),
and keeps data in Postgres (DATABASE_URL=postgres://...). PGlite (pglite:<folder> or memory) runs the same SQL in-process,
for tests and trials.
Tenancy and access
Accounts, sessions, organizations, members, and invites are Better Auth 1.7 (pinned), mounted at
/_wizelens/api/auth/*. The cloud keeps only what Better Auth has no place for: projects, ingest and read keys, share links,
retention, and the audit log.
- Organizations hold projects. People join organizations with a role:
owner,admin,member,viewer. Viewers read. Members also make alerts, tags, and share links. Admins also manage projects, keys, members, and invites. Owners also manage owners and delete the organization. The roles are plain data in@wizeworks/lens-core(ACCESS_STATEMENTS,ROLE_GRANTS); the cloud and the dashboard both build Better Auth access control from it. An organization always keeps one owner: Better Auth checks it, and a deferred database trigger (members_keep_owner) refuses any change that would leave none. - Sessions: email and password, or a passkey. Sessions live in the database only (no cookie cache), so signing out a device, a
password reset, or a removed member takes effect on the next request. Cookie
wizelens.session_token(__Secure-prefix on https): HttpOnly,SameSite=Lax,Path=/_wizelens, 14 days, renewed daily. Better Auth checks theOriginof every change against the public URL; the cloud also needsX-WizeLens-Client: dashboardon every change, so another site cannot send one. - Two-step sign-in: codes from an authenticator app (TOTP, 6 digits, 30 s) with 10 one-time backup codes, both stored encrypted
with the auth secret. After 10 wrong codes the account waits 15 minutes. A device can be trusted for 14 days. Passkeys must check
the person on the device (
userVerification: "required"), so they count as two factors and skip the code. - Passwords: 12 to 128 characters, scrypt. Hashes from before Better Auth (
scrypt$…) still verify and are replaced at the next sign-in. With--check-pwned-passwords(default on with Postgres), passwords found in known breaches are refused (only a 5-character SHA-1 prefix leaves the server). - Email (with
--resend-api-keyor--smtp-url): sign-up sends a confirm link, and sign-in waits for it. Password reset links last 30 minutes, once, and end every session. A new email is confirmed by the old address first, then the new one. Deleting an account is confirmed by email. Links open the dashboard (#/verify-email,#/reset-password,#/invite,#/delete-account, all with?token=). Without mail, emails are written to the log, nothing is confirmed, and invite sign-ups must carry the invite id (below).POST api/mail/resendtakes Resend's webhook (Svix signature, 5-minute window; 401 when it does not match, 404 without--resend-webhook-secret). A hard bounce (email.bouncedwithbounce.typePermanent) stops all mail to the address; a spam complaint (email.complained) stops all but account mail. Confirming the address by link clears it (tablemail_suppressions). - Notices and digests: security notices always go out. Team changes come from the audit log: a job takes new lines
(
audit.noticed,FOR UPDATE SKIP LOCKED, so instances never send twice) and emails owners and admins once per batch. Project health watches projects with data in 58 of the 72 hours before their last data, and tells managers after 2 quiet hours and when data is back (project_health). Digests (daily, weekly on Mondays, monthly on the 1st) go out at the person's local hour; each send is claimed first indigest_sends.GETandPATCH api/me/notificationsread and change{ team, health, digests, timeZone, digestHour, projects: [{ projectId, daily, weekly, monthly }] }.GET api/mail/unsubscribe?token=shows a stop button;POST(also the RFC 8058 one-click call) turns that mail off. The token is signed with the auth secret. - Sign-up: the first account needs the one-time setup token the cloud prints at start (
#/setup?token=, headerx-wizelens-setup-token; set it with--setup-tokenfor several instances). After that, people sign up with an open invite for their email (7 days), or anyone when the cloud runs with--signup open(they get their own organization). Without SMTP, an invite sign-up must also send the invite id (headerx-wizelens-invite). One gate (user.validateUserInfo) checks every method. - Invites: the invite id is the secret in its link. It opens only for a signed-in person with the invited email (confirmed, when
mail is on). No Better Auth route lists invites (
list-invitationsandget-full-organizationare off; without SMTP alsolist-user-invitations); owners and admins see them onGET api/orgs/{org}. - Limits: per client address, shared by every instance through the
rate_limitstable: sign-in 10 a minute, sign-up 5, two-step codes 10, reset and confirm links 3 per 5 minutes, SSO provider changes and DNS checks 5, everything else 120 a minute (429 above). The client address is the socket, or with--trust-proxythe lastX-Forwarded-Forentry; address headers the client sends are dropped. - Secret:
--auth-secretsigns sessions and encrypts 2FA data (required with Postgres; a PGlite trial makes one and keeps it in its database).2:new,1:oldrotates: encrypted data still opens, but everyone signs in again. Better Auth telemetry is off. - Single sign-on (Better Auth's SSO plugin): owners and admins connect their organization's identity provider with OIDC
(PKCE always) or SAML 2.0 (signed assertions always; responses must answer our request, carry timestamps, and use no SHA-1).
A provider belongs to one organization and signs nobody in until its email domain is proven: a DNS TXT record
_wizelens-sso-<providerId>.<domain>with the token fromsso/request-domain-verification, checked bysso/verify-domain. New accounts come only for emails at exactly that domain (the sign-up gate checks it, also with--signup invite); they start confirmed and join the organization as members, on any sign-in while they are not in it (auth/sso-join.ts). Someone removed from it, or who left, is kept out (tablesso_removed, auditsso.join_refused) until they accept a new invite; a pending invite is left to the invite. An existing account links only when its own email is confirmed. The cloud fetches OIDC settings, tokens, and keys only from origins in--sso-origins(SAML needs none). Removing a provider removes its sign-ins (triggersso_providers_accounts_go). Changes are in the audit log (sso.create,sso.update,sso.delete,sso.verify), without secrets. SSO sign-in skips our two-step codes: the identity provider does that part. Require single sign-on (PATCH api/orgs/:org/sso/:provider {required}, managers, Business, proven domain only; columnsso_providers.sso_required): non-owners at the domain lose their sessions, and password sign-in, sign-up, password reset, and any session made outside the provider's routes are refused (SSO_REQUIRED); owners keep their password. An account at the domain whose email was never confirmed is linked on its SSO sign-in (Better AuthresolveUser), marked confirmed, and loses its password and passkeys (owners keep theirs). Auditsso.require.--dns-serverspoints the domain proof at private DNS. Renewal (auth/sso-recheck.ts, job every 5 minutes): each OIDC account with a live session renews its refresh token at the provider's token endpoint (an--sso-originsorigin; client_secret_basic or _post).400 invalid_grantends all the person's sessions, their OAuth grants in the provider's organization, and the stored tokens (auditsso.signed_out, actorsystem); any other answer changes nothing. SAML sign-ins are not renewed. - Leaving: an account cannot be deleted while it is the last owner of an organization with other members. Organizations it is
alone in are deleted with their data. An owner deletes an organization with
DELETE api/orgs/{org}and the password. - Keys (only their SHA-256 hash is stored; the prefix tells what they are):
wl_ik_…ingest key: one project. Add-ons send it asWIZELENS_TOKEN; OTLP apps asAuthorization: Bearer …. The project comes from the key, never from the sender. At most 1200 calls per key per minute (429 above).wl_rk_…read key: one or more projects, read-only. For scripts, CI, and agents with no person to sign in.
- Connected apps (OAuth 2.1 for MCP clients), Better Auth's OAuth provider plugin (
@better-auth/oauth-provider, pinned with Better Auth). An MCP client (Claude, Claude Code, Cursor) gets a 401 frommcpwithWWW-Authenticate: Bearer resource_metadata="…", scope="wizelens:read offline_access", reads the protected resource metadata (RFC 9728) and the authorization server metadata (RFC 8414, issuer<public-url>/_wizelens/api/auth), registers itself (RFC 7591, open, public clients withtoken_endpoint_auth_method: none), and signs the person in with PKCE (S256). Better Auth sends the browser to#/oauth(sign in) and#/oauth-consentwith a signed query in the hash. On the consent page the person picks one organization and all its projects (also later ones) or some;POST api/auth/wizelens/oauth-grant(a sign-in from the last 15 minutes) saves that grant (oauth_grants), thenPOST api/auth/oauth2/consentties the consent and every token to it (reference_id, claimwl_grant). One scope,wizelens:read;offline_accessis always added, so a scheduled agent keeps access. Tokens are opaque and stored hashed: accesswl_at_…(1 hour), refreshwl_rt_…(30 days, rotated on each use). A new grant from the same person to the same app ends the older one. Every MCP call checks the grant, the person's membership (any role reads), and the projects again, so leaving the organization or removing the app stops it at once. Audit:app.connect,app.disconnect, andmcp.callwithapp. Expired tokens, grants never consented to (a day), ended grants (90 days), and apps nobody connected (a day) are pruned. Client CRUD, introspection, userinfo, and consent routes of the plugin are off; limits: token 600 and register 60 per minute per address. - MCP origin (
--mcp-url https://mcp.example.com,WIZELENS_CLOUD_MCP_URL): another origin a proxy sends to MCP (/and/mcpto/_wizelens/mcp,/.well-known/*as is). Requests on that host get its metadata (resourceis the origin, or<origin>/mcp) and itsresource_metadatapointer; sign-in stays on the public URL. The hosted cloud useshttps://mcp.wizelens.com. - SCIM provisioning (Better Auth's SCIM plugin,
@better-auth/scim): an admin makes awl_sc_…token for the organization (hashed inscim_tokens); the identity provider calls<public-url>/_wizelens/api/auth/scim/v2with it. Each token is one connection (org-<id>) whose provisioning domain is the organization. A user it creates or activates becomes amember; a deactivated one leaves the organization (owners stay) and loses its sessions. An existing account is linked only when its email is confirmed and it is already a member or at the organization's proven SSO domain. Changes writescim.user.*andscim.group.*(actorscim:<token id>); tokens writescim.token.createand.revoke. - Audit log: org changes, member and invite changes (also those through Better Auth), keys, projects, shares, and every MCP tool call, with who did it. Every role reads and exports it; each export is logged.
Endpoints (below /_wizelens/)
| Method | Path | Who |
|---|---|---|
| GET | api/ |
Anyone: { signedIn, needsSetup, signup, mail, sso, billing, user?, sessionId?, orgs?[] with projects and plan, blockingOrgs?, soloOrgs?, prefs? }.sso: some provider has a proven domain.billing: the cloud bills through Stripe; off, every plan is unlimited.soloOrgs: organizations deleted with the account.prefs: the Preferences page's theme, range, tz, and clock |
| PATCH | api/ |
Signed in: keep the Preferences choices sent (theme light, dark, or system; range a time range; tz local or utc; clock 12 or 24) on the account; answers all of them. |
| GET | api/ |
Anyone with the link: { orgName, email, role, inviter } |
| * | api/ |
Better Auth: sign-up, sign-in (email, passkey), two-factor/, sessions, password, email, delete-user, organization/ (invite, accept, roles, remove, leave), sign-in/, sso/ (register with organizationId, providers, update, delete, domain proof; owner or admin).organizationId on every organization/ change |
| POST / |
api/, api/ |
Signed in; read: any member; name and retention: admin; delete (with password): owner |
| POST / |
api/, …/ (deletes data only) |
Admin |
| POST / |
api/ |
Admin. |
| GET | api/, …/, …/ |
Any role (an auditor is often a viewer) |
| GET | api/, api/, api/, api/ — all with ?project= (or ?project=) |
Member or read key.api/ joins other projects (see "Traces across projects"); project= reads every project the caller may (see "All projects") |
| PATCH | api/ |
Admin.{ logRetentionDays }: 1 to 400, or null to follow the organization; more days than the plan keeps answers 402 with the plan it needs.logRetentionDays) and writes project. to the audit log |
| POST | api/ |
Admin.{ removed } and writes service. to the audit log |
| GET | api/ |
Viewer or read key.{ gaps: [{ startMs, endMs }] }: times of 2 minutes or more the service sent nothing, not even a heartbeat (endMs null while it still sends nothing). |
| GET | api/ |
Member or read key.metrics is a page too.project=: every project the caller may read (see "All projects") |
| GET | api/, /, /, /, / |
Member or read key: every readable project's rows, each with projectId and project (its label).api/ |
| POST | api/ |
Member who can write: a labeled error group's change lands in its project; an insight's in every project the caller may write |
| GET / |
api/ |
The list holds the organization's own items (projectId "") and every readable project's; only the organization's own change here (member who can write; owner, or admin to delete a shared one) |
| GET / |
api/, …/ |
Read: viewer; change: member |
| POST / |
api/ |
Read: viewer; change: member |
| GET / |
api/ |
Read: viewer or read key (UptimeList); add: member (audited uptime.) |
| PATCH / |
api/ |
Member (audited uptime., uptime.) |
| POST | api/ |
Member. |
| GET / |
api/ |
Read: viewer ({ enabled, title?, createdMs?, views? }); on or new link ({ title }, answers { url, title } once), rename, off: member (audited status., status.) |
| GET | api/ |
Anyone with the link: StatusPageView |
| GET / |
api/ |
Read: viewer or read key (editable says if the caller may change); change: member (the tag permission).tag., tag., tag., tag., or tag. to the audit log |
| POST | api/ |
Viewer or read key; see "Tags" |
| GET | api/ |
Anyone with the link: { trace, expiresMs }, or for a page link { page, title, params, model, createdMs, expiresMs } |
| GET / |
api/ |
Read: viewer (own and shared items); add: member; change: the owner; delete: the owner or an admin |
| POST | api/, api/, /, /, / |
Ingest key |
| OPTIONS / |
b/ |
Browser key (wl_) in the path, from a page whose Origin is one of the key's sites; CORS answers that site only.api/ (any content type, so pages post plain text and skip the CORS check).service and category "browser", never server kind) and every line as a browser line. |
| PATCH | api/ |
Admin.{ origins }: a browser key's sites, changed in place (audited key.) |
| POST / |
api/ |
Ingest key: upload one map to the key's project, or list them (see "Source maps") |
| POST | api/ |
Member or read key: { stack, release } → { frames } |
| POST | mcp?project= |
Read key or connected app (OAuth access token).?project=, a reader with one project reads it; one with several adds list_ and a project argument (id or name) on every tool.project reads every project together (services as "service · project"); get_, get_, group_, and list_ report one entry per project |
| GET | /, / |
Anyone (CORS open). |
| * | api/ |
Better Auth's OAuth provider: authorize, token, register, revoke (apps post without the dashboard header), consent, continue, public-client |
| POST | api/ |
Signed in within 15 minutes: { organizationId, allProjects, projectIds, oauth_ from the consent page.{ id } |
| GET / |
api/ |
Signed in: the apps this person connected ({ apps: [{ id, app, clientId, orgId, orgName, userEmail, allProjects, projects, createdMs, usedMs }] }), or end one |
| GET / |
api/ |
Admin: every app connected in the organization, or end one |
| GET | api/ |
Any member: { billing, plan, includedGb, maxRetentionDays, month, monthGb, days[{ day, gb, bytes, spans, logs, points }], overageUsd, projectedGb, projectedOverageUsd, spendCapUsd, blocked, reason, subscription, plans[] } (see "Plans and billing") |
| PATCH | api/ |
Owner, billing on, Team or Business: { spendCapUsd: whole dollars or null } |
| GET | api/ |
Any role, plan with audit export (402 otherwise): the whole log as a download; writes audit..time_: people by name and email (also former members), projects and keys by name |
| GET / |
api/, …/ |
Admin: { allowed, plan?, baseUrl, tokens }; a new wl_ token is in the answer once (402 without SCIM on the plan) |
| * | api/ |
SCIM 2.Users, Groups, ServiceProviderConfig, Schemas, ResourceTypes, with Authorization: Bearer wl_ (no dashboard header) |
| * | api/ |
Better Auth's Stripe plugin, billing on: upgrade, cancel, restore, list, billing-portal, each with customerType: "organization" and referenceId (owner or admin); success (Stripe's redirect back) |
| POST | api/ |
Stripe, signed (Stripe-Signature, --stripe-webhook-secret); 404 with billing off |
Page models (serverStats)
Every dashboard page is one definition in @wizeworks/lens-core (PAGES: overview, requests, traces, database, rendering,
errors, logs, log-patterns (the top 50 patterns of the Logs filter, with counts, change, and trend), log-chart (the lines of
one log search per bucket, its total, and its change), services, service, insights, problems, uptime, and badges, the sidebar
counts). problems is described under "Problems" below. uptime reads the svc.ep rollups of the wizelens-uptime service:
runs, failures, and average response time per check (check: one check id), per bucket, and in total against the window before.
service is the full page of one service
(service: a Services row key such as api:orders, or a name): its numbers against the window before, traffic and latency over
time, endpoints, callers, and for APIs and workers the top error groups, slowest requests, and newest log lines. A page says what it needs from its URL parameters (filters,
sort, page, selected item): rollup groups and series over the chosen window and the window before it, list rows, or one trace.
An executor answers those needs and the page builds a JSON object from the answers. In-app hosts answer them in the browser from
the loaded traces; hosts with serverStats answer them on the server, so ranges reach 7d and 30d. Lists in a model are capped
at 200 rows (Requests and Logs page through all rows). Request rows in models carry no findings. meta.sampled is always
null; meta.settling is the number of traces whose stats run behind: written over 60 seconds ago (SETTLE_BEHIND_MS) and
not settled yet (null when none). Every new trace waits a few seconds on purpose, so those are not counted. The dashboard says
"Stats are catching up" while it is above 0, and search's settling uses the same rule. The cloud caches answers for 15 seconds; the hub until its stats change.
Period. Every page (and api/models/metrics) also takes from and to (epoch ms) for a custom window; range then
names the smallest preset that covers it, and hosts refuse a window that starts before what they keep. compare=week
compares with the same window a week earlier instead of the window right before. meta.custom and meta.compare say
which; meta.compareLabel reads "vs. previous period" or "vs. same time last week". The dashboard keeps range, from,
to, compare, env, project, and service in the address bar, so a link opens the same view.
Traffic. traffic (service: a row key or name, endpoint, buckets: 16, 24, or 48, default 24) is for agents
(get_timeseries, group_requests): scope, bucketMs, points (requests, errors, error rate, average, and p95 per
bucket), totals, and endpoints (every endpoint of the APIs and web apps in scope, up to 100 services and 200 endpoints
each, busiest first). scope.found is false for a service with no traffic in the window.
Detail pages. error (group: a group key), endpoint (service: a row key or name, endpoint), query (q: a query
shape), and route (route) give one item's numbers over time, where it happens, and its newest traces (from the row's
newest trace ids). The dashboard shows them at #/errors/<key>, #/services/<service>/endpoints/<endpoint>,
#/database/queries/<query>, and #/rendering/routes/<route>.
Filters. Every page but Services and Service takes service (a display name: "Web App" for the browser), and its cards,
charts, and lists count that service only: requests and traces that went through it, and the queries, errors, and log lines
it wrote. The dashboard sends the service chosen in the top bar unless the link names one. Page filters, all in the URL:
| Page | Parameters |
|---|---|
| errors | type, endpoint, critical=, q, sort (recent, count), page, size, group.service only |
| database | q, table, operation, database, sort (avg, count, total), page, size |
| traces | status (error, ok), duration (as Requests), q, sort (time, duration), page, size, trace.trace, the first listed trace shows |
| logs | level, exact= (that level only), category, trace, q, page, size |
| requests | as before, plus endpoint (exact), user, insights=, and sorts errors and db |
| insights | area, impact, q, endpoint, key |
| rendering | q (route or component name) |
Stats tables (hub and cloud)
Pages read small tables built from the stored traces, never the traces themselves (only selected traces are read whole).
- Facts, one set per trace:
fact_requests(a request row without findings),fact_traces(a Traces list row),fact_logs(log lines),fact_critical(the 5 slowest spans of each trace). Lists filter, sort, and page these. - Rollups: what a trace adds to every grouping a page shows (
kind,key), summed per time bucket in three tiers:rollup_10s(kept 6 h 10 min),rollup_5m(kept 50 h),rollup_1h(kept for the retention). Each row hasn,err,sum_v, countersc0..c5,first_ms,last_ms, and one representative (top,top_rank) and newest trace ids (ids).hist_<tier>holds a log-bucket histogram per row (bins 4% wide, so percentiles are within 2%). - A query reads the coarsest tier that still gives a window enough buckets, and finer tiers at the window's edges; an edge bucket that no kept tier can split is weighted by its overlap. Series place each tier bucket by its midpoint, or spread it over the page buckets it overlaps when page buckets are not whole tier buckets.
- Settling: a trace is settled when it has been quiet for 5 seconds (or every 30 seconds while it keeps changing): its facts
are rebuilt from its spans and logs, and the rollups get its new contribution minus the old one (kept as JSON in
traces.contrib).settled_msis set to theupdated_msthat was read, so a late span settles the trace again. Representatives, first and last times, and ids are display fields and are never taken back out. - Query spread (
FACTS_VERSION14):db.qanddb.qdkeep histograms, so the Database list, its CSV, and the Query page show each query shape's p95 next to its average and max. - One version fact (
FACTS_VERSION8): thesvc.vkind (traces per service and version, added in 7 for Problems) is gone; Problems readsrelbelow, so one release fact feeds markers, compare versions, and "new release" causes. - Releases (
FACTS_VERSION5):relcounts each span that starts work in its service (no parent, or a parent in another service) underservice|version, from the span'sservice.version, with a histogram. Hosts copysender.releaseonto the sender's spans that have no version (OTLP: the resource'sservice.version).HubSender.versionstays the add-on's own version. Every page'smeta.releaseslists the versions first seen in its window (chart markers); the Service page hasversions(requests, error rate, p95, and error groups first seen while each was the newest); Errors and Insights takereleasewithservice(groups first seen while that version was the newest) and return the service'sreleases. - Endpoints (
FACTS_VERSION4):ep.callandep.qfile each outgoing call and query under the endpoint (svc.epkey head) whose http.server span it ran under.svc.epandedgekeep histograms (p50/p95/p99), andsvc.ep,db.q, andpv.routekeep their newest trace ids. List needs taketraceIds. - Per-service copies (
FACTS_VERSION3): the kinds inSCOPED_BASE(req,req.part,trace,ins,ins.ep,bn.*,db*,err,err.t,err.e) also write a<kind>@svcrow keyed by the service first. A need withservicereads that copy and gets its keys back without the service.db.qdkeys a query shape by operation and database first. Group needs can also filter keys by text (contains, ASCII case-insensitive), keep rows over a value (having), and skip rows (order.offset). - The slow query threshold is fixed when a trace settles (100 ms).
FACTS_VERSIONin@wizeworks/lens-corenames the fact rules: when it changes, a host clears its stats and rebuilds them (hub:meta('facts'); cloud:scale_meta('facts')). - Times are those of each item (request start, span start, log time), so an item near a window edge counts where it happened.
- Metric rollups (
metric_series,metric_10s/5m/1h) use the same tiers and reads, but are written when points arrive, not by settling, since points never change (see "Metrics").
Alerts
The hub and the cloud both run alert rules (the hub sends no email). A rule watches one metric over a window (5 min to 24 h),
optionally in one environment, and for trace metrics optionally one service (display name) or one endpoint of it
("GET /api/orders/{id}"; slow_queries is per service only): error_rate (%), p95_ms, avg_ms, requests, new_errors
(error groups not seen in the window before), slow_queries, new_security_risks (security risks, sec keys, not seen in
the window before; per service only), and log_count (lines that match the rule's logSearch, the Logs
page filters, for example { "level": "error", "q": "timed out" }; no service or endpoint, the search names its service). It
fires when the value is above (>), at or above (>=), below
(<), or at or below (<=) the threshold. No data never fires, except requests below (traffic stopped). Rules run every minute.
A notice is sent when the state changes (fired, resolved), and again every remindMs (15 min, 1 h, 4 h, or 1 day; 0 for never)
while it keeps firing and nobody acknowledged it. POST …/:id/ack acknowledges a firing rule (reminders stop until it resolves);
POST …/:id/mute with { untilMs } mutes it (-1 until unmuted, null unmutes): its state still changes, quietly. Turning a rule
off clears its state. Each check keeps its value (30 days); GET …/:id?from=&to= returns the rule, its events, and those values.
A rule sends to up to 5 channels: a webhook (the JSON notice), a Slack, Microsoft Teams (a MessageCard), or Discord incoming webhook,
PagerDuty ({ "kind": "pagerduty", "routingKey": "…" }, Events API v2: fired and reminders trigger one incident per rule, resolved
resolves it, a test triggers and resolves its own key), or email (cloud: { "kind": "email", "to": [...] }: 1 to 20 addresses of
members of the organization, confirmed ones when mail is on, checked again at each send). Every notice, mute, and acknowledgement is
kept as an event (fired, resolved, remind, test, ack, mute, unmute).
The message says what happened: Requests is 79 (above 5) when fired, (no longer above 5) when resolved, (still above 5) for a
reminder, and (alerts when above 5) for a test notice. PATCH changes only the fields it sends.
Webhook URLs must be https and may not resolve to private, loopback, or link-local addresses, unless the cloud runs with
--allow-private-targets (self-hosting on a private network). The hub allows them by default (it runs on your own network).
Above normal (op: "above_normal") works on error_rate, p95_ms, and requests. The threshold is the sensitivity: how
many spreads above normal (2 high, 3 medium, the default, 4 low; 1 to 10 allowed). The rule judges every Services row and every
endpoint over its window against the same window in earlier weeks (see "Problems") and fires when any one is above normal;
its value is that one's value. The message names it: p95 duration is above normal on pay POST /api/charge: 412 ms (normal 31 ms, alerts above 46 ms). A notice carries baseline: { normal, upper } for these rules (else null). In the cloud, every fired or reminder notice also carries
problem: { id, title, cause, url } (or null): the problem near that time on the Problems page (on the breaching service, for
above normal rules), with the suspected cause in one sentence and a dashboard link (#/problems?project=&problem=&at=&service=).
Slack and email show it; events keep it (problem: { id, title, url } | null in GET api/projects/{project}/alerts).
Problems
The problems page model finds anomalies with plain statistics, no model or training:
- Baselines per Services row (
svc) and per endpoint (svc.ep) for error rate (%), p95 (ms), and traffic (count per bucket), read from the rollups. Buckets sit on a fixed grid (1 min for 15m, 2.5 min for 1h, 15 min for 6h, 30 min for 24h, 4 h for 7d, 12 h for 30d) from the bucket holding the window's start to the one holding now, so ids stay put as time moves. Each bucket is compared with the same bucket in the 4 weeks before (the same hour of the week). While fewer than two of those weeks have traces, it uses the 6 days before (the same hour of the day), for hosts that keep less. A key needs two earlier windows with data before it is judged; until the page has two,baseline.learningis true. - Above normal: value > mean + k × spread, with k from
sensitivity(high 2, medium 3, low 4) and the spread the larger of the samples' standard deviation and a floor (traffic: √mean and 10% of the mean; error rate: the binomial deviation and 0.5 points; p95: 10% of the mean and 5 ms). A bucket needs 10 requests (traffic), 5 failures (error rate), or 10 items (p95). Consecutive buckets above normal make one anomaly; it is ongoing while it reaches the newest bucket (or the one before, while the newest has too little data). - Problems: anomalies that start within 15 minutes (or two buckets) of each other on the same service, or on services
joined in the call map (
edge), become one problem. Its suspected cause, most telling first: a release (arelversion first seen up to that span before the start, or in the first bucket, and not seen in the week before the window), a new error group (first seen near the start, not in the week before), a query (an endpoint of a database row above normal), or a downstream service (called by others in the problem, calling none of them). - Params:
sensitivity,problem(an id), andat(ms) withservice(a row key or name) to find one from a link. The model:{ meta, baseline: { mode: "week"|"day", samples, learning }, sensitivity, starts, bucketMs, problems (50 at most, ongoing then newest), total, ongoing, anomalies, services, selected }. A problem:{ id, title, metric, startMs, endMs, ongoing, services[], anomalies (20 at most, furthest over first, each with its peak and per-bucket values, normals, and lines), anomalyCount, cause, causes[] }.
A rule can also watch one OpenTelemetry metric: metric: "metric", metricName (required), metricStat
(last, avg, max, p95, p99, or rate; default avg), and metricService (optional). The threshold is in the metric's
base unit (seconds, bytes, or 0 to 1 for ratios). Counters read as a rate per second; histograms read from their merged buckets.
Rules read the metric rollups over the window ending at "now" rounded down to 10 seconds. Gauge p95 and p99 are taken over the
bucket means of the finest tier that covers the window (10 s up to 6 hours, 5 min beyond), so they can sit slightly below the
percentile of the raw values. No data never fires.
Traces across projects
One trace can cross projects, for example a front end in one project calling a shared API in another. api/traces/{id}
answers the asked project's part plus the parts of the same trace id in the other projects the caller may read:
- Same organization only. Projects of other organizations are never read, even when the caller belongs to both.
- A person sees every project of the organization that a project role does not hide (
none). A read key or connected app sees only its own projects (checked again against the organization on every call, so a key row that names a foreign project still gets nothing from it). - 404 when the asked project has no part of the trace, so a project cannot be used to probe others.
join=falsereturns the asked project's part only. Withproject=all, every part in the caller's projects.
All projects
The cloud reads every project of one organization at once with ?project=all&org=<organization id> on the data
routes (traces, one trace, services, page models, metrics, hosts, Kubernetes, search, suggest, tags, changes, source
map resolve), and api/orgs/{org}/… for alerts, issues, SLOs, uptime, shares, and saved items.
- Which projects. A person reads the organization's projects a project role does not hide; a read key or connected app its own. 404 when that leaves none, or the caller is not in the organization.
- One organization, three locks. Every telemetry row carries its organization (
org_id). Every read names the organization and its project list, and the code refuses one without both. Reads run as a reader the database holds to the named organization: ClickHouse row policies ongetSetting('SQL_wl_org'), Postgres row level security onwl.org. A read without an organization fails; a foreign project id reads nothing. - Same-named services stay apart. With more than one project, rollup rows named by a service (services,
endpoints, edges, error groups, log groups, releases, per-service kinds) group by project and show as
"api · Shop" (the project's name, or "name (slug)" when two share one). Other rows (levels, layers, routes,
queries) add up across projects, as environments do. A filter that names a labeled service reads its project only.
List and search rows carry
projectand label their services. - Per-project state. Issue states and Apdex targets key on the labels; tags of every project apply (a name two use keeps the first). Retention is the longest of the projects; thresholds are theirs when they agree, else the cloud's.
- One project only. Settings, tag rule changes, source map uploads, Apdex targets, the status page, and share links belong to one project.
- MCP
get_tracejoins the same way for its read key or connected app (federate: false: the asked project only).
Sharing
A share link (#/shared/<token>, 1 to 30 days) opens one trace, or one page, read-only, for anyone with the link. It can be
revoked. A page link (POST …/shares with page, range, params, env, and title) keeps the page's model as it was when the
link was made (at most 2 MB): Overview, Requests, Errors, an error, Database, a query, Logs, Insights, Rendering, a route,
Services, a service, an endpoint, and Traces. api/shared/{token} answers { page, title, params, model, createdMs, expiresMs }.
Views are counted. Nothing else is reachable with the token. The trace is joined as far as the link's maker may read at
the time it is opened: after the maker leaves the organization, the link shows only the shared project's part.
Uptime checks
Hubs and the cloud call URLs on a schedule (uptime capability). A check (UptimeCheckInput in @wizeworks/lens-core, the same
rules on both): url (http or https, no credentials in it), method (GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS), headers
(up to 20), expectStatus ("200", "200-299" (default), or a list like "200,301-302"), expectBody (text the body must
contain; not with HEAD), intervalMin (1 to 60), timeoutMs (1 to 60 s), env, enabled, and name. At most 100 per project
(hub: per hub). Redirects are followed (up to 5) unless expectStatus names a 3xx code. The body is read up to 1 MB.
- A run passes when the status matches and the body holds the text. It keeps
state(pendinguntil the first run,up,down), the last status, time, duration, error, and the end of the TLS certificate (tlsExpiresMs, https only; read by a bare handshake that sends nothing when the certificate itself is refused). Checks run every 15 seconds when due; each due check is claimed first (cloud:FOR UPDATE SKIP LOCKED), so replicas and slow runs never run it twice. - Results are telemetry. Each run is one trace with one span of category
uptime(kindclient) of the servicewizelens-uptime, written through the normal write path in the check's project and environment:http.request.method,http.route=/uptime/{checkId},url.fullandurl.pathwithout the query string,server.address,http.response.status_code,wizelens.uptime.check_id,wizelens.uptime.check_name,wizelens.uptime.ok, and with TLStls.server.not_afterandwizelens.uptime.tls_days_left. A failed run has statuserror, the reason asstatusMessage, and an error log line (noexceptionevent); a certificate within 14 days of its end (TLS_WARN_DAYS) adds a warn log line. Runs are not app traffic: requests, the Traces list and its cards, services, errors, and Problems skip every span withwizelens.uptime.check_id(also runs written before ashttp.serverspans). Theup(all checks) andup.chk(by check id) stats feed theuptimepage; Search (its Spans and Logs tabs) and Logs still find runs, and a run opens by its trace link (FACTS_VERSION19). - Incidents: a run that fails after a passing (or pending) one opens an incident with the reason; the next passing run closes it at its start. Turning a check off closes its open incident. Uptime for 24 h, 7 days, and 30 days is the share of time since the check was made not covered by incidents, so it does not depend on trace retention. Incidents are kept 90 days.
UptimeList:{ checks: (UptimeCheck & { uptime: { "24h", "7d", "30d" } })[], incidents: (UptimeIncident & { checkName })[], nowMs }. Header values whose names look secret (authorization,cookie,token,api-key, ...) show as[redacted]; sending[redacted]back keeps the stored value. The cloud stores headers encrypted with the auth secret (v<version>:<ciphertext>).- Private addresses: cloud checks may not reach loopback, private, link-local, carrier-grade NAT, multicast, or reserved
addresses, checked when a check is saved and again at every connection (also after redirects and DNS changes), unless the cloud
runs with
--allow-private-targets. Hubs may reach any address their machine can;--no-uptimeturns checks off. - Status pages (cloud,
statusPages): off by default. Turning one on makes awl_st_token (only its hash is kept); a new link stops the old one.#/status/<token>shows the title, each enabled check's name and state, uptime for 24 h, 7 days, and 30 days, one bar per UTC day for 30 days, and incident times of the last 30 days: never URLs, headers, or error text.
Retention
Each organization keeps traces for retention_days (default 30, 1 to 400). Older traces are deleted every 10 minutes. Each
project keeps log lines for projects.log_retention_days (1 to 400; null follows the organization): the same job drops loose
batches, raw log rows, log facts, log search rows and attributes, and the log kinds' rollup buckets past it, and the 1 h tier ages
only the other kinds by the organization's retention.
POST …/projects/{id}/clear deletes a project's data now.
Plans and billing
Billing is off unless the cloud starts with --stripe-secret-key (then --stripe-webhook-secret and --stripe-prices,
JSON of teamMonthly, teamAnnual, businessMonthly, businessAnnual, overage, meter, are required, and so is
--public-url). Off, every organization is unlimited: no caps, no gates, no billing UI. Plans live in
cloud/src/billing/plans.ts:
| Plan | Included GB a month | Retention max | Overage | SSO, SCIM, audit export |
|---|---|---|---|---|
free |
10 (then 429) | 14 | no | no |
team |
50 | 30 | yes | no |
business |
150 | 90 | yes | yes |
enterprise |
orgs. (none: no limit) |
orgs., at most 400 |
no | yes |
unlimited |
none | 400 | no | yes |
- Usage: the request body of
api/ingestand OTLP as sent (before gzip is undone), counted only when accepted, plus spans, logs, and metric points, per organization per UTC day inusage_daily. Counters flush every minute and at shutdown. A GB is 10^9 bytes. Months are calendar months in UTC. - Free cap: at the included GB, ingest and OTLP answer 429
{ error: "This organization reached the Free plan's 10 GB for this month. …" }withRetry-After: 3600until the 1st or an upgrade. Spend cap (Team, Business): pastspend_cap_centsof overage, 429 "This organization reached its monthly spend cap of $N. …". The first block of a month writesingest.blocked. Mail to owners and admins at 80% and 100% of the included GB and at the spend cap, once a month each (usage_notices). - Overage: graduated on the GB above the included GB each month: 500 GB at $0.30, 1,500 GB at $0.20, then $0.10.
- Gates: SSO provider setup (
sso/register,sso/update-provider) answers 402PLAN_REQUIRED; SCIM tokens stop working and their routes answer 402; audit export answers 402 with{ plan }. Retention above the plan's maximum answers 402; a plan change lowers retention to the new maximum. - Stripe (Better Auth's Stripe plugin, the organization is the customer and the subscription's
reference_id): Checkout starts Team or Business, monthly or yearly; the customer portal changes, cancels, and holds cards and invoices. Webhook events (checkout.session.completed,customer.subscription.created|updated|deleted) updatesubscriptions, thenorgs.planfollows:active,trialing, orpast_duekeeps the paid plan (a failed payment keeps it through Stripe's retries); otherwise Free. Plans set by hand (enterprise,unlimited) stay without a subscription. Changes writeplan.change. A paid organization also gets a usage subscription: only the graduated metered price on thewizelens_gbmeter, monthly, anchored to the 1st (UTC), metadatawizelensRole: usage; the webhook handles its events itself (it is remade if it ends while the plan runs) and passes every other event to the plugin. Five minutes after each UTC day ends, the whole GB above the included GB since the 1st, less what was reported that month, goes to the meter as one event per organization and day (identifier: wl-<org>-<day>,usage_reports), so a rerun never bills twice. When the plan ends, finished days are reported, then the usage subscription is canceled with a final invoice. - Commands:
wizelens-cloud stripe-setupmakes the products, prices (lookup keyswizelens_team_monthly, …,wizelens_gb_overage), the meter, and the webhook, sets the default customer portal (plan switches between the Team and Business prices, cancel at period end, card, address, tax ID, invoices;billing/stripe-portal.ts), and prints the options. A switch to a plan with fewer days or features asks first and lists what stops (lossOf).wizelens-cloud plan set <org> <plan> [--gb N] [--retention-days N]sets a plan by hand (audit actorcli).
Cloud storage
Postgres, one schema, migrations in wizelens_migrations. Tables: orgs, users, members, sessions, invites, accounts,
verifications, two_factors, passkeys, rate_limits, cloud_meta, sso_providers, projects, api_keys, traces, spans, logs, services, metric_points, alert_rules, alert_events, shares, audit, tag_rules, tag_builtins.
Migration 2 added metric_points and the metric columns of alert_rules. Migration 5 added sso_providers. Migration 3 added the stats tables (see "Stats
tables"): traces.settled_ms and traces.contrib, scale_meta, fact_requests, fact_traces, fact_logs, fact_critical,
rollup_10s/5m/1h, hist_10s/5m/1h, metric_series, and metric_10s/5m/1h. The cloud settles every 3 seconds in batches
of 500, under a Postgres advisory lock so only one instance works at a time. Rollup buckets age out every minute; the 1 h tier
follows the organization's retention, and deleting traces past retention takes them out of the rollups first. Metric rollups are
written at ingest under row locks on metric_series (SELECT ... FOR UPDATE, in key order), so instances add up the same series
one at a time; their tiers age out with the 10-minute retention job (the 1 h tier and metric_series by the organization's
retention). Migration 4 moved accounts to Better Auth: its tables use our snake_case names (auth/schema-names.ts maps them), and
users, organizations, and members kept their rows and ids. Passwords moved to accounts, sessions started over, and open invites got
new ids (so new links). A test checks that Better Auth finds nothing to change in the schema, and Better Auth checks it again at start.
Data tables are keyed by project_id. Times are double precision epoch ms, except in Better Auth's tables (timestamptz). Our
secrets (keys, shares, status page links) are stored as SHA-256 hashes only; Better Auth stores reset and confirm tokens hashed. Migration 8 added
fact_search and fact_attrs (see "Search"). Migration 9 added OAuth for MCP clients. Migration 10 added issues. Migration 11 added the alert changes (see "Alerts"). Migration 12 added SLOs. Migration 13 added saved views and page shares. Migration 14 added billing:
orgs.plan (existing organizations unlimited), plan_gb, plan_retention_days, spend_cap_cents, stripe_customer_id,
overage_subscription_id; users.stripe_customer_id; Better Auth's subscriptions; usage_daily, usage_notices,
usage_reports; and scim_tokens (hashed wl_sc_…). Migration 15 added the SCIM plugin's tables in snake_case
(scim_users, scim_groups, scim_group_members, scim_subjects, scim_projection_grants, scim_identity_tombstones,
scim_connection_bindings); their provisioning domain is the organization id. Migration 16 added tag_rules
(per project, unique name) and tag_builtins (the built-ins a project turned off); they stay in Postgres in scale mode too.
Migration 17 added uptime_checks, uptime_incidents, and status_pages (see "Uptime checks"). Migration 18 added
sourcemaps (see "Source maps"). Migration 19 added fact_logs.pattern, projects.log_retention_days,
alert_rules.log_search, and saved_searches. Migration 20 added alert_events.problem (see "Problems"). Migration 22 moved
every saved_searches row into saved_items as a shared search of the Logs page with chart: true (owner: the user who saved
it), and dropped saved_searches.
Telemetry stores (small mode and scale mode)
Everything about spans, logs, metrics, and their stats goes through one interface (TelemetryStore, cloud/src/telemetry).
Postgres keeps accounts, organizations, projects, keys, the service registry, alerts, shares, and the audit log either way.
- Small mode (default): telemetry in the same Postgres or PGlite, as above. For self-hosting, trials, and tests.
- Scale mode (
--clickhouse <url>,WIZELENS_CLOUD_CLICKHOUSE_URL): telemetry in ClickHouse 26.8. Rawspans_rawandlogs_raw(ReplacingMergeTree by version),trace_headsand the rollup, histogram, and metric tiers (AggregatingMergeTree: sums add, extremes keep extremes,topisargMaxby rank,idsthe newest by time), and fact tables (ReplacingMergeTree with tombstones, so a trace settled again drops the rows it no longer has). Views with the Postgres names read the merged rows (FINAL), so the shared SQL (dialectch) answers pages, lists, searches, and metrics with the same results; the parity tests run the same cases on memory, SQLite, Postgres, and ClickHouse. Rows expire by TTL at their organization's retention (written with each row; a retention change moves it with a background mutation). Log rows (raw lines,fact_logs,logssearch rows, log attributes, loose batches, and the log kinds' rollup rows) expire by the project's log retention, never past the trace retention for a line in a request;project_retention.log_daysremembers it. One cloud process writes telemetry: its settle queue lives in memory and is rebuilt on start from the update log of the last 6 hours.wizelens-cloud copy-telemetrycopies a small-mode database into ClickHouse once (projects already there are skipped). Deployment:deploy/README.md, "ClickHouse". Every ClickHouse call of a process (or settle worker thread) takes one ofWIZELENS_CLOUD_CLICKHOUSE_CONCURRENCYslots (default 24); more calls wait in line, so no burst passes ClickHouse's own limit.