Skip to content

Is WindowedCount the right stat type to use in MetricsResourceMethodApplicationListener? #344

@ericwush

Description

@ericwush

By default, an application is configured to keep two samples in a SampledStat, e.g., WindowedCount, each sample maintains a 30-second window. Typically, metrics are exposed by JmxReporter. When the value of an MBean is being retrieved, it calls the stat's measure method. In WindowedCount, measure simply combines all data points in all (two) samples to get the sum. Unless the MBean retrievals are well aligned with the start of a window with the intervals being (window size * # of samples), I don't see how it could report the right count.

For instance:
T: 0----5----[10]----15----[20]----25----[30]
W: |-----1-----|------2------|------3-------|

Let's assume the window size is 10, the metrics get collected every 10 seconds.
Collection 1 at 15: it returns the sum of (full window 1 and half of window 2), i.e., 0-15
Collection 2 at 25: it returns the sum of (full window 2 and half of window 3), i.e., 10-25
In this example, the values between 10-15 are repeatedly reported.

Can anyone please verify if this is the right understanding?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions