Skip to content

metric: restrict constructor assignment to supported options - #866

Open
SidheshwarSarangal wants to merge 1 commit into
prometheus:mainfrom
SidheshwarSarangal:contributor/explicit-metric-config
Open

SidheshwarSarangal wants to merge 1 commit into
prometheus:mainfrom
SidheshwarSarangal:contributor/explicit-metric-config

Conversation

@SidheshwarSarangal

Copy link
Copy Markdown

Metric constructors currently copy arbitrary configuration properties onto the instance, allowing unexpected fields to replace methods or change its prototype.

Restrict assignment to common options and options declared by subclasses through their defaults. Preserve Histogram and Summary settings, ignore unknown options without evaluating their getters, and document the behavior.

Relates to #814.

Validation: npm test -- --runInBand passed, including lint, formatting, TypeScript checks, 664 tests, and 34 snapshots.

AI assistance was used to prepare the implementation and tests.

@jdmarshall, does this approach fit the constructor changes you outlined in #814?

Ignore unexpected configuration fields while preserving common and subclass options. Add regression tests and document the behavior.

Relates to prometheus#814

Signed-off-by: Sidheshwar Sarangal <sidheshwar.sarangal@gmail.com>

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