Skip to content

Honor HTTP-date Retry-After values in OtlpExporter - #6864

Merged
tim-smart merged 4 commits into
mainfrom
audit/repro-unstable-observability-otlpexporter-retry-after-date
Aug 2, 2026
Merged

Honor HTTP-date Retry-After values in OtlpExporter#6864
tim-smart merged 4 commits into
mainfrom
audit/repro-unstable-observability-otlpexporter-retry-after-date

Conversation

@fubhy

@fubhy fubhy commented Aug 1, 2026

Copy link
Copy Markdown
Member

Summary

  • add a regression test for HTTP-date Retry-After values
  • resolve HTTP-date delays against the configured Effect clock
  • preserve numeric delay-seconds and the existing fallback behavior

Verification

pnpm test --run packages/effect/test/unstable/observability/OtlpExporterRetryAfterDate.test.ts packages/effect/test/unstable/observability/OtlpExporter.test.ts
pnpm --filter effect check
pnpm dprint check packages/effect/src/unstable/observability/OtlpExporter.ts packages/effect/test/unstable/observability/OtlpExporterRetryAfterDate.test.ts
pnpm oxlint -f unix packages/effect/src/unstable/observability/OtlpExporter.ts packages/effect/test/unstable/observability/OtlpExporterRetryAfterDate.test.ts

Closes EFF-303

@github-project-automation github-project-automation Bot moved this to Discussion Ongoing in PR Backlog Aug 1, 2026
@changeset-bot

changeset-bot Bot commented Aug 1, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: be1a27d

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

This PR includes changesets to release 30 packages
Name Type
effect Patch
@effect/opentelemetry Patch
@effect/platform-browser Patch
@effect/platform-bun Patch
@effect/platform-deno Patch
@effect/platform-node-shared Patch
@effect/platform-node Patch
@effect/vitest Patch
@effect/ai-anthropic Patch
@effect/ai-openai-compat Patch
@effect/ai-openai Patch
@effect/ai-openrouter Patch
@effect/atom-react Patch
@effect/atom-solid Patch
@effect/atom-vue 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/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

@effect-slopcop effect-slopcop Bot added the 4.0 label Aug 1, 2026

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues — one minor suggestion inline.

Reviewed changes

  • Reproduction test for HTTP-date Retry-After parsing: adds OtlpExporterRetryAfterDate.test.ts that reproduces the bug where OtlpExporter ignores HTTP-date Retry-After values (RFC 7231), falling through to the 5-second default. The test correctly fails with the current code and would pass once the header is parsed as a date.

Pullfrog  | Fix all ➔Fix 👍s ➔View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) (Kimi K2 not used — the program covers this model; add its provider key to run your pick) | 𝕏

Comment thread packages/effect/test/unstable/observability/OtlpExporterRetryAfterDate.test.ts Outdated
@effect-slopcop effect-slopcop Bot added the bug Something isn't working label Aug 2, 2026
@tim-smart tim-smart changed the title Add reproduction for OtlpExporter issue Honor HTTP-date Retry-After values in OtlpExporter Aug 2, 2026
@@ -0,0 +1,49 @@
import { assert, it } from "@effect/vitest"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please merge this test file into the main one?

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

  • Extracted retryAfterDelay function that resolves Retry-After headers against the Effect clock, handling numeric seconds, HTTP-date values (RFC 7231), missing headers, and unparseable strings with the appropriate fallbacks
  • Made policy clock-aware by accepting a Clock parameter so that HTTP-date delays compute a relative duration rather than a static one
  • Added HTTP-date retry test that follows the existing three-phase pattern — verifies the initial 429 is counted, no premature retry at 5s, and the retry occurs after the full 60s delay
  • Merged the reproduction test into the main OtlpExporter.test.ts file

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) (Kimi K2 not used — the program covers this model; add its provider key to run your pick) | 𝕏

return Duration.millis(Math.max(timestamp - clock.currentTimeMillisUnsafe(), 1))
}

const policy = (clock: Clock) =>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of threading through the clock, you can access using the reference.

@tim-smart
tim-smart enabled auto-merge (squash) August 2, 2026 23:13

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

  • Switched retryAfterDelay to read Clock from environment rather than threading it as a parameter — policy is back to a module-level const, and all branches return Effect.succeed(...). The HTTP-date branch uses Effect.map(Clock, ...) to compute the delay relative to the runtime clock.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) (Kimi K2 not used — the program covers this model; add its provider key to run your pick) | 𝕏

@tim-smart
tim-smart merged commit f398149 into main Aug 2, 2026
19 checks passed
@tim-smart
tim-smart deleted the audit/repro-unstable-observability-otlpexporter-retry-after-date branch August 2, 2026 23:46
@github-project-automation github-project-automation Bot moved this from Discussion Ongoing to Done in PR Backlog Aug 2, 2026
@github-actions

github-actions Bot commented Aug 2, 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
basic.ts 6.65 KB 6.65 KB 0.00 KB (0.00%)
batching.ts 9.44 KB 9.44 KB 0.00 KB (0.00%)
brand.ts 6.33 KB 6.33 KB 0.00 KB (0.00%)
cache.ts 10.20 KB 10.20 KB 0.00 KB (0.00%)
config.ts 20.34 KB 20.34 KB 0.00 KB (0.00%)
differ.ts 19.95 KB 19.95 KB 0.00 KB (0.00%)
http-client.ts 21.04 KB 21.04 KB 0.00 KB (0.00%)
logger.ts 10.35 KB 10.35 KB 0.00 KB (0.00%)
metric.ts 8.58 KB 8.58 KB 0.00 KB (0.00%)
optic.ts 7.34 KB 7.34 KB 0.00 KB (0.00%)
pubsub.ts 14.49 KB 14.49 KB 0.00 KB (0.00%)
queue.ts 11.15 KB 11.15 KB 0.00 KB (0.00%)
schedule.ts 10.33 KB 10.33 KB 0.00 KB (0.00%)
schema-class.ts 18.88 KB 18.88 KB 0.00 KB (0.00%)
schema-fromJsonSchemaDocument.ts 28.69 KB 28.69 KB 0.00 KB (0.00%)
schema-representation-roundtrip.ts 25.01 KB 25.01 KB 0.00 KB (0.00%)
schema-string-transformation.ts 13.01 KB 13.01 KB 0.00 KB (0.00%)
schema-string.ts 10.66 KB 10.66 KB 0.00 KB (0.00%)
schema-template-literal.ts 14.87 KB 14.87 KB 0.00 KB (0.00%)
schema-toArbitraryLazy.ts 21.67 KB 21.67 KB 0.00 KB (0.00%)
schema-toCodeDocument.ts 24.10 KB 24.10 KB 0.00 KB (0.00%)
schema-toCodecJson.ts 18.93 KB 18.93 KB 0.00 KB (0.00%)
schema-toEquivalence.ts 18.74 KB 18.74 KB 0.00 KB (0.00%)
schema-toFormatter.ts 18.61 KB 18.61 KB 0.00 KB (0.00%)
schema-toJsonSchemaDocument.ts 22.36 KB 22.36 KB 0.00 KB (0.00%)
schema-toRepresentation.ts 19.28 KB 19.28 KB 0.00 KB (0.00%)
schema.ts 18.14 KB 18.14 KB 0.00 KB (0.00%)
stm.ts 12.13 KB 12.13 KB 0.00 KB (0.00%)
stream.ts 9.38 KB 9.38 KB 0.00 KB (0.00%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4.0 bug Something isn't working

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants