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

feat(server): job metrics #8255

Merged
merged 7 commits into from Mar 25, 2024
Merged

feat(server): job metrics #8255

merged 7 commits into from Mar 25, 2024

Conversation

mertalev
Copy link
Contributor

@mertalev mertalev commented Mar 25, 2024

Description

This PR adds observability for jobs and queues. Specifically, it tracks job successes, skips and failures as well as the current number of active jobs in each queue. This is implemented in the job service through a new metric repository.

How Has This Been Tested?

Tested that the active jobs in the queue show up in Prometheus and respond to changes in concurrency.

thumbnail-generation-active

Copy link

cloudflare-pages bot commented Mar 25, 2024

Deploying immich with  Cloudflare Pages  Cloudflare Pages

Latest commit: 99ad5cc
Status: ✅  Deploy successful!
Preview URL: https://8a7ec901.immich.pages.dev
Branch Preview URL: https://feat-job-metrics.immich.pages.dev

View logs

@mertalev mertalev merged commit c58a70a into main Mar 25, 2024
24 checks passed
@mertalev mertalev deleted the feat/job-metrics branch March 25, 2024 03:02
Comment on lines +10 to +12
addToCounter(name: string, value: number, options?: CustomMetricOptions): void;
updateGauge(name: string, value: number, options?: CustomMetricOptions): void;
updateHistogram(name: string, value: number, options?: CustomMetricOptions): void;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requiring passing in whether metrics is enabled or not send like an odd choice. Also making it optional send really weird because it doesn't do anything otherwise. Can you just move that logic globally to the repo instead? If anything add a method to enable or disable metrics, instead of requiring it in every call.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason is because there are different kinds of metrics and it can be that only some are enabled. The enabled flag is just for ergonomics to avoid repeating if (jobMetrics), etc.

I could change it to accept the metric group and have the repo own the decision to track the metric based on the group that's passed. How does that sound?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it being enabled a static property set once via an environment variable? Why would you need to pass it into the repo over and over? Id be fine with using it directly in the repository instead of requiring it to be passed in every method.

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

Successfully merging this pull request may close these issues.

None yet

3 participants