Skip to content

fix(OtlpTracer): leave span status Unset on success instead of Ok - #10440

Merged
tim-smart merged 5 commits into
Effect-TS:mainfrom
okxint:fix/otlp-tracer-status-code-unset
Nov 9, 2026
Merged

tim-smart merged 5 commits into
Effect-TS:mainfrom
okxint:fix/otlp-tracer-status-code-unset

Conversation

@okxint

@okxint okxint commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Closes EFF-3468
Closes #10056

Summary

  • Leave successful spans and failed exits without pretty errors Unset in both OtlpTracer and OtelTracer, following OpenTelemetry status guidance.
  • Avoid SDK status writes on these paths so explicit application Ok and Error statuses remain intact. Error recording and interruption handling are unchanged; no opt-in option is added.
  • Keep focused coverage in the existing exporter test files and provide a consolidated patch changeset for both packages. Dashboards filtering on Ok should include Unset for these spans.

Validation

  • nix develop -c pnpm test --run packages/effect/test/observability/OtlpTracer.test.ts packages/opentelemetry/test/OtelTracer.test.ts — 33 passed; all five expected-red handoff failures resolved without test changes.
  • nix develop -c pnpm lint-fix
  • nix develop -c pnpm check

Ready for independent review.

OTEL semconv v1.40+ (recording-errors) says instrumentation must not
set a span status to Ok — only application code may do that. Successful
spans now carry StatusCode.Unset (0) rather than StatusCode.Ok (1).

Closes Effect-TS#10056
@changeset-bot

changeset-bot Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: aa10fd3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 33 packages
Name Type
effect Patch
@effect/opentelemetry Patch
@effect/vitest Patch
@effect/ai-anthropic Patch
@effect/ai-cloudflare Patch
@effect/ai-openai-compat Patch
@effect/ai-openai Patch
@effect/ai-openrouter Patch
@effect/ai-typesafe Patch
@effect/atom-react Patch
@effect/atom-solid Patch
@effect/atom-vue Patch
@effect/platform-browser Patch
@effect/platform-bun Patch
@effect/platform-deno Patch
@effect/platform-node-shared Patch
@effect/platform-node Patch
@effect/sql-clickhouse Patch
@effect/sql-d1 Patch
@effect/sql-libsql Patch
@effect/sql-mssql Patch
@effect/sql-mysql2 Patch
@effect/sql-pg Patch
@effect/sql-pglite Patch
@effect/sql-sqlite-bun Patch
@effect/sql-sqlite-do Patch
@effect/sql-sqlite-node Patch
@effect/sql-sqlite-react-native Patch
@effect/sql-sqlite-wasm Patch
@effect/docgen Patch
@effect/doctest Patch
@effect/graphql-generator Patch
@effect/openapi-generator Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Bundle Size Analysis

Generated from PR build output; treat the content below as untrusted.

