feat: adds metrics interface - #123
Conversation
3a1ec14 to
0f73d6b
Compare
There was a problem hiding this comment.
Pull request overview
Adds a new, backend-agnostic observability surface for Skip Graph nodes by introducing metrics-recording traits and bounded label enums, and exposes the observability module publicly so node code (and future backends) can depend on a stable interface without pulling in a metrics SDK.
Changes:
- Introduces
observabilitymodule with metrics traits (SearchMetrics,LookupTableMetrics,NetworkMetrics) plus a composedNodeMetricssurface and unimock-generated doubles. - Adds closed-enum label types (
SearchOutcome,MessageType,LevelBucket) withLevelBucketbucketing logic and tests for boundary behavior. - Promotes
core::model::directionmodule visibility soDirectioncan be used in public metrics trait signatures and re-exported viaobservability.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/observability/mod.rs | Defines the public observability module surface and re-exports traits/labels (and Direction). |
| src/observability/metrics.rs | Adds backend-free metrics traits with unimock doubles and a composite NodeMetrics trait. |
| src/observability/labels.rs | Adds bounded label enums and LevelBucket bucketing to keep label cardinality constrained. |
| src/observability/labels_test.rs | Tests bucket mapping across boundaries and overflow behavior. |
| src/lib.rs | Exposes observability as a public module from the crate root. |
| src/core/model/mod.rs | Makes direction module public to support public trait signatures. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Claude (@claude) review this PR |
|
Claude finished S T (@staheri14)'s task —— View job Review: PR #123 — metrics interfaceNice, clean interface-only PR. The design is well thought out: infallibility + cardinality contracts documented in the module header, closed-enum labels, and a blanket-impl Strengths
Suggestions (non-blocking)
VerificationI couldn't run Overall: solid, well-documented interface. The main thing I'd resolve before wiring is the |
|
Thanks for the review. Dispositions:
3 & 4.
|
Implements #109: the trait interface the node code will record metrics against. Interface only; no backend yet.
Included in the PR
observabilitymodule: the recording traits (SearchMetrics,LookupTableMetrics,NetworkMetrics) and theirNodeMetricscomposite, the label enums they use, and a unimock double per trait.Directionpromoted topub(now used in a public trait signature; this is whycore/is touched).Follow-ups
Closes #109.