regolith-labs / ore-cli

Command line interface for ORE cryptocurrency mining.
919 stars 443 forks source link

Adding metrics collection for miner #68

Closed dougEfresh closed 1 month ago

dougEfresh commented 2 months ago

This is a build feature to enable metrics via opentelementry and the tracing_subscriber frameworks

cargo build --features metrics --release

ore miner --help
Mine Ore using local compute

Usage: ore mine [OPTIONS]

Options:
      --rpc <NETWORK_URL>
          Network address of your RPC provider
  -t, --threads <THREAD_COUNT>
          The number of threads to dedicate to mining [default: 1]
  -C, --config <PATH>
          Filepath to config file.
      --metrics
          enable metrics
      --keypair <KEYPAIR_FILEPATH>
          Filepath to keypair to use
      --metrics-endpoint <METRICS_ENDPOINT>
          push metrics to this opentelemetry gRPC endpoint [default: http://localhost:4317]
      --priority-fee <MICROLAMPORTS>
          Number of microlamports to pay as priority fee per transaction [default: 0]
  -h, --help
          Print help

RUST_LOG=info cargo  run --features metrics  --  --config /home/dougefish/.config/solana/cli/ore.yml mine --threads 4

2024-04-15T12:18:39.548883Z  INFO otel: worker=2 monotonic_counter.miner=1
2024-04-15T12:18:39.686747Z  INFO otel: worker=3 monotonic_counter.miner=1
2024-04-15T12:18:39.918902Z  INFO otel: worker=0 monotonic_counter.miner=1
joaomendoncaa commented 2 months ago

great stuff! thought of adding exacly this yesterday night behind a monitor arg but didn't get to it, smart implementation through grpc. 🔥

dougEfresh commented 2 months ago

Added support for RUST_LOG

RUST_LOG=info cargo  run --features metrics  --  --config /home/dougefish/.config/solana/cli/ore.yml mine --threads 4

2024-04-15T12:18:39.548883Z  INFO otel: worker=2 monotonic_counter.miner=1
2024-04-15T12:18:39.686747Z  INFO otel: worker=3 monotonic_counter.miner=1
2024-04-15T12:18:39.918902Z  INFO otel: worker=0 monotonic_counter.miner=1