Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Buffered statsd lines are not published on close #2141

Closed
WillBrindle opened this issue Jun 6, 2020 · 6 comments · Fixed by #5195
Closed

Buffered statsd lines are not published on close #2141

WillBrindle opened this issue Jun 6, 2020 · 6 comments · Fixed by #5195
Labels
bug A general bug registry: statsd A StatsD Registry related issue
Milestone

Comments

@WillBrindle
Copy link

This may well be misunderstanding on my part but is there any way to ensure all counters are updated on close?
Here is a minimal example of the problem:

public static void main(String args[]) throws InterruptedException {
        StatsdConfig config = new StatsdConfig() {
            @Override
            public String get(String k) {
                return null;
            }
        };
        MeterRegistry registry = new StatsdMeterRegistry(config, Clock.SYSTEM);

        String METRIC = "test.metric";

        registry.counter(METRIC);
        registry.close();
}

If you spin up a simple udp server you'll see nothing is sent. This extends to if I add a sleep for a value more than step() , before or after closing. If I add a loop before closing where I increment the counter then sleep I start to get buffered messages across, but if not enough messages have been sent to clear the buffer by the last metrics are lost.

Setting buffered in my config to false resolves the problem but the natural behave feels like flushing should occur on close.

@shakuzen shakuzen added the registry: statsd A StatsD Registry related issue label Jun 10, 2020
@mickaeltr
Copy link

Isn't it the same issue as #1882 ?

@gordon-rennie
Copy link

Isn't it the same issue as #1882 ?

I can still repro this issue on 1.11.0 and latest.integration builds, so sadly no; this issue is unfixed and outstanding. I noticed it because "job complete" metrics were not being emitted by a task kicked off by a k8s CronJob, causing alerting to go off.

@jonatan-ivanov
Copy link
Member

#1882 fixed this for StepMeterRegistry implementations while StatsdMeterRegistry extends MeterRegistry.

@marcingrzejszczak marcingrzejszczak added the waiting for feedback We need additional information before we can continue label Dec 20, 2023
Copy link

github-actions bot commented Jan 2, 2024

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

Copy link

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jan 10, 2024
@jonatan-ivanov jonatan-ivanov removed waiting for feedback We need additional information before we can continue feedback-reminder labels Feb 7, 2024
@shakuzen shakuzen reopened this Jul 24, 2024
@shakuzen shakuzen added bug A general bug and removed closed-as-inactive labels Jul 24, 2024
@shakuzen shakuzen changed the title StatsD: flush buffer on close? Buffered statsd lines are not published on close Jul 24, 2024
@shakuzen shakuzen added this to the 1.9.18 milestone Jul 24, 2024
@shakuzen
Copy link
Member

Thanks to the pull request from @BJMg we now have tests that reproduce this behavior and changes to fix it, which are now merged into all supported branches and is published in snapshots. It will be included in future releases for 1.10.16, 1.11.13, 1.12.9, 1.13.3, and 1.14.0. Folks who were affected by this, please try out snapshots to let us know if the issue is fixed for you now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A general bug registry: statsd A StatsD Registry related issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants