Skip to content

chore(metrics): introduce enums for metric names#25342

Open
thomasqueirozb wants to merge 18 commits intomasterfrom
chore/typed-metric-name-enums
Open

chore(metrics): introduce enums for metric names#25342
thomasqueirozb wants to merge 18 commits intomasterfrom
chore/typed-metric-name-enums

Conversation

@thomasqueirozb
Copy link
Copy Markdown
Contributor

@thomasqueirozb thomasqueirozb commented May 1, 2026

Summary

Replaces raw string literals in counter!, histogram!, and gauge! macro calls with typed enums: CounterName, HistogramName, and GaugeName — defined in vector-common. The wrapper macros enforce at compile time that each macro receives the correct enum type, making the full set of internal metric names discoverable and exposable via the API.

Vector configuration

NA

How did you test this PR?

make check-clippy and cargo check --workspace pass clean.

Change Type

  • Bug fix
  • New feature
  • Dependencies
  • Non-functional (chore, refactoring, docs)
  • Performance

Is this a breaking change?

  • Yes
  • No

Does this PR include user facing changes?

  • Yes. Please add a changelog fragment based on our guidelines.
  • No. A maintainer will apply the no-changelog label to this PR.

References

#21735 (undocumented metrics)

@thomasqueirozb thomasqueirozb added the no-changelog Changes in this PR do not need user-facing explanations in the release changelog label May 1, 2026
@github-actions github-actions Bot added domain: topology Anything related to Vector's topology code domain: sources Anything related to the Vector's sources domain: core Anything related to core crates i.e. vector-core, core-common, etc labels May 1, 2026
@thomasqueirozb thomasqueirozb changed the title chore: introduce typed CounterName/HistogramName/GaugeName enums for internal metrics chore(metrics): introduce enums for metric names May 1, 2026
@thomasqueirozb thomasqueirozb marked this pull request as ready for review May 1, 2026 15:22
@thomasqueirozb thomasqueirozb requested a review from a team as a code owner May 1, 2026 15:22
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8f769eed08

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/internal_events/windows.rs Outdated
Copy link
Copy Markdown
Member

@pront pront left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good improvement lib/vector-common/src/internal_event/metric_name.rs we can also start generating docs from this.

Comment thread benches/metrics_snapshot.rs Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain: core Anything related to core crates i.e. vector-core, core-common, etc domain: sources Anything related to the Vector's sources domain: topology Anything related to Vector's topology code no-changelog Changes in this PR do not need user-facing explanations in the release changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants