You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sh...@apache.org on 2019/03/14 05:46:45 UTC

[lucene-solr] branch branch_7_7 updated: SOLR-13234: Fix for turkish locales

This is an automated email from the ASF dual-hosted git repository.

shalin pushed a commit to branch branch_7_7
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/branch_7_7 by this push:
     new 29179f4  SOLR-13234: Fix for turkish locales
29179f4 is described below

commit 29179f448abaa57e7eceabbbbeb881f39a5e1edd
Author: Shalin Shekhar Mangar <sh...@apache.org>
AuthorDate: Thu Mar 14 11:10:49 2019 +0530

    SOLR-13234: Fix for turkish locales
    
    WhenSolrExporterIntegrationTest.jvmMetrics ran on a JVM with the Turkish locale, (test seed: 62880F3B9F140C89). The JVM metric for terminated thread-count has a dotless-i e.g. termınated.
    This causes the check for matching metrics to fail.
    
    We could normalize the text in this case, however I think it's better to ensure we have the correct total number of JVM thread metrics rather than looking at Prometheus labels which maybe localized.
    
    This closes #605.
    
    (cherry picked from commit 6d0386c901b9d14c7464c7cf286d4a005eb9c72c)
---
 .../prometheus/exporter/SolrExporterIntegrationTest.java     | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/solr/contrib/prometheus-exporter/src/test/org/apache/solr/prometheus/exporter/SolrExporterIntegrationTest.java b/solr/contrib/prometheus-exporter/src/test/org/apache/solr/prometheus/exporter/SolrExporterIntegrationTest.java
index e71f0b4..4ad59d6 100644
--- a/solr/contrib/prometheus-exporter/src/test/org/apache/solr/prometheus/exporter/SolrExporterIntegrationTest.java
+++ b/solr/contrib/prometheus-exporter/src/test/org/apache/solr/prometheus/exporter/SolrExporterIntegrationTest.java
@@ -33,10 +33,10 @@ public class SolrExporterIntegrationTest extends SolrExporterTestBase {
     startMetricsExporterWithConfiguration("conf/prometheus-solr-exporter-integration-test-config.xml");
   }
 
-  private Map<String, Double> metricsWithName(Map<String, Double> allMetrics, String name) {
+  private Map<String, Double> metricsWithName(Map<String, Double> allMetrics, String desiredMetricName) {
     return allMetrics.entrySet()
         .stream()
-        .filter(entry -> entry.getKey().startsWith(name))
+        .filter(entry -> entry.getKey().startsWith(desiredMetricName))
         .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
   }
 
@@ -64,8 +64,12 @@ public class SolrExporterIntegrationTest extends SolrExporterTestBase {
 
   @Test
   public void jvmMetrics() throws Exception {
-    Map<String, Double> jvmMetrics = metricsWithName(getAllMetrics(), "solr_metrics_jvm_threads{item=\"terminated\"");
-    assertEquals(NUM_NODES, jvmMetrics.size());
+    Map<String, Double> jvmMetrics = metricsWithName(
+        getAllMetrics(), "solr_metrics_jvm_threads");
+
+    // Include all thread states + plus overall count + number of daemon threads + number of deadlocked threads
+    assertEquals(NUM_NODES * (Thread.State.values().length + 3),
+        jvmMetrics.size());
   }
 
   @Test