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

Statsd reporter gives wrong metrics when using negative numbers

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

      Description

      The statsd reporter has a bug I believe when using negative numbers.

       

      This is because when a metric is sent it is first converted to a string value. This means 100 becomes "100" and -100 becomes "-100". This value is then sent to statsd as a gauge value.

      See this line for the conversion to string: https://github.com/apache/flink/blob/master/flink-metrics/flink-metrics-statsd/src/main/java/org/apache/flink/metrics/statsd/StatsDReporter.java#L130

      And this line for sending it as a gauge:

      https://github.com/apache/flink/blob/master/flink-metrics/flink-metrics-statsd/src/main/java/org/apache/flink/metrics/statsd/StatsDReporter.java#L184

       

      This means a value of -100 will be sent like this:

      <metric_name>:-100|g

       

      The statsd protocol how ever states the following (https://github.com/statsd/statsd/blob/master/docs/metric_types.md#gauges):

      Adding a sign to the gauge value will change the value, rather than setting it.
      

       

       

      So sending -100 multiple times means the gauge in statsd will be decremented multiple times, rather than set to -100.

       

      I believe this isn't how flink expects it to work, is it?

        Attachments

          Activity

            People

            • Assignee:
              Xeli Richard Deurwaarder
              Reporter:
              Xeli Richard Deurwaarder

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 20m
                20m

                  Issue deployment