Skip to content

Conversation

@kennsippell
Copy link
Member

@kennsippell kennsippell commented Oct 28, 2025

Description

Uses the Additional Metric Labels feature to allow segmentation of express prometheus data by user role.
closes #10415

Fxies a related npm build warning
closes #10416

Code review checklist

  • UI/UX backwards compatible: Test it works for the new design (enabled by default). And test it works in the old design, enable can_view_old_navigation permission to see the old design. Test it has appropriate design for RTL languages.
  • Readable: Concise, well named, follows the style guide, documented if necessary.
  • Documented: Configuration and user documentation on cht-docs
  • Tested: Unit and/or e2e where appropriate
  • Internationalised: All user facing text
  • Backwards compatible: Works with existing data and configuration or includes a migration. Any breaking changes documented in the release notes.

Compose URLs

If Build CI hasn't passed, these may 404:

License

The software is provided under AGPL-3.0. Contributions to this project are accepted under the same license.

@jkuester jkuester self-requested a review October 30, 2025 21:42
@jkuester
Copy link
Contributor

I ran out of time this week to review this PR, but just wanted to say I plan to dig into it next week. 👍

Copy link
Contributor

@jkuester jkuester left a comment

Choose a reason for hiding this comment

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

Code changes here are good and work as expected!

I would prefer to hold off merging this until Diana has weighed in on the issue discussion. 👍

45, 90, 180, 360, 600,
1200, 1800, 3600
],
additionalLabels: ['userRoles'],
Copy link
Contributor

Choose a reason for hiding this comment

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

Super minor, but IMHO keeping this underscored instead of camelCase would feel more consistent (since the metric names are underscored...)

.join(',');

return {
userRoles: presentableRoles,
Copy link
Contributor

Choose a reason for hiding this comment

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

I really hate that prometheus-api-metrics does not support emitting multiple time series (with different label values) per request. 😞 My understanding of Prometheus "best practices" would be that we should just have a user_role label and then emit multiple time series when a user has multiple roles (one for each role). This would make it simple to slice and dice the metrics by role. As things are here, we will have to do some regexing in the queries...

Unfortunately, I spent a bunch of time trying alternatives here and none of them were satisfactory. I think what you have here is the best we can do (so no changes needed).

@github-actions
Copy link

github-actions bot commented Dec 5, 2025

This PR is now marked "stale" after 30 days without activity. It will be closed automatically in 10 days unless you add a comment, push new changes or remove the "stale" label.

@github-actions github-actions bot added the Stale label Dec 5, 2025
Copy link
Contributor

@jkuester jkuester left a comment

Choose a reason for hiding this comment

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

@kennsippell based on Diana's comment I think we should obfuscate the role names before emitting them on a public endpoint.

@jkuester jkuester removed the Stale label Dec 5, 2025
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.

Warning: patch-package detected a patch file version mismatch Label performance data in /api/v1/express-metrics with user's role

3 participants