Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4.x: Neutral metrics API - revise MetricsFeature and rework Prometheus and JSON formatting #1

Open
wants to merge 41 commits into
base: neutral-metrics-api
Choose a base branch
from

Conversation

tjquinno
Copy link
Owner

@tjquinno tjquinno commented Aug 16, 2023

Description

Continuing work on helidon-io#4868
This PR works forward from helidon-io#7261.

These changes update some of the basic classes (not drastically) and start the changes to the MetricsFeature to use the new API.

Internal changes in how we format /metrics output

To help keep dependencies cleaner, this PR rearranges how we format metrics output for the /metrics endpoint. The MetricsFeature class, primarily, needs to be able to format the output in arbitrary ways, selected by the media type. To do this without building hard dependencies from the feature module to Micrometer and the Micrometer Prometheus code (and potentially any other formatting approach), this PR introduces a service loader approach for formatting the output.

The feature code now service-loads all MeterRegistryFormatterProvider implementations (the PR includes Micrometer Prometheus and JSON) and then invokes the formatter(MediaType) method on each. If the returned Optional<MeterRegistryFormatter> is present then that provider handles that media type and the feature code uses that formatter. Otherwise the feature keeps looking for a provider that does handle the media type. If the feature finds none, then it returns a "406 - not acceptable" status.

Documentation

See helidon-io#7381

…s; revise some method signatures; clean up a few things. More to come
…MP metrics so it will build while I work on the neutral metrics API
…Registry, and reworking factory and provider for obtaining a MeterRegistry from the highest-weight implementation. More work needed in the latter at least
… updates; still WIP--pushing for safe-keeping
…fig from MetricsConfig for use by Micrometer meter registry
…nit tests; some changes triggered by those tests
@tjquinno tjquinno force-pushed the neutral-metrics-api branch 2 times, most recently from f570cc0 to a8b1b46 Compare August 18, 2023 12:33
@tjquinno tjquinno force-pushed the neutral-metrics-api branch from db10c3f to 9eb9e92 Compare August 31, 2023 15:59
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