mtelvers · GitHub

@mtelvers

dinosaure

Recording and collection no longer depend on a concurrency library, so
metric-defining libraries depend only on `prometheus`; an application
chooses Lwt or Eio only when it serves metrics.
- prometheus (core): Lwt-free, direct-style. CollectorRegistry.collect
  returns a plain snapshot; a collector may perform I/O via effects,
  handled by whatever scheduler runs collect. Includes the direct-style
  timing helpers (Gauge.time, track_inprogress, Summary.time).
- prometheus-app: backend-free text-format renderer + GC collectors
  (no cohttp, no concurrency library).
- prometheus-cohttp: a /metrics handler functor over cohttp's
  Cohttp.Generic.Server.S, usable with any cohttp backend.
- prometheus-lwt (+ .unix): Lwt collectors (register_lwt), an Lwt collect
  that merges the core's synchronous metrics, Lwt timing helpers, and the
  cohttp-lwt server + cmdliner + logging.
- prometheus-eio: a cohttp-eio handler; async collection needs no special
  machinery under Eio, and timing reuses the core's direct-style helpers.
Lower bounds are 4.08 for the non-Eio packages and 5.0 for prometheus-eio.
Tests cover the core, the Lwt sync+async merge, and the effects-driven Eio
path under Eio_main. README updated.

@mtelvers

avsm added a commit to avsm/prometheus that referenced this pull request

Aug 5, 2026
Split off the Lwt-specific parts of the library so that defining and
recording metrics no longer pulls in a concurrency library. Metric
recording is synchronous anyway (it updates an in-memory scoreboard) so
the core does not need Lwt.
This is the first half of mirage#60, so that the interface-breaking move can
be reviewed separately.
Co-authored-by: Mark Elvers <mark.elvers@tunbury.org>

@avsm avsm mentioned this pull request

Aug 5, 2026

Open

avsm added a commit to avsm/prometheus that referenced this pull request

Aug 6, 2026
Introduce the `prometheus-lwt` package with the API that the core will keep
once its Lwt dependency is removed (mirage#60 mirage#65), but implemented for now via Lwt
support still present in `prometheus`.
Therefore nothing breaks in this release as existing users can migrate to
`Prometheus_lwt` and also to the new synchronous `_fn` functions at their own
pace. The actual interface break will then happen in a later release without
further source changes for migrated Lwt users.
Also add synchronous variants of the timing helpers to the core since the
existing Lwt-typed functions occupy the unsuffixed names until the break.
Suggested by @talex5 in mirage#65.
Co-authored-by: Mark Elvers <mark.elvers@tunbury.org>

avsm added a commit to avsm/prometheus that referenced this pull request

Aug 6, 2026
Introduce the `prometheus-lwt` package with the API that the core will keep
once its Lwt dependency is removed (mirage#60 mirage#65), but implemented for now via Lwt
support still present in `prometheus`.
Therefore nothing breaks in this release as existing users can migrate to
`Prometheus_lwt` and also to the new synchronous `_fn` functions at their own
pace. The actual interface break will then happen in a later release without
further source changes for migrated Lwt users.
Also add synchronous variants of the timing helpers to the core since the
existing Lwt-typed functions occupy the unsuffixed names until the break.
Suggested by @talex5 in mirage#65.
Co-authored-by: Mark Elvers <mark.elvers@tunbury.org>

avsm added a commit to avsm/prometheus that referenced this pull request

Aug 6, 2026
Introduce the `prometheus-lwt` package with the API that the core will keep
once its Lwt dependency is removed (mirage#60 mirage#65), but implemented for now via Lwt
support still present in `prometheus`.
Therefore nothing breaks in this release as existing users can migrate to
`Prometheus_lwt` and also to the new synchronous `_fn` functions at their own
pace. The actual interface break will then happen in a later release without
further source changes for migrated Lwt users.
Also add synchronous variants of the timing helpers to the core since the
existing Lwt-typed functions occupy the unsuffixed names until the break.
Suggested by @talex5 in mirage#65.
Co-authored-by: Mark Elvers <mark.elvers@tunbury.org>

@avsm avsm mentioned this pull request

Aug 6, 2026

Merged

talex5 added a commit to avsm/prometheus that referenced this pull request

Aug 6, 2026
Introduce the `prometheus-lwt` package with the API that the core will keep
once its Lwt dependency is removed (mirage#60 mirage#65), but implemented for now via Lwt
support still present in `prometheus`.
Therefore nothing breaks in this release as existing users can migrate to
`Prometheus_lwt` and also to the new synchronous functions at their own
pace. The actual interface break will then happen in a later release without
further source changes for migrated Lwt users.
Also add synchronous variants of the timing helpers to the core since the
existing Lwt-typed functions occupy the unsuffixed names until the break.
Suggested by @talex5 in mirage#65.
Co-authored-by: Mark Elvers <mark.elvers@tunbury.org>
Co-authored-by: Thomas Leonard <talex5@gmail.com>

Merged

Read the original on github.com ↗