aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorRasmus Dahlberg <rasmus@rgdd.se>2023-03-18 13:48:41 +0100
committerRasmus Dahlberg <rasmus@rgdd.se>2023-03-18 13:48:41 +0100
commit52bd32914a6184ee4d403f8418eb0546074ac5bb (patch)
tree6cdd827fad634d4e5d1ce578f651e93910a75380 /main.go
parent385c2e62d256961f1fc99c7a4d41cd01b426c837 (diff)
Print metrics based on flag duration to stderr
Diffstat (limited to 'main.go')
-rw-r--r--main.go14
1 files changed, 9 insertions, 5 deletions
diff --git a/main.go b/main.go
index f4763ac..b78b007 100644
--- a/main.go
+++ b/main.go
@@ -14,6 +14,7 @@ import (
"fmt"
"log"
"os"
+ "time"
"git.cs.kau.se/rasmoste/ct-sans/internal/ctflag"
)
@@ -43,15 +44,17 @@ Options:
-k, --batch-disk: Certificate batch size before persisting (Default: 16384)
-q, --batch-req: Certificate batch size to use in request (Default: 512)
-a, --http-agent: HTTP agent to use in all request (Default: "git.cs.kau.se/rasmoste/ct-sans")
+ -m, --metrics: How often to emit metrics to stderr (Default: 15s)
`
type options struct {
- Directory string
- WorkersPerLog uint64
- PersistSize uint64
- BatchSize uint64
- HTTPAgent string
+ Directory string
+ WorkersPerLog uint64
+ PersistSize uint64
+ BatchSize uint64
+ HTTPAgent string
+ MetricsInterval time.Duration
logDirectory string
metadataFile string
@@ -78,6 +81,7 @@ func main() {
ctflag.Uint64(&fs, &opts.PersistSize, "batch-disk", "k", 16384)
ctflag.Uint64(&fs, &opts.BatchSize, "batch-req", "q", 512)
ctflag.String(&fs, &opts.HTTPAgent, "http-agent", "a", "git.cs.kau.se/rasmoste/ct-sans")
+ ctflag.Duration(&fs, &opts.MetricsInterval, "metrics", "m", 15*time.Second)
// Parse command-line options and hardcode additional values
if err := ctflag.Parse(fs, os.Args[2:]); err != nil {