Skip to content

Conversation

@lucakovacs
Copy link

In this change:

  • I added a new servlet (/prometheus) for exposing Prometheus format metrics
  • The metrics' description can be enabled by "/prometheus?description=true" query string
  • The metrics can be filtered by "/prometheus?qry=xyz" query string

Notes:
- added a new servlet (/prometheus) for exposing Prometheus format metrics
- metrics description can be enabled by "/prometheus?description=true" query string
- metrics can be filtered by "/prometheus?qry=xyz" query string
Copy link

@MitchellJThomas MitchellJThomas left a comment

Choose a reason for hiding this comment

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

Some suggestions. You might also want to add a unit test or two.

HandlerList list = (HandlerList) handlers[0];

ServletContextHandler ctx = new ServletContextHandler();
ctx.setContextPath("/prometheus");

Choose a reason for hiding this comment

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

for (AbstractMetric metrics : metricsRecord.metrics()) {
if (metrics.type() == MetricType.COUNTER || metrics.type() == MetricType.GAUGE) {

String key = toPrometheusName(metricsRecord.name(), metrics.name());
Copy link

@MitchellJThomas MitchellJThomas Feb 16, 2023

Choose a reason for hiding this comment

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

Note that this method and its regexp could be called quite often: per metricRecord, per metric, per metric scrape interval (default scrape interval is 1 minute) could add to a bit of CPU time... if I am right, I suggest memoizing this function

Notes:
- Added some unit tests for PrometheusHadoopServlet and PrometheusEndpointServerCustomizer
- Changed PrometheusHadoopServlet.toPrometheusName() function's visibility to package-private
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.

2 participants