From a56fc7b16b161e041d2b11de1f84965460ef49c9 Mon Sep 17 00:00:00 2001 From: Claudio Atzori Date: Fri, 13 Jul 2018 15:32:55 +0200 Subject: [PATCH] simplified conversion rule --- solr/templates/solr-exporter-config.xml | 340 ++++-------------------- 1 file changed, 55 insertions(+), 285 deletions(-) diff --git a/solr/templates/solr-exporter-config.xml b/solr/templates/solr-exporter-config.xml index 67200fcc..232f5495 100644 --- a/solr/templates/solr-exporter-config.xml +++ b/solr/templates/solr-exporter-config.xml @@ -1647,29 +1647,15 @@ (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | $parent.value | to_entries | .[] | select(.key | endswith("select.requestTimes")) as $object | - $object.key | split(".")[0] as $category | - $object.key | split(".")[1] as $handler | - select($handler | startswith("/")) | - ($object.count) as $value | - if $parent_key_item_len == 3 then + ($object.value.count) as $value | { - name: "solr_metrics_core_query_count", - type: "COUNTER", - help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", - label_names: ["category", "handler", "core"], - label_values: [$category, $handler, $core], - value: $value + name: "solr_metrics_core_query_count", + type: "COUNTER", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["core", "collection", "shard", "replica"], + label_values: [$core, $collection, $shard, $replica], + value: $value } - else - { - name: "solr_metrics_core_query_count", - type: "COUNTER", - help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", - label_names: ["category", "handler", "core", "collection", "shard", "replica"], - label_values: [$category, $handler, $core, $collection, $shard, $replica], - value: $value - } - end .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | @@ -1681,29 +1667,15 @@ (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | $parent.value | to_entries | .[] | select(.key | endswith("select.requestTimes")) as $object | - $object.key | split(".")[0] as $category | - $object.key | split(".")[1] as $handler | - select($handler | startswith("/")) | - ($object.meanRate) as $value | - if $parent_key_item_len == 3 then + ($object.value.meanRate) as $value | { name: "solr_metrics_core_query_meanrate", type: "GAUGE", help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", - label_names: ["category", "handler", "core"], - label_values: [$category, $handler, $core], + label_names: ["core", "collection", "shard", "replica"], + label_values: [$core, $collection, $shard, $replica], value: $value } - else - { - name: "solr_metrics_core_query_meanrate", - type: "GAUGE", - help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", - label_names: ["category", "handler", "core", "collection", "shard", "replica"], - label_values: [$category, $handler, $core, $collection, $shard, $replica], - value: $value - } - end .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | @@ -1715,29 +1687,15 @@ (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | $parent.value | to_entries | .[] | select(.key | endswith("select.requestTimes")) as $object | - $object.key | split(".")[0] as $category | - $object.key | split(".")[1] as $handler | - select($handler | startswith("/")) | - ($object.1minRate) as $value | - if $parent_key_item_len == 3 then + ($object.value.1minRate) as $value | { - name: "solr_metrics_core_query_1minrate", - type: "GAUGE", - help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", - label_names: ["category", "handler", "core"], - label_values: [$category, $handler, $core], - value: $value + name: "solr_metrics_core_query_1minrate", + type: "GAUGE", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["core", "collection", "shard", "replica"], + label_values: [$core, $collection, $shard, $replica], + value: $value } - else - { - name: "solr_metrics_core_query_1minrate", - type: "GAUGE", - help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", - label_names: ["category", "handler", "core", "collection", "shard", "replica"], - label_values: [$category, $handler, $core, $collection, $shard, $replica], - value: $value - } - end .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | @@ -1749,29 +1707,15 @@ (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | $parent.value | to_entries | .[] | select(.key | endswith("select.requestTimes")) as $object | - $object.key | split(".")[0] as $category | - $object.key | split(".")[1] as $handler | - select($handler | startswith("/")) | - ($object.5minRate) as $value | - if $parent_key_item_len == 3 then + ($object.value.5minRate) as $value | { - name: "solr_metrics_core_query_5minrate", - type: "GAUGE", - help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", - label_names: ["category", "handler", "core"], - label_values: [$category, $handler, $core], - value: $value + name: "solr_metrics_core_query_5minrate", + type: "GAUGE", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["core", "collection", "shard", "replica"], + label_values: [$core, $collection, $shard, $replica], + value: $value } - else - { - name: "solr_metrics_core_query_5minrate", - type: "GAUGE", - help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", - label_names: ["category", "handler", "core", "collection", "shard", "replica"], - label_values: [$category, $handler, $core, $collection, $shard, $replica], - value: $value - } - end .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | @@ -1783,29 +1727,15 @@ (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | $parent.value | to_entries | .[] | select(.key | endswith("select.requestTimes")) as $object | - $object.key | split(".")[0] as $category | - $object.key | split(".")[1] as $handler | - select($handler | startswith("/")) | - ($object.15minRate) as $value | - if $parent_key_item_len == 3 then + ($object.value.15minRate) as $value | { name: "solr_metrics_core_query_15minrate", type: "GAUGE", help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", - label_names: ["category", "handler", "core"], - label_values: [$category, $handler, $core], + label_names: ["core", "collection", "shard", "replica"], + label_values: [$core, $collection, $shard, $replica], value: $value } - else - { - name: "solr_metrics_core_query_15minrate", - type: "GAUGE", - help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", - label_names: ["category", "handler", "core", "collection", "shard", "replica"], - label_values: [$category, $handler, $core, $collection, $shard, $replica], - value: $value - } - end .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | @@ -1817,29 +1747,15 @@ (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | $parent.value | to_entries | .[] | select(.key | endswith("select.requestTimes")) as $object | - $object.key | split(".")[0] as $category | - $object.key | split(".")[1] as $handler | - select($handler | startswith("/")) | - ($object.min_ms) as $value | - if $parent_key_item_len == 3 then + ($object.value.min_ms) as $value | { name: "solr_metrics_core_query_min_ms", type: "GAUGE", help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", - label_names: ["category", "handler", "core"], - label_values: [$category, $handler, $core], + label_names: ["core", "collection", "shard", "replica"], + label_values: [$core, $collection, $shard, $replica], value: $value } - else - { - name: "solr_metrics_core_query_min_ms", - type: "GAUGE", - help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", - label_names: ["category", "handler", "core", "collection", "shard", "replica"], - label_values: [$category, $handler, $core, $collection, $shard, $replica], - value: $value - } - end .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | @@ -1851,29 +1767,15 @@ (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | $parent.value | to_entries | .[] | select(.key | endswith("select.requestTimes")) as $object | - $object.key | split(".")[0] as $category | - $object.key | split(".")[1] as $handler | - select($handler | startswith("/")) | - ($object.max_ms) as $value | - if $parent_key_item_len == 3 then + ($object.value.max_ms) as $value | { name: "solr_metrics_core_query_max_ms", type: "GAUGE", help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", - label_names: ["category", "handler", "core"], - label_values: [$category, $handler, $core], + label_names: ["core", "collection", "shard", "replica"], + label_values: [$core, $collection, $shard, $replica], value: $value } - else - { - name: "solr_metrics_core_query_max_ms", - type: "GAUGE", - help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", - label_names: ["category", "handler", "core", "collection", "shard", "replica"], - label_values: [$category, $handler, $core, $collection, $shard, $replica], - value: $value - } - end .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | @@ -1885,63 +1787,15 @@ (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | $parent.value | to_entries | .[] | select(.key | endswith("select.requestTimes")) as $object | - $object.key | split(".")[0] as $category | - $object.key | split(".")[1] as $handler | - select($handler | startswith("/")) | - ($object.max_ms) as $value | - if $parent_key_item_len == 3 then - { - name: "solr_metrics_core_query_max_ms", - type: "GAUGE", - help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", - label_names: ["category", "handler", "core"], - label_values: [$category, $handler, $core], - value: $value - } - else - { - name: "solr_metrics_core_query_max_ms", - type: "GAUGE", - help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", - label_names: ["category", "handler", "core", "collection", "shard", "replica"], - label_values: [$category, $handler, $core, $collection, $shard, $replica], - value: $value - } - end - - - .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | - $parent.key | split(".") as $parent_key_items | - $parent_key_items | length as $parent_key_item_len | - (if $parent_key_item_len == 3 then $parent_key_items[2] else "" end) as $core | - (if $parent_key_item_len == 5 then $parent_key_items[2] else "" end) as $collection | - (if $parent_key_item_len == 5 then $parent_key_items[3] else "" end) as $shard | - (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | - (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | - $parent.value | to_entries | .[] | select(.key | endswith("select.requestTimes")) as $object | - $object.key | split(".")[0] as $category | - $object.key | split(".")[1] as $handler | - select($handler | startswith("/")) | - ($object.mean_ms) as $value | - if $parent_key_item_len == 3 then + ($object.value.mean_ms) as $value | { name: "solr_metrics_core_query_mean_ms", type: "GAUGE", help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", - label_names: ["category", "handler", "core"], - label_values: [$category, $handler, $core], + label_names: ["core", "collection", "shard", "replica"], + label_values: [$core, $collection, $shard, $replica], value: $value } - else - { - name: "solr_metrics_core_query_mean_ms", - type: "GAUGE", - help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", - label_names: ["category", "handler", "core", "collection", "shard", "replica"], - label_values: [$category, $handler, $core, $collection, $shard, $replica], - value: $value - } - end .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | @@ -1953,29 +1807,15 @@ (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | $parent.value | to_entries | .[] | select(.key | endswith("select.requestTimes")) as $object | - $object.key | split(".")[0] as $category | - $object.key | split(".")[1] as $handler | - select($handler | startswith("/")) | - ($object.median_ms) as $value | - if $parent_key_item_len == 3 then + ($object.value.median_ms) as $value | { name: "solr_metrics_core_query_median_ms", type: "GAUGE", help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", - label_names: ["category", "handler", "core"], - label_values: [$category, $handler, $core], + label_names: ["core", "collection", "shard", "replica"], + label_values: [$core, $collection, $shard, $replica], value: $value } - else - { - name: "solr_metrics_core_query_median_ms", - type: "GAUGE", - help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", - label_names: ["category", "handler", "core", "collection", "shard", "replica"], - label_values: [$category, $handler, $core, $collection, $shard, $replica], - value: $value - } - end .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | @@ -1987,29 +1827,15 @@ (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | $parent.value | to_entries | .[] | select(.key | endswith("select.requestTimes")) as $object | - $object.key | split(".")[0] as $category | - $object.key | split(".")[1] as $handler | - select($handler | startswith("/")) | - ($object.stddev_ms) as $value | - if $parent_key_item_len == 3 then + ($object.value.stddev_ms) as $value | { name: "solr_metrics_core_query_stddev_ms", type: "GAUGE", help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", - label_names: ["category", "handler", "core"], - label_values: [$category, $handler, $core], + label_names: ["core", "collection", "shard", "replica"], + label_values: [$core, $collection, $shard, $replica], value: $value } - else - { - name: "solr_metrics_core_query_stddev_ms", - type: "GAUGE", - help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", - label_names: ["category", "handler", "core", "collection", "shard", "replica"], - label_values: [$category, $handler, $core, $collection, $shard, $replica], - value: $value - } - end .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | @@ -2021,29 +1847,15 @@ (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | $parent.value | to_entries | .[] | select(.key | endswith("select.requestTimes")) as $object | - $object.key | split(".")[0] as $category | - $object.key | split(".")[1] as $handler | - select($handler | startswith("/")) | - ($object.p75_ms) as $value | - if $parent_key_item_len == 3 then + ($object.value.p75_ms) as $value | { name: "solr_metrics_core_query_p75_ms", type: "GAUGE", help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", - label_names: ["category", "handler", "core"], - label_values: [$category, $handler, $core], + label_names: ["core", "collection", "shard", "replica"], + label_values: [$core, $collection, $shard, $replica], value: $value } - else - { - name: "solr_metrics_core_query_p75_ms", - type: "GAUGE", - help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", - label_names: ["category", "handler", "core", "collection", "shard", "replica"], - label_values: [$category, $handler, $core, $collection, $shard, $replica], - value: $value - } - end .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | @@ -2055,29 +1867,15 @@ (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | $parent.value | to_entries | .[] | select(.key | endswith("select.requestTimes")) as $object | - $object.key | split(".")[0] as $category | - $object.key | split(".")[1] as $handler | - select($handler | startswith("/")) | - ($object.p95_ms) as $value | - if $parent_key_item_len == 3 then + ($object.value.p95_ms) as $value | { name: "solr_metrics_core_query_p95_ms", type: "GAUGE", help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", - label_names: ["category", "handler", "core"], - label_values: [$category, $handler, $core], + label_names: ["core", "collection", "shard", "replica"], + label_values: [$core, $collection, $shard, $replica], value: $value } - else - { - name: "solr_metrics_core_query_p95_ms", - type: "GAUGE", - help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", - label_names: ["category", "handler", "core", "collection", "shard", "replica"], - label_values: [$category, $handler, $core, $collection, $shard, $replica], - value: $value - } - end .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | @@ -2089,29 +1887,15 @@ (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | $parent.value | to_entries | .[] | select(.key | endswith("select.requestTimes")) as $object | - $object.key | split(".")[0] as $category | - $object.key | split(".")[1] as $handler | - select($handler | startswith("/")) | - ($object.p99_ms) as $value | - if $parent_key_item_len == 3 then + ($object.value.p99_ms) as $value | { name: "solr_metrics_core_query_p99_ms", type: "GAUGE", help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", - label_names: ["category", "handler", "core"], - label_values: [$category, $handler, $core], + label_names: ["core", "collection", "shard", "replica"], + label_values: [$core, $collection, $shard, $replica], value: $value } - else - { - name: "solr_metrics_core_query_p99_ms", - type: "GAUGE", - help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", - label_names: ["category", "handler", "core", "collection", "shard", "replica"], - label_values: [$category, $handler, $core, $collection, $shard, $replica], - value: $value - } - end .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | @@ -2123,31 +1907,17 @@ (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | $parent.value | to_entries | .[] | select(.key | endswith("select.requestTimes")) as $object | - $object.key | split(".")[0] as $category | - $object.key | split(".")[1] as $handler | - select($handler | startswith("/")) | - ($object.p999_ms) as $value | - if $parent_key_item_len == 3 then + ($object.value.p999_ms) as $value | { name: "solr_metrics_core_query_p999_ms", type: "GAUGE", help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", - label_names: ["category", "handler", "core"], - label_values: [$category, $handler, $core], + label_names: ["core", "collection", "shard", "replica"], + label_values: [$core, $collection, $shard, $replica], value: $value } - else - { - name: "solr_metrics_core_query_p999_ms", - type: "GAUGE", - help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", - label_names: ["category", "handler", "core", "collection", "shard", "replica"], - label_values: [$category, $handler, $core, $collection, $shard, $replica], - value: $value - } - end - +