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

Question about recentFiler=1d for getting executions #68

Closed
davidcpell opened this issue May 25, 2023 · 3 comments · Fixed by #69
Closed

Question about recentFiler=1d for getting executions #68

davidcpell opened this issue May 25, 2023 · 3 comments · Fixed by #69

Comments

@davidcpell
Copy link
Contributor

Hi @phsmith, I'm integrating rundeck_exporter (thanks for this!) and while looking at the code came across the use of 1d as a recentFilter when getting executions:

endpoint = f'/project/{project_name}/executions?recentFilter=1d&max={project_executions_limit}'
endpoint_running_executions = f'/project/{project_name}/executions/running?recentFilter=1d&max={project_executions_limit}'

Can you explain the reasoning behind this value? I just want to make sure things will work as expected when Prometheus is scraping every minute. Will I be duplicating metrics?

@phsmith
Copy link
Owner

phsmith commented May 26, 2023

Hey @davidcpell!
Yeah, let me explain.

That point in the code retrieves the 20 (max => project_executions_limit = > 20 by default) most recent project executions during the day, or in the last 24h.

For example, the rundeck_project_execution_status metric shows 5 metrics every time the exporter is scraped, each one representing the status of the rundeck jobs, and value is set to 1 for the current status and 0 for the others. Every minute you can see these metrics, so yeah, you can get the same metrics values over a period of time, but it's purely for having more accurate results.

Don't know if I was clear enough, lemme know if not.

@davidcpell
Copy link
Contributor Author

I'm still struggling to see how this works out in a case where we are scraping every minute but the exporter is looking back 24h for executions. For example, if there were 10 executions of a certain job in the last 24h and Prometheus is scraping every minute, would we not be adding 10 to the counter every time a scrape takes place even if no more executions are happening (until 24h have gone by and the API query no longer finds those 10 executions)?

Or a gauge example: let's say we had 100 executions evenly spread out over the course of 24h, and the next day there are 0 executions the whole day. At noon the next day (halfway through the day) wouldn't we still be sending a value of 50 to Prometheus? And it would look like the value went from 100 to 50 when actually there are 0 executions for those times on the 2nd day?

Sorry if I'm misunderstanding something either in the exporter or Prom itself!

@phsmith
Copy link
Owner

phsmith commented May 27, 2023

@davidcpell You're absolutely right!
I've just made a few changes. I added the parameter --rundeck.projects.executions.filter, default to 5n (5 minutes), so you can now change the behavior of the query.
What do you think?

phsmith added a commit that referenced this issue May 30, 2023
* feat: update version

* feat(#68): add --rundeck.projects.executions.filter param

* fix: change rundeck.projects.executions.filter default value

* fix(#68): change rundeck.projects.executions.filter default value

* fix: rollback rundeck.projects.filter arg

* docs: update CHANGELOG.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants