-
Notifications
You must be signed in to change notification settings - Fork 268
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
New and updated Prometheus metrics #3844
Conversation
Previously, there was one `aleph_collections` metric with a `category` label. In addition to collection counts by category, we also want to track collection counts by country and languages. In order to keep metric cardinalities under control, I've decided to split the `aleph_collections` metric into three separate metrics: `aleph_collection_categories`, `aleph_collection_countries`, and `aleph_collection_languages`. Each of these metrics has one additional label `type` which can be either `dataset` or `casefile`. This allows to query for the datasets or investigations in a particular language or related to a particular country. I have also removed the `category` label from the `aleph_collection_users` metric as it wasn't that useful.
This allows us to get a better understanding of API requests that originate from the UI and requests from third parties using an API key.
efc468b
to
35b99b2
Compare
@catileptic This is now ready for review, even though one test is still failing. As discussed, this test fails because of an update of the I haven’t yet understood completely whether I’ll keep the test as is until I’ve found a definitive answer, but that shouldn’t block a review of the actual changes proposed in this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me. Really appreciate adding the tests! Let's get this merged.
This test started to fail with an upgrade of the `phonenumbers` package (imported via `followthemoney`) which included updated phone number validation rules. As a result, the phone numbers in this test case didn’t pass validation anymore and were cleaned from the entites created. At first glance these numbers seemed to be valid German mobile phone numbers and I was worried that there might be a regression in `phonenumbers`. But according to the International Telecommunication Union, a phone number with the prefix `176` has to be 11 digits long. I adjusted the tests accordingly. https://www.itu.int/oth/T0202000051/en
This PR adds a few new metrics and extends existing metrics based on feedback. I’d recommend taking a look at the individual commits when reviewing this PR.
Corresponding documentation changes are in #3845 because the
release/4.0.0
branch doesn’t yet have the recently updated tech docs fromdevelop
.Users
I’ve added new
active
andlocale
labels to thealeph_users
metric. This allows querying for the number of active users (e.g. within last 24h, 7d, 30d, …) and the number of users that use a specific UI locale.Collections
Previously, there was a single
aleph_collections
metric that allowed querying for the number of collections by category (e.g. "casefile", "leak", "gazette", …). I have renamed this metric to be consistent with two new metrics that expose the number of collections by country and language.Entities
I’ve added a new metric to track the number of entities per schema type. This re-uses collection statistics that are pre-computed and cached in Redis, i.e. we do not send any (potentially expensive) ES aggregation queries during metrics collection.
API HTTP requests
I have added a new label
auth_method
to thealeph_http_requests_total
. This allows us to query for the number of API requests that used an API key vs. a UI session token.