EMRY-003: MetricId registry #4

Closed
opened 2026-06-24 00:20:39 +00:00 by vxfemboy · 1 comment
vxfemboy commented 2026-06-24 00:20:39 +00:00 (Migrated from github.com)

MetricId intern table

Tasks

  • MetricRegistry::register(&str) -> MetricId
  • MetricRegistry::name(MetricId) -> &str
  • Max 65535 metrics (u16)
  • Tests: stable IDs, duplicate register returns same id

Acceptance

  • Registry used in hot-path design doc comment

Depends on: EMRY-001
Estimate: 3h

## MetricId intern table ### Tasks - [ ] `MetricRegistry::register(&str) -> MetricId` - [ ] `MetricRegistry::name(MetricId) -> &str` - [ ] Max 65535 metrics (u16) - [ ] Tests: stable IDs, duplicate register returns same id ### Acceptance - [ ] Registry used in hot-path design doc comment **Depends on:** EMRY-001 **Estimate:** 3h
vxfemboy commented 2026-06-25 00:14:17 +00:00 (Migrated from github.com)

Done in commit 97b6354 on branch emry-002-event-types.

MetricRegistry in emry-core/src/registry.rs:

  • register(&str) -> MetricId, idempotent (duplicate name returns same id)
  • try_register(&str) -> Option for the full-table case
  • name(MetricId) -> Option<&str>, get(&str) -> Option
  • MAX_METRICS = 65_536 (u16 range); register panics past the cap, try_register returns None
  • Dense ids from 0; stable-id and overflow tests; 100% line coverage
Done in commit 97b6354 on branch emry-002-event-types. MetricRegistry in emry-core/src/registry.rs: - register(&str) -> MetricId, idempotent (duplicate name returns same id) - try_register(&str) -> Option<MetricId> for the full-table case - name(MetricId) -> Option<&str>, get(&str) -> Option<MetricId> - MAX_METRICS = 65_536 (u16 range); register panics past the cap, try_register returns None - Dense ids from 0; stable-id and overflow tests; 100% line coverage
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
femboy/emry#4
No description provided.