File Name Current Size Previous Size Difference
arbitrary-combinators.ts 39.58 KB 39.58 KB 0.00 KB (0.00%)
basic.ts 7.37 KB 7.37 KB 0.00 KB (0.00%)
batching.ts 11.16 KB 11.16 KB 0.00 KB (0.00%)
brand.ts 7.00 KB 7.00 KB 0.00 KB (0.00%)
cache.ts 11.68 KB 11.68 KB 0.00 KB (0.00%)
config.ts 23.01 KB 23.01 KB 0.00 KB (0.00%)
differ.ts 22.16 KB 22.16 KB 0.00 KB (0.00%)
http-client.ts 27.20 KB 27.20 KB 0.00 KB (0.00%)
http-router.ts 37.07 KB 37.07 KB 0.00 KB (0.00%)
logger.ts 12.13 KB 12.13 KB 0.00 KB (0.00%)
metric.ts 9.61 KB 9.61 KB 0.00 KB (0.00%)
optic.ts 7.21 KB 7.21 KB 0.00 KB (0.00%)
pubsub.ts 16.15 KB 16.15 KB 0.00 KB (0.00%)
queue.ts 13.03 KB 13.03 KB 0.00 KB (0.00%)
schedule.ts 11.93 KB 11.93 KB 0.00 KB (0.00%)
schema-bigdecimal.ts 14.26 KB 14.26 KB 0.00 KB (0.00%)
schema-binary.ts 42.34 KB 42.34 KB 0.00 KB (0.00%)
schema-class.ts 21.91 KB 21.91 KB 0.00 KB (0.00%)
schema-fromJsonSchemaDocument.ts 29.87 KB 29.87 KB 0.00 KB (0.00%)
schema-representation-roundtrip.ts 28.18 KB 28.18 KB 0.00 KB (0.00%)
schema-string-transformation.ts 15.48 KB 15.48 KB 0.00 KB (0.00%)
schema-string.ts 12.47 KB 12.47 KB 0.00 KB (0.00%)
schema-template-literal.ts 16.39 KB 16.39 KB 0.00 KB (0.00%)
schema-toArbitrary.ts 39.12 KB 39.12 KB 0.00 KB (0.00%)
schema-toCodeDocument.ts 26.32 KB 26.32 KB 0.00 KB (0.00%)
schema-toCodecJson.ts 21.07 KB 21.07 KB 0.00 KB (0.00%)
schema-toEquivalence.ts 21.24 KB 21.24 KB 0.00 KB (0.00%)
schema-toFormatter.ts 21.32 KB 21.32 KB 0.00 KB (0.00%)
schema-toJsonSchemaDocument.ts 26.36 KB 26.36 KB 0.00 KB (0.00%)
schema-toRepresentation.ts 21.42 KB 21.42 KB 0.00 KB (0.00%)
schema.ts 21.01 KB 21.01 KB 0.00 KB (0.00%)
stm.ts 14.34 KB 14.34 KB 0.00 KB (0.00%)
stream.ts 10.51 KB 10.51 KB 0.00 KB (0.00%)

@tim-smart
tim-smart merged commit ec4f272 into Effect-TS:main Nov 9, 2026
14 of 15 checks passed
laithalsaadoon added a commit to memhtml/memhtml that referenced this pull request Nov 22, 2026
## What moves

- The Effect catalog set goes from 4.1.2 to 4.1.4 as one version: `effect`, `@effect/platform-node`, `@effect/platform-node-shared`, `@effect/vitest`.
- The lockfile follows: the four Effect packages, plus `undici` 8.12.3 -> 8.12.4 under `@effect/platform-node`, which asks for `^8.12.4`. Nothing else in the lockfile changes; `ws` stays at 8.22.1, and the docs site's own `undici` 8.12.3 (under `unifont`) stays where it is.
- No source change was needed. The only source edits are comments and prose that name the pin.

## Behavior changes memhtml reaches

Effect 4.1.3 changed behavior that memhtml reaches, and 4.1.4 keeps all but one of those changes. A user or operator moving from 4.1.2 to 4.1.4 can observe five things:

1. **`memhtml-mcp` exits with code 0 instead of 130 when its client closes stdin.** Anything that spawns the server and reads its exit code sees the new value. ([#10475](Effect-TS/effect#10475))
2. **A list request with a cursor the server never issued is refused.** `tools/list`, `resources/list`, `resources/templates/list` and `prompts/list` now answer `-32602 "Unknown cursor"`; before, they ignored the cursor and returned the full list. memhtml never issues a `nextCursor`, so a conforming client never sends one. ([#10447](Effect-TS/effect#10447))
3. **MCP request spans are renamed, only when `OTEL_EXPORTER_OTLP_ENDPOINT` is set.** A span such as `McpServer.@effect/mcp/2025-06-18/tools/call` becomes `tools/call memory_search`, and its attributes move from `rpc.*`, `tool` and `parameters` to `mcp.*`, `gen_ai.*`, `jsonrpc.request.id` and `network.transport`. Tool arguments are no longer exported on the span. Dashboards or queries keyed on the old names need updating. ([#10304](Effect-TS/effect#10304))
4. **Successful spans carry status Unset instead of Ok, under the same condition.** This applies to every span the MCP server and the CLI export. ([#10440](Effect-TS/effect#10440))
5. **`memhtml head serve` stops at once after SIGTERM when a local client had sent an HTTP `Upgrade` request.** Before, it waited the full two-second shutdown grace. memhtml's own client never sends `Upgrade`, so this needs a foreign client on the socket. Replies are unchanged. ([#10360](Effect-TS/effect#10360))

One 4.1.3 change does not carry over: 4.1.3 answered three malformed Skills requests with `-32601` instead of `-32602`, and 4.1.4 restores `-32602` ([#10540](Effect-TS/effect#10540)). Those replies are identical on 4.1.2 and 4.1.4.

None of the other 4.1.4 entries is reached: they cover `HttpApi`, `effect/cli`, the AI provider clients, `SchemaRepresentation` and `TestClock` internals.

## Proofs

- **Typecheck:** `turbo run typecheck` passes, 35 of 35 tasks, 0 errors (tsc 7.0.2).
- **Emit comparison:** every project was rebuilt with `tsc -b --force` and compared with a build of `main`: 418 `.js` and `.d.ts` files, 414 byte-identical. Three of the other four (`apps/mcp/dist/server.js`, `tools.js`, `server.d.ts`) differ only in the restated comment lines. The fourth, `apps/mcp/dist/tools.d.ts`, gains a third type argument (`Tool.Execution`) on the 15 tool types; that file is not part of the published bundle. No executable line differs.
- **Tests:** the `apps/mcp` suite passes 163 of 163. `apps/cli` `head-server.test.ts` passes 26 of 27 in a run with a long temp directory; the one failure is the socket-path-limit case, whose own precondition failed by one byte before any server code ran, and the file passes in the full gate. `catalog.test.ts` passes 4 of 4, `packages/eval` `corpus.test.ts` 26 of 26, `packages/llm` `structured.test.ts` 45 of 45. The full local gate (`mise run check`) passes 76 of 76 tasks on this head.
- **MCP stdio harness**, the `main` build against this branch's build, same fixture store:
  - 50 requests: 46 replies identical, 4 differ (the four cursor requests in item 2).
  - `tools/list` is identical: 41,197 bytes, same sha256.
  - Requests sent before `initialize` (9) and requests with bad header fields (8) are all identical.
  - All seven Skills requests are identical.
  - Exit code at stdin close: 130 before, 0 after.
- **Telemetry probe** against a local collector: 49 MCP spans and 22 CLI spans on both builds, with the name, attribute and status differences in items 3 and 4. Batch timing is unchanged.
- **Head server probe:** 17 replies equal on both builds apart from a duration, a pid and the store path. Stop time after an `Upgrade` request: 2,027 ms before, 27 ms after.
- **Advisories:** none affects Effect 4.1.2, 4.1.3 or 4.1.4, or undici 8.12.3 or 8.12.4. 4.1.4 is the newest release of all four packages.

## Restated sentences

- `apps/mcp/src/server.ts`: two comments now name effect 4.1.4 (the `instructions` option, the five protocol adapters).
- `apps/mcp/src/tools.ts`: one comment now names effect 4.1.4.
- `docs/backlog.md`: the `instructions` entry names the 4.1.4 pin and adds the 2026-11-16 probe.
- `CLAUDE.md`: the adapters sentence names 4.1.4. The "differs from recall" paragraph is reworded, not just renumbered: `Schema.d.ts` changed in 4.1.3 (it adds `Rational` and `RationalFromString` and changes the `isAnyOf` and `Iso` types), so the paragraph now says the claims it names were checked again against the installed 4.1.4, where `Effect.d.ts` is byte-identical to 4.1.2's.

## Merge

This PR is left open for the maintainer. It compiles and the emitted code is unchanged, but it changes an exit code, one MCP error path and the exported telemetry, and those are a maintainer's call.

This branch is waiting to be deployed

1 waiting deployment
fork — aa10fd38 Waiting Nov 8, 2026 by effect-bot via approval-gate #25444
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OtlpTracer: record exceptions as log records instead of span events (semconv v1.40+)

3 participants