Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: Print fullly resolved config #5168

Closed
gmandrade21 opened this issue Feb 5, 2024 · 7 comments
Closed

[Feature]: Print fullly resolved config #5168

gmandrade21 opened this issue Feb 5, 2024 · 7 comments
Labels
enhancement good first issue Good for beginners help wanted Features that maintainers are willing to accept but do not have cycles to implement

Comments

@gmandrade21
Copy link

Requirement

See all configurations in Jaeger. Example:
Today we have the Prometheus metrics jaeger_collector_queue_capacity, where we can find the value of our capacity. We need to see all of our variables and parameters like METRICS_STORAGE_TYPE, JAEGER_REPORTER_LOG_SPANS, COLLECTOR_NUM_WORKERS, etc

Problem

We can't see if the environment variables is actually working, we change those guys and work very well in our environment, but, if we forgot to change a single node in those parameters we don't have visibility

Proposal

Transform all environment variables in metrics and add a CLI command to show the default value and the actual value

Open questions

No response

@yurishkuro yurishkuro added help wanted Features that maintainers are willing to accept but do not have cycles to implement good first issue Good for beginners labels Feb 5, 2024
@yurishkuro
Copy link
Member

We could add a new CLI subcommand to print the config. The cobra/viper libraries already provide access to a resolved Config object, it's possible they have a way to iterate through it and print a combined configuration.

One concern with printing config is that it would also print any secrets / passwords provided, but imo the user running the command would already need to have access to them in the first place, so the risk is only if they try to share that printed config.

@gmafrac
Copy link
Contributor

gmafrac commented Feb 5, 2024

I would like to take this issue

@gmafrac
Copy link
Contributor

gmafrac commented Feb 7, 2024

Hi @gmandrade21 and @yurishkuro , I'm a beginner contributor and this is my first issue. I've been introducing myself to the project over the last few days but I still have a few doubts about this issue:

  • How could I turn environment variables into metrics?

  • I didn't quite understand about the default value and the current value, could you explain it? Are all values both default and non-default?

I've looked at some documentation and haven't found anything about it. If you have any recommendations for documentation, it would be very valuable.

Thanks for the attention! 🙂

@yurishkuro
Copy link
Member

@gmafrac sorry, I don't understand your questions.

The problem here is if you run a program with SOME_ENV_VAR=xyz my-program ..., how do you know what effect SOME_ENV_VAR had, whether it was used by the program or ignored and some default value was used instead. So if we allow a print-config subcommand, the user can validate that the final resolved configuration is used by the program.

gmafrac added a commit to gmafrac/jaeger that referenced this issue Feb 10, 2024
Signed-off-by: Guilherme Mafra da Costa <g.mafra.costa@gmail.com>
@gmafrac
Copy link
Contributor

gmafrac commented Feb 10, 2024

Thanks for the explanation! I've done a PR and I'm waiting for feedback.

gmafrac added a commit to gmafrac/jaeger that referenced this issue Feb 11, 2024
Signed-off-by: Guilherme Mafra da Costa <g.mafra.costa@gmail.com>
yurishkuro added a commit that referenced this issue Feb 19, 2024
## 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 <g.mafra.costa@gmail.com>
Signed-off-by: Guilherme Mafra <81496731+gmafrac@users.noreply.github.com>
Co-authored-by: Yuri Shkuro <yurishkuro@users.noreply.github.com>
@pavolloffay
Copy link
Member

Is this done?

@varshith257
Copy link
Contributor

@pavolloffay I think it's done PR got merged. we can close this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement good first issue Good for beginners help wanted Features that maintainers are willing to accept but do not have cycles to implement
Projects
None yet
Development

No branches or pull requests

5 participants