krzko / otelgen

🤖 A tool to generate synthetic OpenTelemetry logs, metrics and traces using OTLP (gRPC and HTTP)
Apache License 2.0
82 stars 14 forks source link

log-level param is ignored #116

Open cforce opened 1 year ago

cforce commented 1 year ago

It shall not print indo logs

otelgen --otel-exporter-otlp-endpoint localhost:4318 --protocol http --insecure --service-name otelgen --log-level warn --duration 30 metrics counter
{"level":"info","ts":1689025485.5422175,"caller":"cli/metrics_root.go:132","msg":"using","temporarility":"delta"}
{"level":"info","ts":1689025485.5423172,"caller":"cli/metrics_root.go:77","msg":"starting HTTP exporter"}
{"level":"info","ts":1689025485.542361,"caller":"cli/metrics_counter.go:58","msg":"Starting metrics generation"}
{"level":"error","ts":1689025485.542427,"caller":"metrics/worker.go:50","msg":"either `metrics` or `duration` must be greater than 0","stacktrace":"github.com/krzko/otelgen/internal/metrics.(*Worker).Run\n\t/home/runner/work/otelgen/otelgen/internal/metrics/worker.go:50\ngithub.com/krzko/otelgen/internal/metrics.run\n\t/home/runner/work/otelgen/otelgen/internal/metrics/worker.go:38\ngithub.com/krzko/otelgen/internal/metrics.SimulateCounter\n\t/home/runner/work/otelgen/otelgen/internal/metrics/counter.go:16\ngithub.com/krzko/otelgen/internal/cli.generateMetricsCounterAction\n\t/home/runner/work/otelgen/otelgen/internal/cli/metrics_counter.go:67\ngithub.com/krzko/otelgen/internal/cli.glob..func1\n\t/home/runner/work/otelgen/otelgen/internal/cli/metrics_counter.go:27\ngithub.com/urfave/cli/v2.(*Command).Run\n\t/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.25.3/command.go:274\ngithub.com/urfave/cli/v2.(*Command).Run\n\t/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.25.3/command.go:267\ngithub.com/urfave/cli/v2.(*Command).Run\n\t/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.25.3/command.go:267\ngithub.com/urfave/cli/v2.(*App).RunContext\n\t/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.25.3/app.go:332\ngithub.com/urfave/cli/v2.(*App).Run\n\t/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.25.3/app.go:309\nmain.main\n\t/home/runner/work/otelgen/otelgen/cmd/otelgen/main.go:19\nruntime.main\n\t/opt/hostedtoolcache/go/1.19.9/x64/src/runtime/proc.go:250"}    
{"level":"error","ts":1689025485.5424926,"caller":"metrics/counter.go:18","msg":"failed to run counter","error":"failed to run worker: either `metrics` or `duration` must be greater than 0","stacktrace":"github.com/krzko/otelgen/internal/metrics.SimulateCounter\n\t/home/runner/work/otelgen/otelgen/internal/metrics/counter.go:18\ngithub.com/krzko/otelgen/internal/cli.generateMetricsCounterAction\n\t/home/runner/work/otelgen/otelgen/internal/cli/metrics_counter.go:67\ngithub.com/krzko/otelgen/internal/cli.glob..func1\n\t/home/runner/work/otelgen/otelgen/internal/cli/metrics_counter.go:27\ngithub.com/urfave/cli/v2.(*Command).Run\n\t/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.25.3/command.go:274\ngithub.com/urfave/cli/v2.(*Command).Run\n\t/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.25.3/command.go:267\ngithub.com/urfave/cli/v2.(*Command).Run\n\t/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.25.3/command.go:267\ngithub.com/urfave/cli/v2.(*App).RunContext\n\t/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.25.3/app.go:332\ngithub.com/urfave/cli/v2.(*App).Run\n\t/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.25.3/app.go:309\nmain.main\n\t/home/runner/work/otelgen/otelgen/cmd/otelgen/main.go:19\nruntime.main\n\t/opt/hostedtoolcache/go/1.19.9/x64/src/runtime/proc.go:250"}
{"level":"info","ts":1689025485.5425222,"caller":"cli/metrics_root.go:192","msg":"stopping the exporter"}
otelgen --otel-exporter-otlp-endpoint localhost:4317 --protocol grpc --insecure --service-name otelgen --log-level warn --du
cforce commented 1 year ago

@krzko --duration=30 -> error, duration can't be 0 --duration=0 -> ok, works, but uses default value of 24 hours to run test

tjuchniewicz commented 1 year ago

So we have two problems in this ticket:

  1. log-level param is ignored
  2. --duration 30 does not work