Skip to content

fix(metrics-simple): support prototype-like metric names and labels - #3680

Open
fengxueweilai wants to merge 1 commit into
libp2p:mainfrom
fengxueweilai:my_feature
Open

fengxueweilai wants to merge 1 commit into
libp2p:mainfrom
fengxueweilai:my_feature

Conversation

@fengxueweilai

@fengxueweilai fengxueweilai commented Oct 23, 2026 •

Copy link
Copy Markdown

Title

Description

Metrics and group labels are arbitrary strings, but plain-object accumulators treat names such as constructor, toString and __proto__ as inherited properties. Histogram/summary observations may throw, and some values disappear from emitted metrics.

Use dictionaries with no prototype for internal label storage and collection accumulators. Cover all four group types and an emitted root metric named __proto__ through the public metrics API.

Notes & open questions

Change checklist

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation if necessary (this includes comments as well)
  • I have added tests that prove my fix is effective or that my feature works

Signed-off-by: fengxueweilai <fengxueweilai@outlook.com>
@fengxueweilai
fengxueweilai requested a review from a team as a code owner October 23, 2026 06:19

This branch has not been deployed

No deployments
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.

1 participant