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(multi-region): metrics for knex for all regional databases #3580

Merged
merged 19 commits into from
Dec 12, 2024

Conversation

iainsproat
Copy link
Contributor

@iainsproat iainsproat commented Nov 28, 2024

Description & motivation

Part of https://linear.app/speckle/issue/WEB-2142/multi-region-db-connection-health

Metrics on knex queries and connection pools are gathered and made available as Prometheus metrics.

These are updated to gather data on all knex clients for all multi-region databases.

This PR updates the server component only; fileimport-service, preview-service, and webhook-service will be updated in later PRs

Changes:

To-do before merge:

Screenshots:

Screenshot 2024-12-10 at 12 15 44 Screenshot 2024-12-10 at 12 15 56

Validation of changes:

Checklist:

  • My pull request follows the guidelines in the Contributing guide?
  • My pull request does not duplicate any other open Pull Requests for the same update/change?
  • My commits are related to the pull request and do not amend unrelated code or documentation.
  • My code follows a similar style to existing code.
  • I have added appropriate tests.
  • I have updated or added relevant documentation.

References

Copy link

linear bot commented Nov 29, 2024

@iainsproat iainsproat marked this pull request as ready for review December 11, 2024 08:32
@@ -24,14 +24,14 @@ export default function (app: express.Express) {
register: prometheusClient.register,
collectionPeriodMilliseconds: highFrequencyMetricsCollectionPeriodMs(),
config: {
knex
getDbClients: getAllRegisteredDbClients
Copy link
Contributor

Choose a reason for hiding this comment

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

you could get all clients from the config and then this would not rely on any DB state.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do we want to get metrics for databases that are not yet registered and being used?
Especially if we start introducing alerting in the future around some of these metrics, we'd have alerts on potentially unused databases.

@gjedlicska gjedlicska merged commit 8197bb7 into main Dec 12, 2024
26 of 28 checks passed
@gjedlicska gjedlicska deleted the iain/update-server-knex-metrics branch December 12, 2024 10:03
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 this pull request may close these issues.

2 participants