Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-32649

Mismatch label and value for prometheus reporter

    XMLWordPrintableJSON

Details

    Description

      When runing unit test 'org.apache.flink.metrics.prometheus.PrometheusReporterTest#metricIsRemovedWhileOtherMetricsWithSameNameExist', it got wrong response string as 

      # HELP flink_logical_scope_metric metric (scope: logical_scope)
      # TYPE flink_logical_scope_metric gauge
      flink_logical_scope_metric{label1="some_value",label2="value1",} 0.0 

       

      in my opinion, the expected right response is :

       

      # HELP flink_logical_scope_metric metric (scope: logical_scope)
      # TYPE flink_logical_scope_metric gauge
      flink_logical_scope_metric{label1="value1",label2="some_value",} 0.0
       

       

       

      The reason may be we create two metric with same name, but two different order  label-keys in the variables of MetricGroup. And we don't sort the key&value in variables within methond 'org.apache.flink.metrics.prometheus.AbstractPrometheusReporter#notifyOfAddedMetric'.

       

      Maybe it won't happen in production env now, howerver it's important to ensure the robustness of method with unpected input param.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              stupid_pig chenyuzhi
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: