[
https://issues.apache.org/jira/browse/SOLR-10654?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16006214#comment-16006214
]
Andrzej Bialecki commented on SOLR-10654:
------------------------------------------
I see, it's an interesting issue. The metrics API as it is today is focused on
the push model, but indeed the MetricsHandler seems like the ideal place for
adding custom formats to support pull models. However, response writers are
registered globally per SolrCore, and it seems weird and potentially misleading
to globally register a writer that is a) handler-specific, b) supports only
numeric values.
OTOH there are precedents for a) above - graphml, schema.xml and filestream
writers. There are also precedents for b) - handlers that accept requests in
one format but return response in a different (hardcoded) format, eg.
{{ExportHandler}}, so maybe it's not such a big deal...
In the current patch the registration is hardcoded - it would have to be made
more dynamic. Eg. you could consider adding generic support for custom pull
formats to {{MetricsHandler}}, which would go through every
{{SolrMetricReporter}} instance that implements a {{SolrMetricPullReporter}}
(what an ugly name...) or something like that, and register its response
writers and WT-s that it supports, and then based on either a reporter name, or
path or WT, call a method from that interface to prepare a report to be
serialized.
Current patch also ignores all metric / property filtering logic present in
{{MetricsHandler.handleRequestBody}} - I understand that {{DropwizardExports}}
doesn't support any filtering, but it should be possible to reimplement this
using {{MetricUtils.toMaps}} or similar methods from {{MetricUtils}}.
And finally, Solr now uses many non-numeric gauges, most notably {{String}} and
a dynamic {{MetricsMap}}, so you would have to add a special treatment for
these.
> Expose Metrics in Prometheus format
> -----------------------------------
>
> Key: SOLR-10654
> URL: https://issues.apache.org/jira/browse/SOLR-10654
> Project: Solr
> Issue Type: Improvement
> Security Level: Public(Default Security Level. Issues are Public)
> Components: metrics
> Reporter: Keith Laban
>
> Expose metrics via a `wt=prometheus` response type.
> Example scape_config in prometheus.yml:
> {code}
> scrape_configs:
> - job_name: 'solr'
> metrics_path: '/solr/admin/metrics'
> params:
> wt: ["prometheus"]
> static_configs:
> - targets: ['localhost:8983']
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]