[ 
https://issues.apache.org/jira/browse/SOLR-10654?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17865246#comment-17865246
 ] 

Chris M. Hostetter commented on SOLR-10654:
-------------------------------------------

This is the assert that (sometimes) fails in 
{{{}MetricsHandlerTest.testPrometheusMetricsJvm{}}}...
{code:java}
    actualSnapshot = getMetricSnapshot(actualSnapshots, 
"solr_metrics_jvm_memory_pools_bytes");
    actualGaugeDataPoint =
        getGaugeDatapointSnapshot(
            actualSnapshot, Labels.of("item", "committed", "space", 
"CodeHeap-'non-nmethods'"));
    assertEquals(0, actualGaugeDataPoint.getValue(), 0);
{code}
...I couldn't fathom how that assert could ever be successful, on any JVM, and 
went down a rabbit hole of trying to figure out what it is about committed 
CodeHeap sizes that might prevent them from being used in test JVMs ... until i 
realized that you are (attempting) to stub out those gauges in your test setup 
with dummies that always return 0!

*EXCEPT:*
 * As mentioned, the lifecycle of gauges is prblematic – if any other test (or 
code path) in this JVM creates those same gauges (and doesn't explicitly 
unregister them) your stubs ill be ignored.
 * this is the *only* one of those dummy gauges that you create where you also 
{{{}assertEquals(0, ...){}}}...
 ** For all the other dummy gauges this test method looks at, the only 
assertion made is {{assertNotNull(...)}}
 ** Almost as if [you already ran into this problem with the gauges, but 
overlooked fixing this assert when you fixed all the 
others|https://github.com/mlbiscoc/solr/commit/835c946ecac04900f840ccd25cf278a6a6a2aef4]
 and added this comment...

{noformat}
    // Some JVM metrics are non-deterministic due to testing environment such as
    // availableProcessors. We confirm snapshot exists and is nonNull instead.
{noformat}

> Expose Metrics in Prometheus format DIRECTLY from Solr
> ------------------------------------------------------
>
>                 Key: SOLR-10654
>                 URL: https://issues.apache.org/jira/browse/SOLR-10654
>             Project: Solr
>          Issue Type: Improvement
>          Components: metrics
>            Reporter: Keith Laban
>            Priority: Major
>         Attachments: prometheus_metrics.txt
>
>          Time Spent: 7h 20m
>  Remaining Estimate: 0h
>
> Expose metrics via a `wt=prometheus` response type.
> Example scape_config in prometheus.yml:
> {code:java}
> scrape_configs:
>   - job_name: 'solr'
>     metrics_path: '/solr/admin/metrics'
>     params:
>       wt: ["prometheus"]
>     static_configs:
>       - targets: ['localhost:8983']
> {code}
> [Rationale|https://issues.apache.org/jira/browse/SOLR-11795?focusedCommentId=17261423&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-17261423]
>  for having this despite the "Prometheus Exporter".  They have different 
> strengths and weaknesses.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to