nit: Whether the Flink counter abstraction is cumulative or not is irrelevant w.r.t. what we send to metric backends.

For example, for Datadog we do send count diffs instead of the current total count.

On 10/05/2023 09:33, Hang Ruan wrote:
Hi, Iris,

The Flink counter is cumulative. There are `inc` and `dec` methods in it.
As the value of the counter has been calculated in Flink, we do not need use the counter metric in statsd to calculate.

Best,
Hang

Iris Grace Endozo <iris.end...@gmail.com> 于2023年5月10日周三 14:53写道:

    Hey Hang,

    Thanks for the prompt response. Does this mean the Flink counters
    emitted via statsd are cumulative then? From the spec
    https://github.com/b/statsd_spec#counters


    > A counter is a gauge calculated at the server. Metrics sent by
    the client increment or decrement the value of the gauge rather
    than giving its current value.

    This means that counters are not monotonic and work like deltas
    that are aggregated on the server side.

    Cheers, Iris.

    --

    *Iris Grace Endozo,* Senior Software Engineer
    *M *+61 435 108 697
    *E* iris.end...@gmail.com
    On 10 May 2023 at 1:02 PM +1000, Hang Ruan
    <ruanhang1...@gmail.com>, wrote:
    Hi, Iris,

    The metrics have already be calculated  in Flink. So we only need
    to report these metric as the gauges.
    For example, the metric `metricA` is a Flink counter and is
    increased from 1 to 2. The statsd gauge will be 2 now. If we
    register it as a statsd counter, we will send 1 and 2 to the
    statsd counter. The statsd counter will be 3, which is a wrong
    result.

    Best,
    Hang

    Iris Grace Endozo <iris.end...@gmail.com> 于2023年5月9日周二
    19:19写道:

        Hey folks trying to troubleshoot why counter metrics are
        appearing as gauges on my end. Is it expected that the
        StatsdMetricsReporter is reporting gauges for counters as well?

        Looking at this one:
        
https://github.com/apache/flink/blob/master/flink-metrics/flink-metrics-statsd/src/main/java/org/apache/flink/metrics/statsd/StatsDReporter.java#L207:
        the statsd specifications state that counters need to be
        reported as <metric name>:<value>|c[|@<sample rate>] but it
        seems it's defaulting to "%s:%s|g" in the above. Ref:
        https://github.com/b/statsd_spec#counters

        Wondering if anyone else has hit this issue or there's an
        existing issue?

        Cheers, Iris.

        --

        *Iris Grace Endozo,* Senior Software Engineer
        *M *+61 435 108 697
        *E* iris.end...@gmail.com

Reply via email to