Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the print-config subcommand (#5200)
## Which problem is this PR solving? - Resolves Issue #5168 <!-- Example: Resolves #123 --> ## Description of the changes - Create a print-config CLI subcommand to print the resolved configurations in the path /cmd/internal/config. It iterates through the settings with viper, returning all the keys that contain a value and printing whether that value is default or not. - Create a --all flag that when called prints all settings, whether they have values or not. Below is an example of the output without a all flag: ``` bash go run cmd/all-in-one/main.go print-config 2024/02/15 13:55:52 maxprocs: Leaving GOMAXPROCS=16: CPU quota undefined 2024/02/15 13:55:52 application version: git-commit=, git-version=, build-date= ------------------------------------------------------------------------------- | Configuration Option Name Value Source | ------------------------------------------------------------------------------- | admin.http.host-port :14269 default | | admin.http.tls.enabled false default | | collector.enable-span-size-metrics false default | | collector.grpc-server.host-port :14250 default | | collector.grpc-server.max-connection-age 0s default | | collector.grpc-server.max-connection-age-grace 0s default | | collector.grpc-server.max-message-size 4194304 default | | collector.grpc.tls.enabled false default | | collector.http-server.host-port :14268 default | | collector.http-server.idle-timeout 0s default | | collector.http-server.read-header-timeout 2s default | | collector.http-server.read-timeout 0s default | | collector.http.tls.enabled false default | | collector.num-workers 50 default | | collector.otlp.enabled true default | | collector.otlp.grpc.max-connection-age 0s default | | collector.otlp.grpc.max-connection-age-grace 0s default | | collector.otlp.grpc.max-message-size 4194304 default | | collector.otlp.grpc.tls.enabled false default | | collector.otlp.grpc.tls.reload-interval 0s default | | collector.otlp.http.idle-timeout 0s default | | collector.otlp.http.read-header-timeout 2s default | | collector.otlp.http.read-timeout 0s default | | collector.otlp.http.tls.enabled false default | | collector.otlp.http.tls.reload-interval 0s default | | collector.queue-size 2000 default | | collector.queue-size-memory 0 default | | collector.zipkin.keep-alive true default | | collector.zipkin.tls.enabled false default | | dir ./ default | | downsampling.ratio 1 default | | format md default | | http-server.host-port :5778 default | | log-level info default | | memory.max-traces 0 default | | metrics-backend prometheus default | | metrics-http-route /metrics default | | multi-tenancy.enabled false default | | multi-tenancy.header x-tenant default | | processor.jaeger-binary.server-host-port :6832 default | | processor.jaeger-binary.server-max-packet-size 65000 default | | processor.jaeger-binary.server-queue-size 1000 default | | processor.jaeger-binary.server-socket-buffer-size 0 default | | processor.jaeger-binary.workers 10 default | | processor.jaeger-compact.server-host-port :6831 default | | processor.jaeger-compact.server-max-packet-size 65000 default | | processor.jaeger-compact.server-queue-size 1000 default | | processor.jaeger-compact.server-socket-buffer-size 0 default | | processor.jaeger-compact.workers 10 default | | processor.zipkin-compact.server-host-port :5775 default | | processor.zipkin-compact.server-max-packet-size 65000 default | | processor.zipkin-compact.server-queue-size 1000 default | | processor.zipkin-compact.server-socket-buffer-size 0 default | | processor.zipkin-compact.workers 10 default | | query.base-path / default | | query.bearer-token-propagation false default | | query.enable-tracing false default | | query.grpc-server.host-port :16685 default | | query.grpc.tls.enabled false default | | query.http-server.host-port :16686 default | | query.http.tls.enabled false default | | query.log-static-assets-access false default | | query.max-clock-skew-adjustment 0s default | | reporter.grpc.discovery.min-peers 3 default | | reporter.grpc.retry.max 3 default | | reporter.grpc.tls.enabled false default | | reporter.grpc.tls.skip-host-verify false default | | reporter.type grpc default | | sampling.strategies-reload-interval 0s default | | span-storage.type memory user-assigned | | status.http.host-port :14269 default | ------------------------------------------------------------------------------- ``` ## How was this change tested? - I tested this function by adding some variables using the viper library., calling the CLI command to check them and comparing them in both key and value. ## Checklist - [X] I have read https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md - [X] I have signed all commits - [X] I have added unit tests for the new functionality - [X] I have run lint and test steps successfully - for `jaeger`: `make lint test` - for `jaeger-ui`: `yarn lint` and `yarn test` --------- Signed-off-by: Guilherme Mafra da Costa <[email protected]> Signed-off-by: Guilherme Mafra <[email protected]> Co-authored-by: Yuri Shkuro <[email protected]>
- Loading branch information