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

Audit Metric Consolidation #666

Open
amydevs opened this issue Jan 17, 2024 · 2 comments
Open

Audit Metric Consolidation #666

amydevs opened this issue Jan 17, 2024 · 2 comments
Labels
development Standard development r&d:polykey:core activity 1 Secret Vault Sharing and Secret History Management

Comments

@amydevs
Copy link
Member

amydevs commented Jan 17, 2024

Specification

It has been decided that the metrics stored in Polykey should better match the types of metrics found in Prometheus, within the computed metrics such as averages and such, being produced by a Mimir server offering up a PromQL interface.

This will mean that the AuditMetrics as they are need to be reworked into 4 distinct types:

  • Counter - A metric value that can only increase of reset (Each value cannot be lower than the previous value). It should be used for metrics such as number of connections, number of errors, etc. If these metrics are fed into Mimir, PromQL is able to aggregate more complex metrics such as the rate of connections sampled at some period of time as seen below: rate example
  • Gage - This is a number that can either go up or down, it should be used for metrics like the the number of seednodes, CPU/RAM usage, etc. If these metrics are fed into Mimir, PromQL is able to aggregate these metrics into max/min/avg over certain time periods: gauge example
  • Histogram - Histograms are buckets that contain counts of values that make up that bucket. For example, a histogram would have the following structure if it were to receive a value of 0.4:
Bucket Count
0 - 0.1 0
0 - 0.5 1
0 - 1 1
0 - +inf 1
  • Summary - TBD

Storage

We have our key-value Rocks-DB database. This means that our metrics will have to be similarly layed out like our events, being that we have metric paths, with the subpaths of those containing AuditPointId keys that point to metrics in Audit/points/${id}.

Additional context

Tasks

  1. Figure out data structure for storing metrics compatible with our KV RocksDB.
  2. Amend event handlers in Audit domain to allow for insertion of metric data points based on events.
  3. ...
@amydevs amydevs added the development Standard development label Jan 17, 2024
@amydevs amydevs self-assigned this Jan 17, 2024
@CMCDragonkai
Copy link
Member

To be precise, we won't use Prometheus software at all, in fact use "Open Metrics" format as that's compatible with Prometheus metrics.

However we won't even bother with Open Metrics format in PK RPC, we continue to expose data as normal as JSON.

It's only PKNS that will expose Open Metrics format which then has to be stored in Mimir.

When PKNS queries the database from Mimir, it still isn't Open Metrics format, it's actually just JSON again. That data is then read by PKND and loaded into ChartJS.

@CMCDragonkai
Copy link
Member

So the only time Open Metrics format is used at all, would be just when PKNS reads PK metrics data and puts it into Mimir. That's the only time the format appears.

However audit metrics and operational metrics should only produce those 4 types of data: gauges, counters, histograms and summaries.

Create functions that accumulate such data - and create the relevant schemas in the audit sublevel that can store such things.

@CMCDragonkai CMCDragonkai added the r&d:polykey:core activity 1 Secret Vault Sharing and Secret History Management label Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
development Standard development r&d:polykey:core activity 1 Secret Vault Sharing and Secret History Management
Development

No branches or pull requests

2 participants