Skip to content

feat(metrics-registry): introduce stable registry crate with protobuf model#228

Merged
TheJokr merged 3 commits into
cloudflare:mainfrom
ethanolchik:metrics/registry-protobuf
Jul 9, 2026
Merged

feat(metrics-registry): introduce stable registry crate with protobuf model#228
TheJokr merged 3 commits into
cloudflare:mainfrom
ethanolchik:metrics/registry-protobuf

Conversation

@ethanolchik

@ethanolchik ethanolchik commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

This pull request introduces a new crate, foundations-metrics-registry, to provide a stable, minimal core for Prometheus-compatible metrics serialisation in the foundations project. Currently, the crate only includes vendored Prometheus protobuf definitions, a build script to generate Rust types, and exposes these types for use by other crates. It also updates the workspace configuration and dependencies accordingly.

New crate: foundations-metrics-registry

  • Added the foundations-metrics-registry crate to the workspace, with its own Cargo.toml and minimal dependencies, focused on stability and compatibility across major versions.

Protobuf integration

  • Vendored the official Prometheus metrics.proto file in proto/metrics.proto, providing the canonical wire format for metrics serialisation.
  • Added a build.rs script using protox and prost-build to generate Rust types from the vendored protobuf at build time.
  • Exposed the generated types in src/proto/mod.rs, including a test verifying round-trip serialisation of the (native) histogram type.
  • Included the generated code in src/proto/model.rs via a build-time include! macro.

Dependency and edition updates

  • Updated workspace dependencies to include prost, prost-build, prost-types, and protox for protobuf code generation.

@TheJokr TheJokr self-requested a review July 9, 2026 14:51
@TheJokr

TheJokr commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

/bonk run cargo fmt and fix clippy lints that crop up in the "Clippy checks" CI job. amend the changes to the previous commit.

E: ah too bad, bonk refuses to push commits to PRs from forks :/

@ask-bonk

ask-bonk Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

@TheJokr Bonk workflow was cancelled.

View workflow run · To retry, trigger Bonk again.

@TheJokr TheJokr merged commit 0f882cb into cloudflare:main Jul 9, 2026
18 checks passed
@ethanolchik ethanolchik deleted the metrics/registry-protobuf branch July 9, 2026 15:38
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.

2 participants