|
1 | 1 | # Aggregator metrics
|
2 | 2 |
|
3 |
| -Aggregator metrics are stored in `monitoring.sqlite3` database as an event. |
4 |
| - |
5 |
| -They are stored in database with `Metrics` as `source` and the name of the metric as `action`. |
6 |
| - |
7 |
| -| event_id | created_at | source | action | content | |
8 |
| -| -------- | ----------------------------------- | ------- | ------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | |
9 |
| -| 104 | 2024-10-29T10:27:49.843362986+00:00 | Metrics | mithril_aggregator_signer_registration_total_received_since_startup | `{"content":{"counter":2,"date":"2024-10-29T10:27:49.842316726Z","duration":{"nanos":0,"secs":3}},"headers":{}} ` | |
10 |
| -| | |
11 |
| - |
12 |
| -The content of the metric is a json that contains the counter value, the date the value was measured and the duration that corresponds to the measurement. |
13 |
| - |
14 |
| -Json sample: |
15 |
| - |
16 |
| -```json |
17 |
| -{ |
18 |
| - "content": { |
19 |
| - "counter": 6, |
20 |
| - "date": "2024-10-28T16:43:18.858027008Z", |
21 |
| - "duration": { |
22 |
| - "nanos": 0, |
23 |
| - "secs": 10 |
24 |
| - } |
25 |
| - }, |
26 |
| - "headers": {} |
27 |
| -} |
28 |
| -``` |
29 |
| - |
30 |
| -Each event represents the number of hits on the counter since the last period of timed. |
31 |
| - |
32 | 3 | A view `metrics_per_day` is available to calculate the value of a metric over a day.
|
33 | 4 |
|
34 | 5 | The following request displays the sum of counter for each metric on the specify day.
|
35 |
| -`select date, counter_name, value from metrics_per_day where date='2024-10-29';` |
| 6 | +Format of `DAY` variable should be `YYYY-MM-DD` (ie: `2024-10-28`). |
| 7 | + |
| 8 | +```sh |
| 9 | +$> sqlite3 -table -batch \ |
| 10 | + $DATA_STORES_DIRECTORY/monitoring.sqlite3 \ |
| 11 | + `select date, counter_name, value from metrics_per_day where date='$DAY';` |
| 12 | +``` |
36 | 13 |
|
37 | 14 | The result looks like:
|
38 | 15 |
|
39 | 16 | ```
|
40 |
| -2024-10-29|mithril_aggregator_certificate_total_produced_since_startup|32 |
41 |
| -2024-10-29|mithril_aggregator_runtime_cycle_success_since_startup|131 |
42 |
| -2024-10-29|mithril_aggregator_runtime_cycle_total_since_startup|239 |
| 17 | ++------------+-------------------------------------------------------------+--------+ |
| 18 | +| date | counter_name | value | |
| 19 | ++------------+-------------------------------------------------------------+--------+ |
| 20 | +| 2024-10-29 | mithril_aggregator_certificate_total_produced_since_startup | 135532 | |
| 21 | +| 2024-10-29 | mithril_aggregator_runtime_cycle_success_since_startup | 563246 | |
| 22 | +| 2024-10-29 | mithril_aggregator_runtime_cycle_total_since_startup | 237513 | |
| 23 | ++------------+-------------------------------------------------------------+--------+ |
43 | 24 | ```
|
44 |
| - |
45 |
| -NOTE: These metrics should not be used to have an exact count. There may be slight discrepancies with reality. |
46 |
| -When stopping the aggregator, last measure may not be counted. |
47 |
| - |
48 |
| -The measurement extends over a period of time which may have started the previous day. |
49 |
| -In this case, the value is counted for the day the measurement was taken. |
50 |
| - |
51 |
| -The measurement frequency is relatively short and can be configured by setting the environment variable `PERSIST_USAGE_REPORT_INTERVAL_IN_SECONDS`. |
0 commit comments