Skip to content
This repository has been archived by the owner on Mar 31, 2020. It is now read-only.

PrometheusReporter thread is not daemon #30

Closed
RobertoUa opened this issue Jul 12, 2019 · 4 comments
Closed

PrometheusReporter thread is not daemon #30

RobertoUa opened this issue Jul 12, 2019 · 4 comments

Comments

@RobertoUa
Copy link

RobertoUa commented Jul 12, 2019

The thread should be daemon by default and users should be allowed to configure it.

@ivantopo
Copy link
Contributor

Hey @RobertoUa, could you please explain a bit more what you mean by this?

@RobertoUa RobertoUa changed the title PrometheusReporter is not daemon PrometheusReporter thread is not daemon Jul 12, 2019
@RobertoUa
Copy link
Author

RobertoUa commented Jul 12, 2019

sorry, I meant thread. I have to call sys.exit(0) because app doesn't finish

@ivantopo
Copy link
Contributor

Oh, now I see what you mean! So, this is not specific to the Prometheus module, it actually is part of Kamon core, we even have tests to ensure that this works this way! Instead of sys.exit, just make Kamon stop all reporters (that's either Kamon.stopModules() in Kamon 2.x or Kamon.stopAllReporters() in Kamon 1.x) and then the application will be able to stop without issues.

The goal with that was to allow the reporters to push out the very last data they have before shutting down, which is specially important when running short-lived processes.

@RobertoUa
Copy link
Author

I see, thanks! But maybe we can allow configuring it? I don't want to call Kamon.stopAllReporters() this seems wrong, and not obvious (I had to debug for a long time to find out which thread is daemon) every other dependency I can configure to make threads daemon.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants