Skip to content

Commit

Permalink
Merge pull request #2234 from RolandSherwin/ci_bench
Browse files Browse the repository at this point in the history
fix(autonomi): log the process metrics
  • Loading branch information
jacderida authored Oct 14, 2024
2 parents 0a499dd + 463a524 commit a074b1c
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 7 deletions.
62 changes: 55 additions & 7 deletions .github/workflows/generate-benchmark-charts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,15 @@ name: Benchmark Chart Generation

# Do not run this workflow on pull request since this workflow has permission to modify contents.
on:
pull_request:
branches: ["*"]
push:
branches:
- main

permissions:
# deployments permission to deploy GitHub pages website
deployments: write
# contents permission to update benchmark contents in gh-pages branch
contents: write

env:
CARGO_INCREMENTAL: "0"
Expand Down Expand Up @@ -67,11 +74,26 @@ jobs:
value: ((if .throughput[0].unit == "KiB/s" then (.throughput[0].per_iteration / (1024*1024*1024)) else (.throughput[0].per_iteration / (1024*1024)) end) / (.mean.estimate / 1e9))
})' > files-benchmark.json
- name: Remove git hooks so gh-pages git commits will work
shell: bash
run: rm -rf .git/hooks/pre-commit

- name: check files-benchmark.json
shell: bash
run: cat files-benchmark.json

# FIXME: do this in a generic way for localtestnets
# gh-pages branch is updated and pushed automatically with extracted benchmark data
- name: Store cli files benchmark result
uses: benchmark-action/github-action-benchmark@v1
with:
name: "`safe files` benchmarks"
tool: "customBiggerIsBetter"
output-file-path: files-benchmark.json
github-token: ${{ secrets.GITHUB_TOKEN }}
auto-push: true
max-items-in-chart: 300

# FIXME: do this in a generic way for localtestnets
- name: export default secret key
run: echo "SECRET_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" >> $GITHUB_ENV
shell: bash
Expand Down Expand Up @@ -122,6 +144,16 @@ jobs:
shell: bash
run: cat node_memory_usage.json

- name: Upload Node Memory Usage
uses: benchmark-action/github-action-benchmark@v1
with:
name: "Node memory"
tool: "customSmallerIsBetter"
output-file-path: node_memory_usage.json
github-token: ${{ secrets.GITHUB_TOKEN }}
auto-push: true
max-items-in-chart: 300

- name: Check client memory usage
shell: bash
run: |
Expand Down Expand Up @@ -164,6 +196,16 @@ jobs:
shell: bash
run: cat client_memory_usage.json

- name: Upload Client Memory Usage
uses: benchmark-action/github-action-benchmark@v1
with:
name: "Client memory"
tool: "customSmallerIsBetter"
output-file-path: client_memory_usage.json
github-token: ${{ secrets.GITHUB_TOKEN }}
auto-push: true
max-items-in-chart: 300

###########################################
### Swarm_driver handling time Analysis ###
###########################################
Expand Down Expand Up @@ -228,7 +270,13 @@ jobs:
- name: check swarm_driver_long_handlings.json
shell: bash
run: cat swarm_driver_long_handlings.json

- name: Setup tmate session
if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3

- name: Upload swarm_driver Long Handlings
uses: benchmark-action/github-action-benchmark@v1
with:
name: "swarm_driver long handlings"
tool: "customSmallerIsBetter"
output-file-path: swarm_driver_long_handlings.json
github-token: ${{ secrets.GITHUB_TOKEN }}
auto-push: true
max-items-in-chart: 300
4 changes: 4 additions & 0 deletions autonomi_cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ use clap::Parser;
use color_eyre::Result;

use opt::Opt;
#[cfg(feature = "metrics")]
use sn_logging::metrics::init_metrics;
use sn_logging::{LogBuilder, LogFormat, ReloadHandle, WorkerGuard};
use tracing::Level;

Expand All @@ -30,6 +32,8 @@ async fn main() -> Result<()> {
color_eyre::install().expect("Failed to initialise error handler");
let opt = Opt::parse();
let _log_guards = init_logging_and_metrics(&opt)?;
#[cfg(feature = "metrics")]
tokio::spawn(init_metrics(std::process::id()));

// Log the full command that was run and the git version
info!("\"{}\"", std::env::args().collect::<Vec<_>>().join(" "));
Expand Down

0 comments on commit a074b1c

Please sign in to comment.