{"locator":"npm:@open-mercato/telemetry","path":"@open-mercato/telemetry","npm":"@open-mercato/telemetry","github":null,"repoPath":"open-mercato/open-mercato#main/packages/telemetry","kind":"module","type":"official","enterprise":false,"title":"Telemetry","summary":"Exports traces, metrics, logs and errors over OTLP/HTTP. Stays idle until TELEMETRY_BACKEND is set.","whenToUse":"Use when you run an OpenTelemetry collector or a managed OTLP backend and want app traces and errors there.","whenNotToUse":null,"category":"storage-infrastructure","tags":["opentelemetry","tracing","metrics"],"providers":[],"moduleIds":["telemetry"],"requires":[],"replaces":[],"slotConflicts":[],"renamedFrom":[],"supersededBy":null,"alternatives":[],"status":"active","listed":true,"featured":false,"license":{"spdx":"MIT","kind":"osi","mismatch":false},"version":{"latest":"0.10.1","preview":null,"publishedAt":"2026-11-25","integrity":"sha512-MCKZg+HTIDjfjS9kTuqnXZ2PHGt5Z0xbUR73zm8UxNufU7IgThHefATTJqQoeRtgxzsMtVfgHGJQYALvvJkh2g==","installableFrom":"2026-11-25","gitRef":null,"recommended":{"0.10":null,"0.9":"0.9.0","next":null}},"identity":{"builtFrom":"verified","claimed":false,"source":"npm"},"compat":{"builtFor":{"range":null,"kind":"missing","lines":[]},"lines":{"0.9":{"status":"harness-red","step":"typecheck","omVersion":"0.9.0","moduleVersion":"0.9.0","at":"2026-11-29T11:30:44Z","receipt":"r_20261129_e5f612bd10e0","since":"2026-11-19","precheck":null,"patches":[]}},"verifiedOn":[],"inPresets":["0.9","0.10","next"],"ships":{"0.10":"0.10.1","0.9":"0.9.0","next":"0.11.1-develop.9022.1.4a0659af46"},"isolation":{"0.9":{"status":"verified","step":null,"moduleVersion":"0.9.0","at":"2026-11-04T09:13:06Z","receipt":"r_20261104_f265dbbbb1a7"}}},"anatomy":{"version":"0.10.1","coverage":"partial","counts":{"entities":0,"tables":0,"migrations":0,"routes":1,"publicRoutes":0,"aclFeatures":0,"eventsEmitted":0,"eventsConsumed":0,"backendPages":0,"frontendPages":0,"widgets":0,"workers":0,"cli":0,"aiTools":0,"aiAgents":0,"extends":0},"lists":{"aclFeatures":[],"eventsEmitted":[],"eventsConsumed":[],"env":["OM_TEST_MODE","OM_TEST_BROWSER_TELEMETRY_MODE","OTEL_SERVICE_NAME","OTEL_RESOURCE_ATTRIBUTES","TELEMETRY_BROWSER_ENABLED","TELEMETRY_BROWSER_SERVICE_NAME","TELEMETRY_BROWSER_SAMPLING_RATIO","OTEL_EXPORTER_OTLP_TRACES_ENDPOINT","OTEL_EXPORTER_OTLP_ENDPOINT","OTEL_EXPORTER_OTLP_HEADERS","TELEMETRY_BACKEND","TELEMETRY_SAMPLING_RATIO","TELEMETRY_TRUST_INBOUND_TRACE"],"hosts":[],"tables":[],"publicRoutes":[],"credentials":[]},"callout":"ADDS 1 ROUTE (0 PUBLIC)","diff":{"from":"0.10.0","added":{"tables":0,"routes":0,"publicRoutes":0,"aclFeatures":0,"env":[],"hosts":[]},"removed":{"tables":0,"routes":0,"aclFeatures":0}}},"signals":{"receipt":{"0.10":"untested","0.9":"harness-red","next":"untested"},"fit":{"0.10":"ok","0.9":"drift","next":"unknown"},"anatomy":"partial","supplyChain":{"status":"ok","reasons":[]},"hygiene":{"status":"ok","failing":[]},"maintenance":{"status":"current","lastRelease":"2026-11-25","catchUpDays":null},"declaredVsObserved":{"status":"mismatch","notes":["No Open Mercato peer range; verified on no line."]}},"tier":"listed","quality":null,"agentPolicy":{"0.10":{"decision":"ask","reasons":[{"code":"NOT_VERIFIED","text":"Not yet tested in a new app on 0.10."},{"code":"IN_PRESET","text":"Nothing to install: a new app already registers telemetry in src/modules.ts."}]},"0.9":{"decision":"ask","reasons":[{"code":"NOT_VERIFIED","text":"Not judged on 0.9: our test app failed on 29 Nov."},{"code":"IN_PRESET","text":"Nothing to install: a new app already registers telemetry in src/modules.ts."}]},"next":{"decision":"ask","reasons":[{"code":"NOT_VERIFIED","text":"Not yet tested in a new app on next."},{"code":"IN_PRESET","text":"Nothing to install: a new app already registers telemetry in src/modules.ts."}]}},"install":{"cli":"yarn mercato module add @open-mercato/telemetry@0.10.1","cmm":"npx create-mercato-module install @open-mercato/telemetry@0.10.1","needsAllowThirdParty":false,"moduleFlag":null},"stats":{"downloads30d":99535,"stars":null},"sigil":{"glyph":"0100000","phase":17,"publicRoutes":false},"links":{"page":"https://www.openmercato.com/run/m/@open-mercato/telemetry","md":"https://www.openmercato.com/run/m/@open-mercato/telemetry.md","json":"https://www.openmercato.com/run/m/@open-mercato/telemetry.json","facts":"https://www.openmercato.com/run/m/@open-mercato/telemetry/v/0.10.1/facts.json","npm":"https://www.npmjs.com/package/@open-mercato/telemetry","repo":"https://github.com/open-mercato/open-mercato","docs":"https://docs.openmercato.com/framework/runtime/telemetry"},"addedAt":"2026-10-23","updatedAt":"2026-12-03T18:30:24Z","_meta":{"com.openmercato.modules/installable":{"0.10":"0.10.1","0.9":"0.10.1","next":"0.10.1"}},"facts":{"factsVersion":1,"extractor":{"engine":"@open-mercato/cli@0.9.0 extractModuleFacts","factsContractVersion":2,"catalog":"om-modules rentgen 5","durationMs":28},"package":{"locator":"npm:@open-mercato/telemetry","name":"@open-mercato/telemetry","version":"0.10.1","integrity":"sha512-MCKZg+HTIDjfjS9kTuqnXZ2PHGt5Z0xbUR73zm8UxNufU7IgThHefATTJqQoeRtgxzsMtVfgHGJQYALvvJkh2g==","source":"npm-tarball","gitRef":null},"gate":{"installable":true,"needsModuleFlag":false,"reason":null,"modules":[{"id":"telemetry","src":true,"dist":true}]},"kind":"module","license":{"value":"MIT","kind":"osi","mismatch":false,"sources":{"packageJson":"MIT","licenseFile":null,"moduleInfo":null,"integrationTs":null}},"omPeers":{},"dependencies":{"@open-mercato/shared":"0.10.1"},"agentsMd":true,"readmeExcerpt":"# @open-mercato/telemetry\n\nVendor-neutral tracing, metrics, log export, and error reporting for Open\nMercato, backed by a pluggable provider with OpenTelemetry (OTLP) as the default\ntransport.\n\nTelemetry is explicitly opt-in. The platform checks `TELEMETRY_BACKEND` from\nshared code before importing this package, so the telemetry runtime is not\nevaluated when the variable is unset, `noop`, or unknown. OpenTelemetry packages\nare optional dependencies and are dynamically imported only for an OTLP backend.\nPackage managers may still install optional dependencies; the guarantee is zero\ndisabled-path runtime loading, hook registration, or export traffic.\n\nSee [the telemetry spec](../../.ai/specs/2026-04-29-telemetry-and-otel.md).\n\n## Usage\n\nThe canonical application logger remains\n`@open-mercato/shared/lib/logger`. Telemetry extends it after successful\ninitialization with trace correlation and one remote sink; it does not create a\nsecond logger or local output path.\n\n```ts\nimport { createLogger } from '@open-mercato/shared/lib/logger'\nimport { withSpan, counter, reportError } from '@open-mercato/telemetry'\n\nconst log = createLogger('orders').child({ module: 'sales' })\nlog.info('Order placed', { orderId })\n\nawait withSpan('orders.checkout', async (span) => {\n  span.setAttribute('om.tenant_id', tenantId)\n  // pg/undici auto-spans nest here when OTLP is enabled\n})\n\ncounter('om.errors', 1, { module: 'orders' })\n\ntry {\n  // ...\n} catch (error) {\n  reportError(error, { module: 'orders' })\n  throw error\n}\n```\n\nUse `OM_LOG_LEVEL`, `OM_LOG_PRETTY`, and `OM_LOG_DESTINATION` for both the\nnormal local logger and telemetry-backed log export. Remote records follow the\nsame shared level gate as local records.\n\n## Enabling\n\nLeave `TELEMETRY_BACKEND` unset (or set it to `noop`) to keep telemetry off.\nUnknown values also resolve to off.\n\n```dotenv\nTELEMETRY_BACKEND=otlp\nTELEMETRY_SAMPLING_RATIO=0.1\nOTEL_EXPORTER_OTLP_ENDPOINT=https://<your-collector>:4318\nOTEL_EXPORTER_OTLP_HEADERS=<auth-header>=<key>\nOTEL_SERVICE_NAME=open-mercato\nOTEL_RESOURCE_ATTRIBUTES=deployment.environment=production\n```\n\n`otlp`, `signoz`, and `newrelic` select the same OTLP provider and differ\nonly by endpoint and headers. `console` is an explicit local span/metric\ndiagnostic backend.\n\n`TELEMETRY_TRUST_INBOUND_TRACE` defaults to false. In that mode both\n`traceparent` and `x-original-traceparent` from inbound/global carriers are\nignored because either header is caller-controlled. Set it to true only behind a\ntrusted upstream when global W3C continuation is required. The queue package's\ndedicated `metadata._trace` carrier does not require this flag. The richer\n`bullmq-otel` queue spans do use the process-global propagator, so they stay\ndisabled while this flag is false; async queues then use the dedicated carrier.\n\nCustom providers remain supported through `registerProvider()`. Because the\ndefault host guard deliberately imports telemetry only for built-in backend\nnames, a custom-provider bootstrap must import `@open-mercato/telemetry`,\nregister a provider whose `name` matches `TELEMETRY_BACKEND`, and call\n`initTelemetry()` directly. Unregistered names remain a hard no-op.\n\n## Browser RUM (client-side telemetry)\n\nServer traces can only prove where the time *isn't*: a page can render an API\nanswer in 50 ms yet leave the user waiting seconds on bundle download,\nhydration, or a click handler — all invisible to server spans. The\n`@open-mercato/telemetry/browser` entry closes that gap with the OpenTelemetry\nweb SDK: document-load and fetch spans from the backoffice.\n\nInteraction spans are deliberately **not** collected. The upstream\n`UserInteractionInstrumentation` patches `addEventListener` when it starts, but\nReact attaches a single delegated `click` listener to the root container during\nhydration — before this SDK boots from `useEffect` — so the patch would never see\na backoffice click. Booting earlier would put the SDK back on the critical path,\nwhich defeats the point; an instru","modules":[{"id":"telemetry","title":"Telemetry","description":null,"requires":[],"ejectable":null,"data":{"entities":[],"migrations":{"count":0,"first":null,"last":null},"customEntities":0},"http":{"routes":[{"method":"POST","path":"/api/telemetry/browser-traces","requireAuth":true,"requireFeatures":[],"hasOpenApi":true,"src":{"file":"src/modules/telemetry/api/browser-traces/route.ts","line":71}}],"legacyRouteFiles":0,"authResolved":1},"security":{"aclFeatures":[],"setupDefaultRoleFeatures":false},"events":{"emits":[],"subscribes":[]},"ui":{"backendPages":[],"frontendPages":[],"widgets":0,"extensionHosts":0},"background":{"workers":[],"cli":[]},"ai":{"tools":[],"agents":[]},"config":{"credentials":[],"env":[{"name":"OM_TEST_MODE","src":{"file":"src/browser/server.ts","line":96}},{"name":"OM_TEST_BROWSER_TELEMETRY_MODE","src":{"file":"src/browser/server.ts","line":97}},{"name":"OTEL_SERVICE_NAME","src":{"file":"src/browser/server.ts","line":103}},{"name":"OTEL_RESOURCE_ATTRIBUTES","src":{"file":"src/browser/server.ts","line":104}},{"name":"TELEMETRY_BROWSER_ENABLED","src":{"file":"src/browser/server.ts","line":124}},{"name":"TELEMETRY_BROWSER_SERVICE_NAME","src":{"file":"src/browser/server.ts","line":131}},{"name":"TELEMETRY_BROWSER_SAMPLING_RATIO","src":{"file":"src/browser/server.ts","line":138}},{"name":"OTEL_EXPORTER_OTLP_TRACES_ENDPOINT","src":{"file":"src/browser/server.ts","line":147}},{"name":"OTEL_EXPORTER_OTLP_ENDPOINT","src":{"file":"src/browser/server.ts","line":149}},{"name":"OTEL_EXPORTER_OTLP_HEADERS","src":{"file":"src/browser/server.ts","line":159}},{"name":"TELEMETRY_BACKEND","src":{"file":"src/env.ts","line":52}},{"name":"TELEMETRY_SAMPLING_RATIO","src":{"file":"src/env.ts","line":56}},{"name":"TELEMETRY_TRUST_INBOUND_TRACE","src":{"file":"src/env.ts","line":57}}]},"network":{"hosts":[],"undeclared":[]},"extends":[],"omImports":{"@open-mercato/shared":{"lib/auth/server":["AuthContext"],"lib/boolean":["parseBooleanWithDefault"],"lib/di/container":["createRequestContainer"],"lib/logger":["LoggerExtensionRecord","createLogger","registerLoggerExtension"],"lib/ratelimit/service":["RateLimiterService"],"lib/ratelimit/types":["RateLimitConfig"],"lib/telemetry/error-code":["groupableCode"],"lib/telemetry/runtime":["TelemetryRuntime","collectTelemetryMetrics","getTelemetryRuntime","isTelemetryBackendEnabled","recordTelemetryMetric","registerTelemetryErrorReporter","registerTelemetryRuntime"],"modules/registry":["ModuleInfo"]}},"collisionKeys":{"moduleId":"telemetry","tables":[],"aclFeatures":[],"eventIds":[],"backendRoutes":[]},"publicRoutes":0,"glyph":"0100000","lint":[{"code":"ships-tests","severity":"info","message":"The tarball ships test files.","anchor":null,"src":null},{"code":"version-drift","severity":"info","message":"ModuleInfo says 0.1.0, package.json says 0.10.1.","anchor":null,"src":{"file":"src/modules/telemetry/index.ts","line":7}}]}],"coverage":{"routesAuthResolved":1,"integrationTs":"absent"},"diagnostics":[]},"receipts":[{"schema":1,"id":"r_20261108_3f77b5d91551","cellKey":"3f77b5d91551e5385b9e80c316f1242179781240dd6c338698f5bf0afafddd2b","module":{"locator":"npm:@open-mercato/telemetry","version":"0.9.0","integrity":"sha512-VI9ry8eMjKFwHRCPA4V1z9TJtkfjz4HJR4M8V5s2NKBFsvP9t5rbUTdrcY5z/aifoYUeLdpCzX8ZHr2cHdrukA=="},"om":{"line":"0.9","version":"0.9.0","createApp":"create-mercato-app@0.9.0","preset":"classic"},"harness":{"version":"c349007c2b5b","node":"24.21.0","yarn":"4.17.1","runner":"ubuntu-latest","mode":"realistic","patches":[]},"baseline":{"status":"verified","receipt":"r_20261105_e5f612bd10e0"},"requiresInstalled":[],"steps":[{"name":"scaffold","status":"pass","sec":2,"signature":null,"excerpt":null,"file":null,"line":null},{"name":"install","status":"pass","sec":51,"signature":null,"excerpt":null,"file":null,"line":null},{"name":"add","status":"pass","sec":8,"signature":null,"excerpt":null,"file":null,"line":null},{"name":"generate","status":"pass","sec":18,"signature":null,"excerpt":null,"file":null,"line":null},{"name":"typecheck","status":"pass","sec":70,"signature":null,"excerpt":null,"file":null,"line":null},{"name":"initialize","status":"pass","sec":27,"signature":null,"excerpt":null,"file":null,"line":null},{"name":"build","status":"pass","sec":134,"signature":null,"excerpt":null,"file":null,"line":null},{"name":"start","status":"pass","sec":5,"signature":null,"excerpt":null,"file":null,"line":null},{"name":"smoke","status":"pass","sec":1,"signature":null,"excerpt":null,"file":null,"line":null}],"result":{"status":"verified","failedStep":null,"alsoFailed":[],"classification":"pass","quarantineUntil":null},"transition":{"from":null,"to":"verified","confirmed":true},"run":{"id":42465231410,"attempt":1,"url":"https://github.com/open-mercato/modules/actions/runs/42465231410/job/128683248326","at":"2026-11-08T08:59:30Z","durationSec":433},"attestation":null,"notes":["in-preset"]},{"schema":1,"id":"r_20261104_f265dbbbb1a7","cellKey":"f265dbbbb1a704b339aeba6570c8e9714ad623a6ba775241f5e62ed2c9581d8d","module":{"locator":"npm:@open-mercato/telemetry","version":"0.9.0","integrity":"sha512-VI9ry8eMjKFwHRCPA4V1z9TJtkfjz4HJR4M8V5s2NKBFsvP9t5rbUTdrcY5z/aifoYUeLdpCzX8ZHr2cHdrukA=="},"om":{"line":"0.9","version":"0.9.0","createApp":"create-mercato-app@0.9.0","preset":"empty"},"harness":{"version":"c349007c2b5b","node":"24.21.0","yarn":"4.17.1","runner":"ubuntu-latest","mode":"realistic","patches":[{"id":"api-keys","why":"OM 0.9.0 empty preset omits api_keys (fixed on main in #7473, not in release/v0.9.x)","ref":"https://github.com/open-mercato/open-mercato/pull/7473"}]},"baseline":{"status":"verified","receipt":"r_20261029_971197f20239"},"requiresInstalled":[],"steps":[{"name":"scaffold","status":"pass","sec":4,"signature":null,"excerpt":null,"file":null,"line":null},{"name":"install","status":"pass","sec":64,"signature":null,"excerpt":null,"file":null,"line":null},{"name":"add","status":"pass","sec":16,"signature":null,"excerpt":null,"file":null,"line":null},{"name":"generate","status":"pass","sec":5,"signature":null,"excerpt":null,"file":null,"line":null},{"name":"typecheck","status":"pass","sec":35,"signature":null,"excerpt":null,"file":null,"line":null},{"name":"initialize","status":"pass","sec":9,"signature":null,"excerpt":null,"file":null,"line":null},{"name":"build","status":"pass","sec":76,"signature":null,"excerpt":null,"file":null,"line":null},{"name":"start","status":"pass","sec":4,"signature":null,"excerpt":null,"file":null,"line":null},{"name":"smoke","status":"pass","sec":1,"signature":null,"excerpt":null,"file":null,"line":null}],"result":{"status":"verified","failedStep":null,"alsoFailed":[],"classification":"pass","quarantineUntil":null},"transition":{"from":null,"to":"verified","confirmed":true},"run":{"id":41805636778,"attempt":1,"url":"https://github.com/open-mercato/modules/actions/runs/41805636778/job/126492058949","at":"2026-11-04T09:13:06Z","durationSec":313},"attestation":null}],"rules":[{"id":"LST-1","pass":true,"detail":"Descriptor is valid."},{"id":"LST-2","pass":true,"detail":"Stable version exists and is not deprecated."},{"id":"LST-3","pass":true,"detail":"src/modules and dist/modules pair found."},{"id":"LST-4","pass":true,"detail":"License: MIT."},{"id":"LST-5","pass":true,"detail":"No known malware or open critical advisory."},{"id":"LST-6","pass":true,"detail":"Name reviewed at merge."},{"id":"VER-1","pass":false,"detail":"Not yet tested in a new app on 0.10."},{"id":"VER-2","pass":true,"detail":"Fits statically on 0.10: ok."},{"id":"VER-3","pass":true,"detail":"Supply chain: ok."},{"id":"VER-4","pass":true,"detail":"No lint errors."},{"id":"VER-5","pass":true,"detail":"No repository in the descriptor to compare."}],"maintainers":["pat-lewczuk","piotrkarwatka"]}
