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

Mismatch label and value for prometheus reporter

Attach filesAttach ScreenshotAdd voteVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    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

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            stupid_pig chenyuzhi

            Dates

              Created:
              Updated:

              Slack

                Issue deployment