Skip to content

feat: add getClusterMetricsAsJSON to cluster registries (#470) - #849

Open
amasen02 wants to merge 1 commit into
prometheus:mainfrom
amasen02:feat/cluster-metrics-as-json-470
Open

feat: add getClusterMetricsAsJSON to cluster registries (#470)#849
amasen02 wants to merge 1 commit into
prometheus:mainfrom
amasen02:feat/cluster-metrics-as-json-470

Conversation

@amasen02

@amasen02 amasen02 commented Sep 4, 2026

Copy link
Copy Markdown

Summary

  • Adds \getClusterMetricsAsJSON(aggregator?: string)\ to \AggregatorRegistry\ and \ClusterRegistry\ to expose aggregated cluster metrics as parsed JSON objects, mirroring \Registry#getMetricsAsJSON().
  • Refactors #gather()\ and collection coordination into #aggregateMetrics(transform)\ so that both \clusterMetrics()\ and \getClusterMetricsAsJSON()\ share identical collection and worker lifecycle logic without duplicating code.
  • Ensures \shutdown()\ continues to cleanly track and await in-flight aggregated metrics requests through completion before exiting.
  • Updates TypeScript definitions in \index.d.ts\ for both \ClusterRegistry\ and \AggregatorRegistry.
  • Adds comprehensive unit test coverage in \ est/clusterTest.js\ verifying empty cluster state, multi-worker JSON aggregation ordering, and aggregator filtering (\sum/\omit), as well as compile-time type verification in \ est/typescript.ts.
  • Updates \README.md\ documentation with usage example.

Closes #470.

Verification


  • pm run lint\ (clean, 0 warnings/errors)

  • pm run check-prettier\ (all files formatted)

  • pm run compile-typescript\ (clean compilation)

  • pm run test-unit -- --coverage\ (31 suites passed, 603 tests passed, 34 snapshots passed)

Signed-off-by: amasen02 <amasen02@users.noreply.github.com>
@amasen02
amasen02 force-pushed the feat/cluster-metrics-as-json-470 branch from 68c7829 to 22f37a4 Compare September 4, 2026 09:52
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.

Please consider adding a getClusterMetricsAsJSON funtion

1 participant