Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add OpenTelemetry to node (#7102)
This PR adds OpenTelemetry to the monorepo and starts tracking the following metrics in the node: - resource usage (CPU, system memory) - block height - average block size (how many txs per block) - mempool status - time taken to generate the witness and prove the protocol circuits - time to simulate the circuits (only relevant if using mocked proofs) The witgen/proving time are using gauges rather than histograms because of a quirk with how often Prometheus scrapes the metrics vs how many proofs we generate of the same type. In PromQL recreating the histogram quantile requires looking at the rate of change of the individual buckets but if proving takes tens-of-seconds it doesn't change often enough so it ends up dividing by 0. Using a guage gives us instantaneous values, but we potentially lose data (e.g. if two proofs finish in the same scrape interval) and in the dashboard the numbers won't "decay" (meaning if for some reason the node stop producing blocks the proof duration will stay at the previous value). Three new components are added to the architecture: - an instance of the OpenTelemetry collector (aggregates metrics pushed by the node) - an instance of Prometheus to scrape to collector for data - an instance of Grafana to chart the data The top-level docker-compose has been updated to include these components under the `metrics` profile. To run the metrics stack: ``` $ docker compose --profile metrics up -d ``` Then e2e tests can be run with metrics being exported to Grafana: ``` OTEL_COLLECTOR_HOST=127.0.0.1:4318 yarn test e2e_block_building ``` Two Grafana dashboards are included with this PR. Node stats: ![image](https://github.com/AztecProtocol/aztec-packages/assets/3816165/0536ffde-934f-46de-b864-c8464925de4c) Protocol circuit stats: ![image](https://github.com/AztecProtocol/aztec-packages/assets/3816165/8e1e15ce-daaf-4d65-b5e8-a681335cac80)
- Loading branch information