Closed
Description
Why
We want to record the usage of the different types of Mithril clients in the metrics that we record.
What
Provide automatic recording of the type of Mithril client used to call the aggregator in the metrics.
How
- Create a list of authorized client types:
- Fully hard-coded:
CLI
,WASM
,LIBRARY
,NA
- Fully hard-coded:
- In the client library:
- Set a specific option for the client type:
- defaults to
LIBRARY
-
use a an enum for the values (undocumented with#[doc(hidden)]
) - create a
with_client_type
function in theClientBuilder
- defaults to
- Add a new
mithril-client-type
HTTP header to the calls made to aggregator with the value of this option
- Set a specific option for the client type:
- In the client CLI, use the client type
CLI
when building the client - In the client WASM, use the client type
WASM
when building the client - In the aggregator, add a middleware to the HTTP routes for computing the client type:
- If it is not set or unknown, then fallback to
NA
- Use the received client type in the metrics recording inside the handlers of the routes
- Update
EventMessage
with the client type when needed
- If it is not set or unknown, then fallback to
- In the aggregator, extend the metrics:
- Support recording of a metric with a client type
- Update all the calls to the metrics to support an optional client type
- In the state machine, the calls to the metrics should not be modified (as there is no client type in that case)
- Adapt the
UsageReporter
to send the client type in the event stored in the event store - Create a new migration in the event store database of the aggregator and add a new
metrics_per_day_and_client_type
view
Later
- Adapt the Grafana dashboard