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

fix!: metrics fixes, updates, cleanups #338

Merged
merged 15 commits into from
Sep 21, 2022
Merged

fix!: metrics fixes, updates, cleanups #338

merged 15 commits into from
Sep 21, 2022

Conversation

kon14
Copy link
Contributor

@kon14 kon14 commented Sep 21, 2022

This PR includes multiple fixes, cleanups and refactors to metrics-related functionality.
To begin with, it introduces the following fixes:

  • registered_schemas_total metric increase equality check always failing on schema creation
  • registered_schemas_total metric not decreasing on schema deletion
  • registered_schemas_total metric lacking multi-instance support
  • push_notifications_sent_total metric only increasing once for multiple concurrent deliveries
  • gRPC client metrics middleware registering metrics lacking conduit_ prefix
  • getMetric() missing conduit_ prefix

Metric Changes:

  • I've added a new metric for registered admin routes (admin_routes_total), while also renaming the corresponding client route counter to client_routes_total for consistency.
    Both of the above now accept a transport label for distinguishing between rest, graphql and socket routes.
  • Removed devicesCount label from push_notifications_sent_total metric

Breaking Change:
Metrics reset routes have been dropped as that would needlessly complicate value reinitialization for certain stat counters.

I've introduced an optional metric initializer hook (initializeMetrics()) in ConduitModule, allowing modules to initialize stat-like values on startup.
I implemented that in all of our modules, regardless of whether they need to initialize anything, for clarity.

Things that still need to be improved upon:

  • Authentication module's logged_in_users_total should be initialized and remain up to date with active logins (based on token validity).
  • Metric names should probably be more consistent.

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Build-related changes
  • Other (please describe)

Does this PR introduce a breaking change?

  • Yes
  • No

Metrics reset routes have been dropped as that would needlessly complicate value reinitialization for certain stat counters.

The PR fulfills these requirements:

  • It's submitted to the main branch
  • When resolving a specific issue, it's referenced in the PR's description (e.g. fix #xxx, where "xxx" is the issue number)

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature

feat(hermes,router): routing metrics improvements
refactor: earlier module schema registration
fix(grpc-sdk): metrics reset not reinitializing values

Reset value reinitialization is currently not properly implemented for:
Database: registered_schemas_total
Router: client_routes_total
Authentication: logged_in_users_total

Check @improve-metrics tags for details.

BREAKING CHANGE:
Metrics reset endpoints (/metrics/reset) are now POST operations.
fix(database): sequelize adapter missing deleteSchema metric decrement
@kkopanidis kkopanidis merged commit 9369cee into main Sep 21, 2022
@kkopanidis kkopanidis deleted the metrics branch September 21, 2022 15:35
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