mlbiscoc opened a new pull request, #2902:
URL: https://github.com/apache/solr/pull/2902

   https://issues.apache.org/jira/browse/SOLR-17587
   
   <!--
   _(If you are a project committer then you may remove some/all of the 
following template.)_
   
   Before creating a pull request, please file an issue in the ASF Jira system 
for Solr:
   
   * https://issues.apache.org/jira/projects/SOLR
   
   For something minor (i.e. that wouldn't be worth putting in release notes), 
you can skip JIRA. 
   To create a Jira issue, you will need to create an account there first.
   
   The title of the PR should reference the Jira issue number in the form:
   
   * SOLR-####: <short description of problem or changes>
   
   SOLR must be fully capitalized. A short description helps people scanning 
pull requests for items they can work on.
   
   Properly referencing the issue in the title ensures that Jira is correctly 
updated with code review comments and commits. -->
   
   
   # Description
   
   Solr's Prometheus writer duplicates `# TYPE <metric name> <prometheus metric 
type>` in it's exposition format for `core`registry metrics. 
   
   This is an illegal format and depending on the technologies prometheus 
exposition verification for example `Telegraf`, this will fail. For Prometheus 
server itself, this still passes and collects the metrics just fine for some 
reason.
   
   This is because the Prometheus Writer takes Dropwizard registries and 
exports them to Prometheus Registries to expose them in Prometheus format. Solr 
creates Dropwizard registry for every `core` and differentiates the metrics 
that way even though they have the same metric names.
   
   For prometheus, this creates an issue in that metrics should be 
differentiated in it's attributes and tags. So when the metrics are output with 
the Prometheus response writer, it duplicates the `TYPE` information because it 
is a registry for every `core` and doesn't know that the other `core` 
registries have the same metric name and results in duplicate `TYPE` 
information.
   
   # Solution
   
   When metrics are going to be exported for prometheus, we merge all the 
`core` Dropwizard metric registries into a single registry and export that 
registry into prometheus. Duplicate metric names in a registry is not allowed 
in prometheus, so we will also append the core name to the Dropwizard metric to 
differentiate which metric belongs to what core and parse the labels 
accordingly.
   
   This also allowed to clean up and simply some of the 
`SolrPrometheusCoreFormatter` code.
   
   # Tests
   
   Updated the test accordingly with the coreName existing in the Dropwizard 
metric names and it's parsing. 
   
   Also added an assert in `testPrometheusStructureOutput` to confirm there is 
no duplicate `TYPE` information in prometheus output.
   
   # Checklist
   
   Please review the following and check all that apply:
   
   - [ ] I have reviewed the guidelines for [How to 
Contribute](https://github.com/apache/solr/blob/main/CONTRIBUTING.md) and my 
code conforms to the standards described there to the best of my ability.
   - [ ] I have created a Jira issue and added the issue ID to my pull request 
title.
   - [ ] I have given Solr maintainers 
[access](https://help.github.com/en/articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork)
 to contribute to my PR branch. (optional but recommended, not available for 
branches on forks living under an organisation)
   - [ ] I have developed this patch against the `main` branch.
   - [ ] I have run `./gradlew check`.
   - [ ] I have added tests for my changes.
   - [ ] I have added documentation for the [Reference 
Guide](https://github.com/apache/solr/tree/main/solr/solr-ref-guide)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to