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

Metrics of JobManager and TaskManager overwrite each other in pushgateway

Agile BoardRank to TopRank to BottomAttach filesAttach ScreenshotBulk Copy AttachmentsBulk Move AttachmentsAdd voteVotersWatch issueWatchersCreate sub-taskConvert to sub-taskLinkCloneLabelsUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Not a Priority
    • Resolution: Unresolved
    • 1.9.0, 1.10.0, 1.11.0
    • None
    • Runtime / Metrics

    Description

          When a flink job run on yarn, metrics of jobmanager and taskmanagers will overwrite each other. The  phenomenon is that on one second you can find only jobmanager metrics on pushgateway web ui,  while on the next second you can find only taskmanager metrics on pushgateway web ui, these two kinds of metrics appear alternately. One metric of taskmanager on grafana will be like below intermittently (this taskmanager metric disappear on grafana when jobmanager metrics overwrite taskmanager metrics):

          The real reason is that Flink PrometheusPushGatewayReporter use PUT style instead of POST style to push metrics to pushgateway, what's more, taskmanagers and jobmanager use the same jobName (the only grouping key) which we configured in flink-conf.yaml. 

          Althought REST URLs are same as below, 

      /metrics/job/<JOB_NAME>{/<LABEL_NAME>/<LABEL_VALUE>}
      

      PUT and POST caused different results, as we can see below :

      • PUT is used to push a group of metrics. All metrics with the grouping key specified in the URL are replaced by the metrics pushed with PUT.
      • POST works exactly like the PUT method but only metrics with the same name as the newly pushed metrics are replaced.

          For these reasons, it's better to use POST style to push metrics to pushgateway to prevent jobmanager metrics and taskmanager metrics from overwriting each other, so that we can get continuous graph on grafana. Maybe you will say that we can set

      metrics.reporter.promgateway.randomJobNameSuffix: true

      in flink-conf.yaml, in this way, jobName from different nodes will has a random suffix and metrics will not overwrite each other any more. While we should be aware that most of users tend to use jobName as filter condition in PromQL, and using regular expressions to find exact jobName will degrade the speed of data retrieval in prometheus. 

          Everytime some body ask why metrics on grafana is discontinuous on Flink mailing list, i will tell him that you should change the style of pushing metrics to pushgateway from PUT to POST and then repackage the flink-metrics-prometheus module. So, why don't we solve the problem permanently now ? I hope to have the chance to solve the problem, sincerely.

      related links : 

      https://github.com/prometheus/pushgateway#put-method

      https://github.com/prometheus/pushgateway/issues/308

      Attachments

        Activity

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

          People

            Unassigned Unassigned
            jiguodai jiguodai

            Dates

              Created:
              Updated:

              Time Tracking

              Estimated:
              Original Estimate - 12h
              12h
              Remaining:
              Remaining Estimate - 12h
              12h
              Logged:
              Time Spent - Not Specified
              Not Specified

              Slack

                Issue deployment