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

Implement cache with asynchronous command execution #44

Open
cmeissner opened this issue May 26, 2021 · 1 comment
Open

Implement cache with asynchronous command execution #44

cmeissner opened this issue May 26, 2021 · 1 comment
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@cmeissner
Copy link
Member

Is your feature request related to a problem? Please describe.
If you want to create an exporter that rely on a long running command to create a metric it can happen that a scrape from prometheus runs into a timeout.

Describe the solution you'd like
A good solution can be that we use a cache for such commands. So the following will happen:

  1. prometheus will scrape a metric
  2. exporter will start the long running command (asynchronous, in background sth. else)
  3. exporter will deliver a default value until the command does not fill up the cache with a real value (e.g. a negativ value or status unknown)
  4. the command runs in background and the collected value will stored in cache once it has finished
  5. prometheus will scrape again and get the cached value
  6. the exporter check if there is already a background command running. If there is already a command running it won't start a new one. If there is no background job running it starts the command
  7. the cache will always updated if there is no command running

Describe alternatives you've considered
Trying to work with asyncio already in combination with async_lru(see #41) but this does not really work because the long running command will still block the exporter. The command will not really do stuff in background.

Additional context

@cmeissner cmeissner added enhancement New feature or request help wanted Extra attention is needed labels May 26, 2021
@cmeissner
Copy link
Member Author

@lush I describe the feature we need in this issue. I think #41 don't be the solution we go further with.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant