Skip to content

HTTP.jl 2.0 support#129

Merged
krynju merged 3 commits into
oolong-dev:masterfrom
krynju:http-exporter-http2-support
Jun 24, 2026
Merged

HTTP.jl 2.0 support#129
krynju merged 3 commits into
oolong-dev:masterfrom
krynju:http-exporter-http2-support

Conversation

@krynju

@krynju krynju commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

krynju and others added 3 commits June 22, 2026 14:50
HTTP.jl 2.0 reworked client timeout keywords: `readtimeout` is now a
deprecated alias that maps to the inactivity-based `read_idle_timeout`,
and the overall request deadline uses the new `request_timeout` keyword.

Detect the HTTP major version once at load time and pass the matching
timeout keyword: `request_timeout` on 2.x, `readtimeout` on 1.x. The
`retry` / `retry_non_idempotent` keywords are unchanged across versions.

Widen the HTTP compat bound to "1, 2" and bump the package to 0.1.7.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
HTTP.jl 2.0 reworked the server API: the `stream = true` mode of
`serve!` and the `setstatus` / `setheader` / `startwrite` streaming
helpers were removed in favor of returning an `HTTP.Response` from the
handler, and the running-server handle type changed from
`HTTP.Servers.Server` to `HTTP.Server`.

Rewrite the `/metrics` handler to buffer the body and return a
`Response` — a single code path that works on both HTTP 1.x and 2.x via
the still-supported `Router` / `register!` / `serve!` request-handler
API. Drop the now version-specific field type annotation on the stored
server handle. The pushgateway path (`HTTP.request`, `HTTP.Headers`) is
unchanged and already cross-version.

Widen the HTTP compat bound to "1, 2" and bump the package to 0.3.2.

Verified: the package's test suite (33 tests, including the end-to-end
`/metrics` HTTP round-trip) passes under both HTTP 1.x and HTTP 2.4.0.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
`Base.pkgversion(m)` can return `nothing` (its documented behavior when
a module wasn't loaded from a versioned package); `nothing >= v"2"`
would then throw at module load. Guard it and fall back to API feature
detection — `HTTP.Servers` exists throughout HTTP 1.x and was removed in
2.0 — which also covers Julia < 1.9 where `pkgversion` is unavailable.

Verified the primary and fallback branches agree on both HTTP 1.11 and
2.4, and that a full export round-trip (encode → POST → decode response
body) returns EXPORT_SUCCESS against a local collector on both versions.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@krynju krynju marked this pull request as ready for review June 24, 2026 14:57
@krynju krynju merged commit 738c3ec into oolong-dev:master Jun 24, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant