Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/effect-sdk-span-options.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@maple-dev/effect-sdk": minor
---

`Maple.layer` takes the same span options as `MapleFlush.make` and the Cloudflare `make`, and all three classify spans the same way. New on every preset: `dropSpanSubtrees` drops a span and everything under it, `dropSpan` drops a finished span by predicate, and `isAnticipatedError` is the predicate form of `anticipatedErrorIdentifiers`. A server span that answered 5xx stays an error even when its failure is anticipated. On `Maple.layer`, unmatched-route 404 spans are now dropped and server spans that rendered a 5xx are recorded as errors, which can surface new error groups.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
title: "Drop noisy spans and expected errors from Maple.layer"
description: "Maple.layer now takes the same span options as MapleFlush.make, plus subtree drops and predicates for both."
date: 2026-10-16
category: sdk
authors: [makisuo]
---

`Maple.layer`, the long-running preset in `@maple-dev/effect-sdk`, now accepts the span options
that were only on `MapleFlush.make` and the Cloudflare `make`. All three presets take the same
options and classify spans the same way.

- `dropSpanNames` drops spans by name prefix, as before. Only the matching span goes.
- `dropSpanSubtrees` drops a span and every span under it, so an idle polling loop and the
queries it runs stop exporting. Outgoing calls under a dropped span carry an unsampled
`traceparent`, and errors inside it are not tracked, so keep real work outside it.
- `dropSpan` takes a predicate on the finished span (name, kind, attributes, exit), for example
to drop only polls that found nothing.
- `anticipatedErrorIdentifiers` marks expected failures (a duplicate, a not-found) as `Ok` with
no exception, so they stop creating error groups. `isAnticipatedError` is its predicate form,
for driver errors that are only expected in one case.
- `excludeLogSpans` is now available on `Maple.layer` too.

A few behaviour changes come with it:

- A server span that answered 5xx stays an error even when its failure is listed as anticipated.
- On `Maple.layer`, spans for unmatched-route 404s are dropped, and server spans that rendered a
5xx response are recorded as errors, matching the other presets. That can surface new error
groups for crashes that used to export as `Ok`.

Upgrade to `@maple-dev/effect-sdk` 0.11.0.
19 changes: 7 additions & 12 deletions apps/landing/src/content/docs/sdks/effect-cloudflare.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,17 @@ A flush fails when the request throws (for example a network error) or the inges

## Cloudflare-specific config

`make()` accepts the [common options](/docs/sdks/effect#configuration-reference) marked for Cloudflare (`serviceName`, `region`, `endpoint`, `ingestKey`, `serviceVersion`, `serviceNamespace`, `environment`, `repositoryUrl`, `attributes`), plus these:
`make()` accepts the [common options](/docs/sdks/effect#configuration-reference) marked for Cloudflare (`serviceName`, `region`, `endpoint`, `ingestKey`, `serviceVersion`, `serviceNamespace`, `environment`, `repositoryUrl`, `attributes`), the [span options](/docs/sdks/effect#dropping-spans) (`excludeLogSpans`, `dropSpanNames`, `dropSpanSubtrees`, `dropSpan`, `anticipatedErrorIdentifiers`, `isAnticipatedError`), plus these:

| Option | Type | Default | Description |
| ----------------------------- | ----------------------- | ------------- | ------------------------------------------------------------------------------------------------------ |
| `excludeLogSpans` | `boolean` | `false` | Skip Effect log spans in OTLP log attributes |
| `dropSpanNames` | `ReadonlyArray<string>` | none | Drop spans whose name starts with any prefix in this list |
| `anticipatedErrorIdentifiers` | `ReadonlyArray<string>` | none | `_tag` / `Error.name` values of expected 4xx failures. Spans export as `Ok`, with no `exception` event |
| `tracesPath` | `string` | `/v1/traces` | OTLP traces path appended to `endpoint` |
| `logsPath` | `string` | `/v1/logs` | OTLP logs path appended to `endpoint` |
| `metricsPath` | `string` | `/v1/metrics` | OTLP metrics path appended to `endpoint` |

`anticipatedErrorIdentifiers` keeps expected rejections (a 404, a 401) visible as traces without counting them as errors. A span still exports as `Error` if its cause contains any defect.
| Option | Type | Default | Description |
| ------------- | -------- | ------------- | ---------------------------------------- |
| `tracesPath` | `string` | `/v1/traces` | OTLP traces path appended to `endpoint` |
| `logsPath` | `string` | `/v1/logs` | OTLP logs path appended to `endpoint` |
| `metricsPath` | `string` | `/v1/metrics` | OTLP metrics path appended to `endpoint` |

An error that crossed an HTTP boundary is a decoded body rather than the class that raised it, so a failure shaped `{ error: { _tag } }` (the envelope convention many APIs use) is matched on the body's `_tag`. Client-side spans classify the same as the server-side ones they mirror, with no separate identifiers to configure.

`dropSpanNames` suppresses protocol-level chatter. For example, `["McpServer/Notifications."]` drops MCP notification spans without dropping handler spans.
`dropSpanNames` suppresses protocol-level chatter. For example, `["McpServer/Notifications."]` drops MCP notification spans without dropping handler spans. Use `dropSpanSubtrees` instead when the children should go too.

## Endpoint resolution

Expand Down
Loading
Loading