@softure-ai/observability
v0.8.8
Published
SOFTURE AI observability: a structured logger that writes to the console and to OpenTelemetry, and OTLP/HTTP export of traces, logs and metrics for Node.js processes and Next.js apps.
Readme
@softure-ai/observability
Logs, traces and metrics for Node.js processes and Next.js apps, shipped to any OpenTelemetry (OTLP/HTTP) backend:
- a structured logger: levels, attributes, child loggers, one line on the console, and an OpenTelemetry log record that carries the active trace and span ids (Logger);
- one call that starts OpenTelemetry in a process: tracer, logger and meter providers exporting over OTLP/HTTP
protobuf, the resource attributes the app chooses, server spans and a request duration metric for incoming HTTP
requests, spans for outgoing
fetch, and Node.js runtime metrics (Node.js, Metrics, Next.js); - an
onRequestErrorfor Next.js that logs every failed request with its route (Next.js); - a probe that proves the backend accepts a span and a log record, as a function and as the
softure-observability pingcommand (Verifying the export); - Grafana alert rules and a dashboard kept as code in the app, applied by
softure-observability grafana apply, with builders for the common rules (Grafana alert rules and dashboards).
The package carries no project, service or vendor names: the app passes them. With no endpoint configured nothing is exported and the loggers write to the console only.
Installation
npm install @softure-ai/observabilityInside this repository it is a workspace package.
Configuration
startObservability(options) (and registerObservability(options) for Next.js) takes:
| Option | Environment fallback | Meaning |
| --- | --- | --- |
| serviceName | OTEL_SERVICE_NAME, then service.name in OTEL_RESOURCE_ATTRIBUTES | service.name: the process, e.g. api |
| serviceNamespace | service.namespace in OTEL_RESOURCE_ATTRIBUTES | service.namespace: the project |
| serviceVersion | service.version in OTEL_RESOURCE_ATTRIBUTES | service.version |
| environment | deployment.environment.name and deployment.environment in OTEL_RESOURCE_ATTRIBUTES | both deployment.environment.name and deployment.environment, e.g. production |
| endpoint | OTEL_EXPORTER_OTLP_ENDPOINT | base URL; /v1/traces, /v1/logs and /v1/metrics are appended |
| — | OTEL_EXPORTER_OTLP_TRACES_ENDPOINT, OTEL_EXPORTER_OTLP_LOGS_ENDPOINT, OTEL_EXPORTER_OTLP_METRICS_ENDPOINT | per-signal URL, used as given |
| headers | OTEL_EXPORTER_OTLP_HEADERS (key=value,key2=value2, URL-encoded values) | headers of every export, e.g. Authorization |
| — | OTEL_EXPORTER_OTLP_TRACES_HEADERS, OTEL_EXPORTER_OTLP_LOGS_HEADERS, OTEL_EXPORTER_OTLP_METRICS_HEADERS | added to the headers of one signal |
| enabled | OTEL_SDK_DISABLED=true turns export off | false turns export off |
| instrumentations.fetch | — | spans for outgoing fetch (undici); default true, false in the Next.js adapter |
| instrumentations.http | — | server spans and http.server.request.duration for incoming requests, spans for outgoing http.request; default true, false in the Next.js adapter, see Incoming requests |
| instrumentations.runtime | — | Node.js runtime metrics (event loop, GC, heap); default true, see Metrics |
| metrics.enabled | OTEL_METRICS_EXPORTER=none turns metric export off | false exports no metrics; traces and logs stay; default true |
| metrics.exportIntervalMs | — | how often metrics are exported; default 60000 |
| traces.ignorePaths | — | paths whose incoming requests get no trace, e.g. ["/api/health"], see Health checks |
| traces.stableHttpAttributes | — | copies legacy HTTP server attributes onto their stable names; default false, true in the Next.js adapter, see Next.js |
| logLevel | SOFTURE_LOG_LEVEL | minimum level: debug, info (default), warn, error |
| errorDetails | — | full (default) or label, see Errors and personal data |
| handleSignals | — | flush on SIGTERM and SIGINT (at most 5 s), then end the process; default false |
Options win over the environment. Headers merge per key: per-signal variables over OTEL_EXPORTER_OTLP_HEADERS,
headers over both. A signal without an endpoint is not exported; with neither, nothing is.
A malformed value (an endpoint that is not a URL, such as localhost:4318 without http://, a header entry without a
key) throws at start with the name of the option or variable, never its value; in Next.js that stops the server from
starting, which is deliberate. An endpoint with a scheme other than http: or https: (Docker BuildKit sets
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=unix:///dev/otel-grpc.sock in every RUN step; grpc://) does not throw: that
signal is not exported, the start-up prints one warning naming the variable and the scheme, and the other signal keeps
its own endpoint. A per-signal variable is not replaced by OTEL_EXPORTER_OTLP_ENDPOINT then. A failed export (a wrong
token, an unreachable endpoint) is printed as an OpenTelemetry error on the console.
Secrets. The Authorization header is a credential: pass it from the environment (OTEL_EXPORTER_OTLP_HEADERS
or your own variable read into headers), never from code or a committed file. The package never prints headers;
its one start-up line names only the endpoint origin and service.name.
Example environment for a hosted OTLP gateway:
OTEL_EXPORTER_OTLP_ENDPOINT=https://otlp.example.com/otlp
OTEL_EXPORTER_OTLP_HEADERS=Authorization=Basic%20<base64 of instance-id:token>Node.js
Start it once, before the work begins:
import { createLogger } from "@softure-ai/observability";
import { startObservability } from "@softure-ai/observability/node";
const observability = startObservability({
serviceName: "worker",
serviceNamespace: "my-project",
environment: process.env.APP_ENVIRONMENT,
handleSignals: true,
});
const logger = createLogger("worker");
logger.info("started");
// A script that ends on its own: flush before it exits.
await observability.shutdown();A second startObservability in the same process returns the first handle (and warns once).
environment is written under both deployment.environment.name and deployment.environment, the keys
SOFTURE.Common.Observability (.NET) writes, so a dashboard filtering on either label (deployment_environment or
deployment_environment_name in Prometheus) matches Node.js and .NET services alike.
handleSignals: true flushes on SIGTERM and SIGINT for at most 5 seconds. When the app has no listener of its own for
that signal, the package then re-raises it and the process ends as it would have; when the app listens to it itself,
ending the process stays the app's job (call shutdown() in that listener to wait for the flush).
Scripts and one-shot processes
A migration, an ops script or a cron run does one job and ends. Start it with lifetime: "short":
startObservability({ serviceName: "migrate", serviceNamespace: "my-project", lifetime: "short" });
await migrate();
// No shutdown() needed: the logs and traces are flushed when the process ends on its own.- No metrics: every run gets a new
service.instance.idand would add about 110 series that only last that run (see "Series" below).metrics.enabledand the metric instrumentations are ignored. - Traces and logs are exported as for a long-running process.
- When the event loop empties (
beforeExit), everything buffered is flushed before the process exits, and the exit code the script set (process.exitCode) stays. An unreachable endpoint delays the exit by the exporter timeout (10 s). process.exit()and an uncaught exception end the process without that flush: callawait observability.shutdown()beforeprocess.exit(), and catch the script's error to log it and setprocess.exitCodeinstead of letting it escape.
Incoming requests
Every request to a node:http or node:https server (Express, Fastify, a plain http.createServer) gets a server
span named by its method, with http.request.method, url.path, http.response.status_code and the client
address, and is counted in the http.server.request.duration metric. The logs written while the request is handled
carry its trace id. Outgoing http.request calls get client spans too (outgoing fetch is
instrumentations.fetch).
- The query string is never recorded: a request that has one gets
url.query=REDACTED, because a query can carry a reset or unsubscribe token. - It works whether the app imported
node:http(or Express) beforestartObservabilityor not; start it first anyway, so the work before it is traced too. - Span names carry no route (
GET, notGET /orders/:id): the package does not instrument Express itself. Filter onurl.pathinstead. instrumentations: { http: false }turns it off.
Health checks
A container health check every 15 s is about 5,760 traces a day per container, most of what a quiet app sends.
traces: { ignorePaths: ["/api/health"] } drops the server span of such a request and every span under it, and
leaves it out of http.server.request.duration:
- an entry matches its own path and everything below it as whole segments:
/api/healthalso drops/api/health/live, but not/api/healthz; the query string is ignored; - only incoming requests (server spans) are matched, read from
url.pathorhttp.target; an outgoing call to that path is still traced; - every other span is sampled as without the option (
ParentBased(AlwaysOn)); - an entry that does not start with
/throws at start, with or without an endpoint.
The health check's own failures still reach the logs: only its traces are dropped.
Metrics
With an endpoint, metrics go to <endpoint>/v1/metrics every 60 s (metrics.exportIntervalMs), cumulative, with
the same resource as traces and logs, and once more on shutdown():
http.server.request.duration(histogram, seconds) byhttp.request.method,http.response.status_code,url.schemeandnetwork.protocol.version: request rate, latency and error rate. Where the http instrumentation is off (the Next.js adapter),instrumentations.serverSpanMetricsrecords the same histogram from the server spans the framework makes, byhttp.request.method,http.response.status_codeandhttp.route(Next.js'snext.route), also when traces are not exported; a path intraces.ignorePathsis not measured. Never by path, so its series stay bounded.http.client.request.durationlikewise for outgoing calls, byserver.address. The exporter's own requests to the trace, log and metric endpoints are not measured (nor traced); other paths on that host are.- Node.js runtime metrics (
instrumentations.runtime):nodejs.eventloop.utilization,nodejs.eventloop.delay.*,nodejs.eventloop.time,v8js.gc.duration,v8js.memory.heap.*per heap space,v8js.resource.active. - Memory (
instrumentations.memory):process.memory.usage, the process's resident set size, and inside a cgroup v2 container (Docker, Kubernetes) the container's own memory, read from/sys/fs/cgroupat each collection:container.memory.usage(memory.current, page cache included),container.memory.working_set(usage minusinactive_file, what the kernel cannot drop before the OOM killer),container.memory.limit(memory.max, only when a limit is set) andcontainer.memory.swap.usage(memory.swap.current). All in bytes (By), so Prometheus names themprocess_memory_usage_bytes,container_memory_working_set_bytesand so on. An alert near the limit compares the working set with the limit, e.g.container_memory_working_set_bytes / container_memory_limit_bytes > 0.85. Outside such a container (macOS, cgroup v1) only the process gauge reports; five series per process at most. - Host (
instrumentations.host): the machine the process runs on, read inside the process at each collection, so a container on a shared server reports the server without an agent.system.memory.limitandsystem.memory.available(MemTotal,MemAvailableof/proc/meminfo, bytes) andsystem.memory.utilization;system.cpu.utilization(busy share of all CPUs since the previous collection, none on the first),system.cpu.load_average.1mandsystem.cpu.logical.count; and per measured pathsystem.filesystem.limit,system.filesystem.available(what an unprivileged process can still write) andsystem.filesystem.utilization, with the path assystem.filesystem.mountpoint.true(the default) measures/, in a container the disk its image and volumes live on;{ filesystems: ["/", "/srv/data"] }names the paths. A container without lxcfs sees the host's/proc, which is the point; with lxcfs it sees its own limits. macOS has no/proc: only the CPU count and the filesystems report. An alert on a full disk:system_filesystem_utilization_ratio > 0.85. About 10 series per process.
Series. Backends that bill or cap by active series (Grafana Cloud Free counts them) see roughly 100 series per
process from the runtime metrics, and for each histogram about 17 series (buckets, sum, count) per combination of its
attributes: for a service answering GET and POST with 200, 401 and 500, about 100 for the request duration.
Several replicas multiply it. A one-shot process (a migration, a script, a cron run) pays this on every run: it gets a
new service.instance.id each time and exports once at the end, so about 110 new series per run that nobody reads;
three daily scripts add about 1,300 series a week. Start those with lifetime: "short" (see "Scripts and one-shot
processes"). instrumentations: { runtime: false } drops the runtime metrics; metrics: { enabled: false } or
OTEL_METRICS_EXPORTER=none exports no metrics at all.
Next.js
instrumentation.ts:
import { createLogger } from "@softure-ai/observability";
import { createOnRequestError, registerObservability } from "@softure-ai/observability/next";
export async function register(): Promise<void> {
await registerObservability({
serviceName: "web",
serviceNamespace: "my-project",
environment: process.env.APP_ENVIRONMENT,
});
}
export const onRequestError = createOnRequestError(createLogger("next"));next.config.ts: keep the package and OpenTelemetry out of the server bundle:
const nextConfig = {
serverExternalPackages: ["@softure-ai/observability"],
};What you get:
Next.js's own spans (the request, rendering, route handlers,
fetch) go to the tracer provider the package registers. Next.js looks up the app's@opentelemetry/apifirst, so the app must resolve one copy of it:npm ls @opentelemetry/apishould show a single version.The
node:httpinstrumentation is off in Next.js (instrumentations.http: false), because Next.js spans every request itself; a second server span would re-parent Next.js's own. Runtime metrics are exported as in Node.js.fetchspans of the undici instrumentation are off in Next.js, because Next.js spansfetchitself. Turning them on (instrumentations: { fetch: true }) calls forNEXT_OTEL_FETCH_DISABLED=1, or every call is spanned twice.registerObservabilitydoes nothing in the edge runtime, and starts in every Node.js server:next startand the standaloneserver.js(output: "standalone", whereNEXT_RUNTIMEis unset at runtime) alike.Next.js's server spans (
BaseServer.handleRequest) carry only the legacy HTTP attributes. The adapter copies them onto their stable names when the span ends (traces.stableHttpAttributes, on by default here), so queries written against the current conventions match:| Legacy (kept) | Stable (added) | | --- | --- | |
http.status_code|http.response.status_code| |http.method|http.request.method| |http.target|url.path(without the query string) |A stable key the span already has is kept. Before an app runs a version with this, query
http.status_code(e.g.span.http.status_code >= 500in Tempo).traces: { stableHttpAttributes: false }turns it off.onRequestErrorlogs one error record per failed request withhttp.request.method,url.path(without the query string, which can carry tokens),next.route,next.route_type,next.render_source(when Next.js passes it) and the error. Request headers are never logged.A client's aborted request (a page change, a refresh or a lost connection before the response finished) is not a failure: React's
The destination stream closed early., Node'sERR_STREAM_PREMATURE_CLOSE, Next.js'sResponseAbortedand Node's requestaborted(ECONNRESET) are logged as oneinforecordrequest aborted by the clientwith the same request fields,outcome: "client_aborted"and no exception, so an alert that countsERRORrecords does not fire. Messages match exactly; every other error stayserror.createOnRequestError(logger, { isClientAbort })replaces the check: compose with the exportedisClientAbortErrorto recognise more, or pass() => falseto log every abort as an error.next.digestis the digest the error page shows the user (<hash>or<hash>@E<n>), so a user's report matches the log line and repeats of one error group. ANEXT_*digest (a redirect,notFound) is never logged: it can carry a URL.Trace ids: the record carries
trace_idandspan_idonly when Next.js callsonRequestErrorinside the request's span. On the RSC payload path (client navigation,next.render_source=react-server-components-payload) Next.js 16 reports the error while the response stream is read, outside the request's context, and passes no span: that record has no trace id, and the trace has no error span either. Nothing in the app can recover them; find the trace by route and time, and the error bynext.digest.
Cloudflare Workers
@softure-ai/observability/workers (no OpenTelemetry SDK: it does not run in workerd) wraps the Worker's fetch
handler. Each request gets one server span (GET, http.request.method, url.path, url.scheme, server.address,
http.response.status_code, error.type on a throw or a 5xx), and every createLogger record written during it
carries that span's trace and span ids. Both are sent over OTLP/HTTP JSON with fetch under ctx.waitUntil, so the
response does not wait. An incoming traceparent continues the caller's trace. A thrown error is logged as
request failed and thrown on.
import { createLogger } from "@softure-ai/observability";
import { withObservability } from "@softure-ai/observability/workers";
const log = createLogger("shop");
export default {
fetch: withObservability(async (request, env, ctx) => handle(request, env, ctx), {
serviceNamespace: "shop",
serviceName: "shop",
environment: "production",
ignorePaths: ["/api/health"],
}),
};The scheduled export (a Cron Trigger) takes withScheduledObservability(handler, options) with the same options
except ignorePaths: one internal span scheduled per firing (faas.trigger timer, faas.cron, error.type when
it throws, thrown on) and the records written while the handler's promise runs. Give it its own serviceName (e.g.
shop-jobs) so a silence rule on the logs (below) watches the background work apart from the requests:
export default {
fetch: withObservability(handleRequest, { serviceNamespace: "shop", serviceName: "shop" }),
scheduled: withScheduledObservability(runJobsTick, { serviceNamespace: "shop", serviceName: "shop-jobs" }),
};Settings are the Node entry's: the options first, then OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_HEADERS,
OTEL_SERVICE_NAME and the other OTEL_* variables from the Worker's bindings (secrets: wrangler secret put).
Without an endpoint nothing is sent. No metrics: an isolate has no process to measure, so the "service is silent"
rule watches the logs instead (buildServiceSilentRule({ signal: "logs", ... })); a Worker whose scheduled jobs log
every run keeps it quiet. A record written outside a request (at module load) goes with the next request's export.
Verifying the export
An app that logs only warn and error sends no log record until something fails, so a wrong /v1/logs endpoint
or a token without log-write scope would stay hidden until the logs are needed. The start-up line
observability: exporting … only says export is configured. The probe says whether the backend accepts it:
# Same OTEL_* variables as the app; once per release, e.g. as a deploy verification step.
npx softure-observability ping --service-name webtraces: accepted by https://otlp.example.com/otlp/v1/traces
logs: refused by https://otlp.example.com/otlp/v1/logs (HTTP 401: Unauthorized)- It sends one span and one log record, both named
softure.probewith the attributesofture.probe=true, so a query can leave them out (softure.probe != true). - Exit code
0when every configured signal is accepted;1when one is refused (with the HTTP status, orno responsefor an unreachable endpoint or a timeout of 10 s), when no endpoint is set, or when a variable is malformed;2on a usage error. A signal without an endpoint printsnot configuredand does not fail the check. - Headers are never printed, and the endpoint shows as origin and path only.
From code, probeObservability(options) of /node takes the options of startObservability (plus timeoutMs) and
returns the outcome per signal. It uses providers of its own, so calling it in a running app leaves the app's export
alone.
Grafana alert rules and dashboards
An app that exports to Grafana keeps its alert rules (and a dashboard) as JSON in its repository and applies them with the package, instead of an apply script of its own:
# GRAFANA_URL and GRAFANA_TOKEN (a service account token) from the environment.
npx softure-observability grafana apply --rules ops/grafana/rules.json --dashboard ops/grafana/dashboard.json
npx softure-observability grafana apply --rules ops/grafana/rules.json --dashboard ops/grafana/dashboard.json --commitfolder "Shop alerts" (shop-alerts): will be created
rule group "shop": will be replaced (add silent-1f0c…; update logs-9a2e…; remove made-in-ui), 3 rules active, notifying "owner-mail"
dashboard "Shop overview" (shop-overview): will be updated
dry run: nothing was changed; pass --commit to apply- Without
--committhe command only reads Grafana and prints what a commit would do. --commitcreates the folder when it is missing, replaces the rule group in onePUT(withX-Disable-Provenance, so the rules stay editable in the UI), and upserts the dashboard into the same folder. The group is replaced as a whole: a rule added to it in the UI is removed; the dry run names it first.- The contact point named by
receivermust exist: it holds a personal address, so the command never creates it and refuses (exit1) when it is missing. Notification policies are not touched: every rule carriesnotification_settings: { receiver }, plus the rule's own grouping and timings when it sets them (below). --pausedapplies every rule paused, e.g. before the first release that sends telemetry, so the silence rules do not mail at once. Applying again without it resumes them; a rule with"isPaused": truein the file stays paused.- Exit code
0when applied or planned;1when refused, when Grafana answers with an error (the call and its HTTP status are printed, the token never), when a variable is missing or a file is invalid;2on a usage error.
The rules file:
{
"folder": { "uid": "shop-alerts", "title": "Shop alerts" },
"receiver": "owner-mail",
"group": "shop",
"intervalSeconds": 60,
"rules": [{ "uid": "…", "title": "…", "condition": "C", "data": [], "for": "0s", "noDataState": "OK" }]
}Each rule is a Grafana provisioning rule: uid, title, condition and data are checked, every other field is
passed on as written. intervalSeconds defaults to 60 and is a multiple of 10. The dashboard file is a dashboard JSON
model with a uid and a title.
A rule that needs its own grouping or timings sets notification_settings without a receiver; the apply merges it
under the file's receiver and prints a line for it (rule "Error burst" (errors-burst): notifications grouped by
alertname, service_name). It takes group_by (label names; Grafana keeps alertname and grafana_folder in it
itself, ["..."] groups by every label), group_wait, group_interval and repeat_interval (durations such as
30s, 5m, 4h). A receiver or any other key there makes the file invalid: one contact point notifies every
rule. Without it a rule takes Grafana's default grouping (alertname, grafana_folder), so a per-service rule
(sum by (service_name) (...)) firing for two services at once sends one mail:
{
"uid": "errors-burst",
"title": "Error burst",
"condition": "C",
"data": [],
"notification_settings": { "group_by": ["alertname", "service_name"] }
}From code, /node exports applyGrafanaResources({ url, token, rules, dashboard, commit, paused }) (it returns the
steps and applied, planned, refused or failed), grafanaRulesFileSchema and parseGrafanaRulesFile (and the
same for a dashboard), and builders for the common rules, keyed on the labels this package's export writes
(service_namespace, service_name, deployment_environment):
buildServiceSilentRule({ service, datasourceUid }): notarget_infosample from the service forwindowMinutes(default 10). Build one for the app and one for its worker.buildLogProblemsRule({ service, datasourceUid }): the service loggedWARNorERROR(severity_textin Loki) in the lastwindowMinutes(default 5);severitieschanges the levels.
service is { namespace, name, environment }, the values the app passes to startObservability /
registerObservability. The uid is derived from the service, so it stays the same between runs. A test can hold the
file to the names:
import { buildServiceSilentRule, parseGrafanaRulesFile } from "@softure-ai/observability/node";
import rulesJson from "../ops/grafana/rules.json";
const parsed = parseGrafanaRulesFile(rulesJson);
expect(parsed.isValid && parsed.value.rules).toContainEqual(
buildServiceSilentRule({
service: { namespace: "shop", name: "worker", environment: "production" },
datasourceUid: "grafanacloud-prom",
}),
);Logger
import { configureLogging, createLogger } from "@softure-ai/observability";
const logger = createLogger("orders");
logger.info("order saved", { orderId: 42 });
const tenantLogger = logger.child({ tenant: "acme" });
tenantLogger.warn("slow query", { ms: 1200 });
try {
await save();
} catch (error) {
logger.error("order save failed", { error, orderId: 42 });
}- Console:
info orders: order saved orderId=42;warnanderrorgo toconsole.error, the rest toconsole.log. Line breaks in the message are escaped, so one call is always one line. - OpenTelemetry: one log record per call, with the logger name as the instrumentation scope, the severity, the message as the body and the fields as attributes; inside an active span it carries the trace and span ids.
- Field values: strings, numbers, booleans and arrays of one of them stay as they are; a
Datebecomes its ISO string, anything else its JSON;undefinedandnullare left out.erroris the thrown value. - Level: the logger's own
leveloption, elseconfigureLogging({ level }), elseSOFTURE_LOG_LEVEL, elseinfo. - The logger works without
startObservability(tests, scripts): it writes to the console only.
Errors and personal data
By default an error is recorded as exception.type, exception.message and exception.stacktrace. Error messages
can carry personal data (a database error holds the failed query and its parameters). An app that cannot allow that
anywhere sets errorDetails: "label" (or configureLogging({ errorDetails: "label" })). No message is logged, of the
error or of its causes; what is logged identifies the error without its text:
exception.messageis the label: the class name and a safe code of the error, then up to three causes (error.causeand theirs) the same way, e.g.Error cause=Error code=ETIMEDOUTorError cause=DatabaseError code=23505. A safe code is a SQLSTATE, a Node system code (ECONNREFUSED), an undici code (UND_ERR_CONNECT_TIMEOUT) or an integer; any other code is left out, since it could be free text. A cause that is not anErroris its type (cause=string).exception.stacktraceholds the first two frames of the app (at loadOrders (/app/.next/server/…:12:7)), without the message line. Frames innode_modulesand Node's internals are skipped, unless there are no others. When the error's message was changed after its stack was taken, no frames are logged.
A logged error that is not an Error (a string reason, a result value, a plain object) keeps its type in
exception.type (string, number, null, object, or an object's class name). In full mode
exception.message is its text: a string as itself, an object as its JSON (or its type and safe code when it
cannot be serialized), capped at 1000 characters. In label mode its text is withheld and the record says so:
non-Error string (text withheld in label mode), non-Error object code=ECONNREFUSED (value withheld in label mode).
To log a reason that label mode keeps, pass it as plain attributes that carry no free text, e.g.
logger.warn("voice isolation refused", { reason_code: "audio_too_short", status: 400 }).
Limitations
- No browser telemetry: an OTLP token must not reach a client bundle; use the frontend's own error reporting.
- No framework instrumentation (Express, Fastify): server spans and metrics carry no route.
- The probe (
softure-observability ping) checks traces and logs only, not metrics. - OTLP/HTTP protobuf on Node (no gRPC); OTLP/HTTP JSON on Workers.
- On Workers: one span per request or scheduled run (no child spans for outgoing
fetchor database calls) and no metrics. A scheduled handler's records are sent only for work its promise awaits. grafana applyspeaks to Grafana only, and creates neither contact points nor notification policies.- Batches are sent every few seconds; a process killed without
shutdown()(orhandleSignals) can lose the last one.
