-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Add the print-config subcommand #5200
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code does not compile
17:48:17 ~/dev/jaegertracing/jaeger gmafrac/print-config ✔
$ go run ./cmd/all-in-one print-config
cmd/all-in-one/main.go:36:2: found packages printconfig (command.go) and print_config (config.go) in /Users/ysh/dev/jaegertracing/jaeger/cmd/internal/config
make sure commits are signed, see CONTRIBUTING.md |
Signed-off-by: Guilherme Mafra da Costa <g.mafra.costa@gmail.com>
affa758
to
5996b8a
Compare
Signed-off-by: Guilherme Mafra da Costa <g.mafra.costa@gmail.com>
Signed-off-by: Guilherme Mafra da Costa <g.mafra.costa@gmail.com>
Signed-off-by: Guilherme Mafra da Costa <g.mafra.costa@gmail.com>
Signed-off-by: Guilherme Mafra da Costa <g.mafra.costa@gmail.com>
5996b8a
to
0326e05
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please include sample output of the new command in the pr description
Co-authored-by: Yuri Shkuro <yurishkuro@users.noreply.github.com> Signed-off-by: Guilherme Mafra <81496731+gmafrac@users.noreply.github.com>
Signed-off-by: Guilherme Mafra da Costa <g.mafra.costa@gmail.com>
Signed-off-by: Guilherme Mafra da Costa <g.mafra.costa@gmail.com>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5200 +/- ##
==========================================
+ Coverage 94.38% 94.44% +0.05%
==========================================
Files 331 334 +3
Lines 19156 19254 +98
==========================================
+ Hits 18081 18184 +103
+ Misses 886 882 -4
+ Partials 189 188 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Maybe it makes sense to only print flags that have an actual value, either default or user-assigned (and would be nice to distinguish those two). And you could add The linter is failing. |
Signed-off-by: Guilherme Mafra da Costa <g.mafra.costa@gmail.com>
Signed-off-by: Guilherme Mafra da Costa <g.mafra.costa@gmail.com>
I followed your suggestions and added a --all flag and a print to identify whether it is a default or user-assigned value. I ran 'make lint test' successfully and I've added to the PR description about these details, updating the sample output as well. |
Co-authored-by: Yuri Shkuro <yurishkuro@users.noreply.github.com> Signed-off-by: Guilherme Mafra <81496731+gmafrac@users.noreply.github.com>
Co-authored-by: Yuri Shkuro <yurishkuro@users.noreply.github.com> Signed-off-by: Guilherme Mafra <81496731+gmafrac@users.noreply.github.com>
Co-authored-by: Yuri Shkuro <yurishkuro@users.noreply.github.com> Signed-off-by: Guilherme Mafra <81496731+gmafrac@users.noreply.github.com>
Signed-off-by: Guilherme Mafra da Costa <g.mafra.costa@gmail.com>
Signed-off-by: Guilherme Mafra da Costa <g.mafra.costa@gmail.com>
Signed-off-by: Guilherme Mafra da Costa <g.mafra.costa@gmail.com>
Signed-off-by: Guilherme Mafra da Costa <g.mafra.costa@gmail.com>
Signed-off-by: Guilherme Mafra da Costa <g.mafra.costa@gmail.com>
Signed-off-by: Guilherme Mafra da Costa <g.mafra.costa@gmail.com>
Signed-off-by: Guilherme Mafra da Costa <g.mafra.costa@gmail.com>
Signed-off-by: Guilherme Mafra da Costa <g.mafra.costa@gmail.com>
Thanks for the explanation and suggestion, I've updated the test, but I still have a doubt: is there another test that would be interesting for the printconfig command? Or would this test be enough? |
Signed-off-by: Guilherme Mafra da Costa <g.mafra.costa@gmail.com>
When testing a representation with default values, I read the function I'm using to check if a value has been assigned by the user. I discovered that the "v.IsSet()" function I'm using to check whether a value has been assigned by the user only returns false if the flag is a default. So I have another doubt that I'd like to understand: is it possible to check whether a value is a default setting using this logic? Is there another way for a setting to be default? Below, I've posted an extract from the viper library (viper@v1.18.2) showing the IsSet() function and the documentation for the find() function to explain this.
|
Signed-off-by: Guilherme Mafra da Costa <g.mafra.costa@gmail.com>
Signed-off-by: Guilherme Mafra da Costa <g.mafra.costa@gmail.com>
Signed-off-by: Guilherme Mafra da Costa <g.mafra.costa@gmail.com>
I've made these changes, but I still have doubts about the comment above (about the default and user-assigned values) |
from what I see, IsSet calls find() with flagDefault=false, which means it will not take default value into account, only value explicitly set by the user via any of the supported mechanisms |
Yes, but this function will only indicate whether the flag is default and not whether other types of configurations are set as default (as in the setDefault method, for example). But, looking at the tests and the output generated for the configurations present in the project (in the description), I believe that this implementation makes sense. Therefore, I believe that the changes made could already be reviewed |
so the best way is to verify this with unit tests. Your tests are written differently from how we usually do them for CLI flags, so it's hard to understand what's happening when you call Set. Compare with
|
Signed-off-by: Guilherme Mafra da Costa <g.mafra.costa@gmail.com>
I have adapted the unit test to declare the flags as declared in the code example. I imported the Jaeger libraries to do this with the exception of gprc, which I based on the code but didn't import. As a result: The settings declared in config.Viperize were "default" and those analysed in "parse flags" were "user-assigned". |
Thanks! |
Thank you for your help! |
…31709) [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [github.com/jaegertracing/jaeger](https://togithub.com/jaegertracing/jaeger) | `v1.54.0` -> `v1.55.0` | [![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fjaegertracing%2fjaeger/v1.55.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2fjaegertracing%2fjaeger/v1.55.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2fjaegertracing%2fjaeger/v1.54.0/v1.55.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fjaegertracing%2fjaeger/v1.54.0/v1.55.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- > [!WARNING] > Some dependencies could not be looked up. Check the Dependency Dashboard for more information. --- ### Release Notes <details> <summary>jaegertracing/jaeger (github.com/jaegertracing/jaeger)</summary> ### [`v1.55.0`](https://togithub.com/jaegertracing/jaeger/releases/tag/v1.55.0): Release 1.55.0 [Compare Source](https://togithub.com/jaegertracing/jaeger/compare/v1.54.0...v1.55.0) ##### Backend Changes ##### ✨ New Features: - Support uploading traces to UI in OpenTelemetry format (OTLP/JSON) ([@​NavinShrinivas](https://togithub.com/NavinShrinivas) in [#​5155](https://togithub.com/jaegertracing/jaeger/pull/5155)) - Add Elasticsearch storage support for adaptive sampling ([@​Pushkarm029](https://togithub.com/Pushkarm029) in [#​5158](https://togithub.com/jaegertracing/jaeger/pull/5158)) ##### 🐞 Bug fixes, Minor Improvements: - Add the `print-config` subcommand ([@​gmafrac](https://togithub.com/gmafrac) in [#​5200](https://togithub.com/jaegertracing/jaeger/pull/5200)) - Return more detailed errors from ES storage ([@​yurishkuro](https://togithub.com/yurishkuro) in [#​5209](https://togithub.com/jaegertracing/jaeger/pull/5209)) - Bump go version ([@​yurishkuro](https://togithub.com/yurishkuro) in [#​5180](https://togithub.com/jaegertracing/jaeger/pull/5180)) ##### 🚧 Experimental Features: - \[jaeger-v2] Add support for gRPC storarge ([@​james-ryans](https://togithub.com/james-ryans) in [#​5228](https://togithub.com/jaegertracing/jaeger/pull/5228)) - \[jaeger-v2] Add support for Elasticsearch ([@​akagami-harsh](https://togithub.com/akagami-harsh) in [#​5152](https://togithub.com/jaegertracing/jaeger/pull/5152)) ##### 📊 UI Changes - UI pinned to version [1.39.0](https://togithub.com/jaegertracing/jaeger-ui/blob/main/CHANGELOG.md#v1390-2024-03-04). ##### 👏 New Contributors - [@​h4shk4t](https://togithub.com/h4shk4t) made their first contribution in [https://github.com/jaegertracing/jaeger/pull/5162](https://togithub.com/jaegertracing/jaeger/pull/5162) - [@​NavinShrinivas](https://togithub.com/NavinShrinivas) made their first contribution in [https://github.com/jaegertracing/jaeger/pull/5155](https://togithub.com/jaegertracing/jaeger/pull/5155) - [@​prakrit55](https://togithub.com/prakrit55) made their first contribution in [https://github.com/jaegertracing/jaeger/pull/5197](https://togithub.com/jaegertracing/jaeger/pull/5197) - [@​gmafrac](https://togithub.com/gmafrac) made their first contribution in [https://github.com/jaegertracing/jaeger/pull/5200](https://togithub.com/jaegertracing/jaeger/pull/5200) </details> --- ### Configuration 📅 **Schedule**: Branch creation - "on tuesday" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/open-telemetry/opentelemetry-collector-contrib). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yMzguMSIsInVwZGF0ZWRJblZlciI6IjM3LjIzOC4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9--> --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: opentelemetrybot <107717825+opentelemetrybot@users.noreply.github.com>
…pen-telemetry#31709) [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [github.com/jaegertracing/jaeger](https://togithub.com/jaegertracing/jaeger) | `v1.54.0` -> `v1.55.0` | [![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fjaegertracing%2fjaeger/v1.55.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2fjaegertracing%2fjaeger/v1.55.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2fjaegertracing%2fjaeger/v1.54.0/v1.55.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fjaegertracing%2fjaeger/v1.54.0/v1.55.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- > [!WARNING] > Some dependencies could not be looked up. Check the Dependency Dashboard for more information. --- ### Release Notes <details> <summary>jaegertracing/jaeger (github.com/jaegertracing/jaeger)</summary> ### [`v1.55.0`](https://togithub.com/jaegertracing/jaeger/releases/tag/v1.55.0): Release 1.55.0 [Compare Source](https://togithub.com/jaegertracing/jaeger/compare/v1.54.0...v1.55.0) ##### Backend Changes ##### ✨ New Features: - Support uploading traces to UI in OpenTelemetry format (OTLP/JSON) ([@&open-telemetry#8203;NavinShrinivas](https://togithub.com/NavinShrinivas) in [#&open-telemetry#8203;5155](https://togithub.com/jaegertracing/jaeger/pull/5155)) - Add Elasticsearch storage support for adaptive sampling ([@&open-telemetry#8203;Pushkarm029](https://togithub.com/Pushkarm029) in [#&open-telemetry#8203;5158](https://togithub.com/jaegertracing/jaeger/pull/5158)) ##### 🐞 Bug fixes, Minor Improvements: - Add the `print-config` subcommand ([@&open-telemetry#8203;gmafrac](https://togithub.com/gmafrac) in [#&open-telemetry#8203;5200](https://togithub.com/jaegertracing/jaeger/pull/5200)) - Return more detailed errors from ES storage ([@&open-telemetry#8203;yurishkuro](https://togithub.com/yurishkuro) in [#&open-telemetry#8203;5209](https://togithub.com/jaegertracing/jaeger/pull/5209)) - Bump go version ([@&open-telemetry#8203;yurishkuro](https://togithub.com/yurishkuro) in [#&open-telemetry#8203;5180](https://togithub.com/jaegertracing/jaeger/pull/5180)) ##### 🚧 Experimental Features: - \[jaeger-v2] Add support for gRPC storarge ([@&open-telemetry#8203;james-ryans](https://togithub.com/james-ryans) in [#&open-telemetry#8203;5228](https://togithub.com/jaegertracing/jaeger/pull/5228)) - \[jaeger-v2] Add support for Elasticsearch ([@&open-telemetry#8203;akagami-harsh](https://togithub.com/akagami-harsh) in [#&open-telemetry#8203;5152](https://togithub.com/jaegertracing/jaeger/pull/5152)) ##### 📊 UI Changes - UI pinned to version [1.39.0](https://togithub.com/jaegertracing/jaeger-ui/blob/main/CHANGELOG.md#v1390-2024-03-04). ##### 👏 New Contributors - [@&open-telemetry#8203;h4shk4t](https://togithub.com/h4shk4t) made their first contribution in [https://github.com/jaegertracing/jaeger/pull/5162](https://togithub.com/jaegertracing/jaeger/pull/5162) - [@&open-telemetry#8203;NavinShrinivas](https://togithub.com/NavinShrinivas) made their first contribution in [https://github.com/jaegertracing/jaeger/pull/5155](https://togithub.com/jaegertracing/jaeger/pull/5155) - [@&open-telemetry#8203;prakrit55](https://togithub.com/prakrit55) made their first contribution in [https://github.com/jaegertracing/jaeger/pull/5197](https://togithub.com/jaegertracing/jaeger/pull/5197) - [@&open-telemetry#8203;gmafrac](https://togithub.com/gmafrac) made their first contribution in [https://github.com/jaegertracing/jaeger/pull/5200](https://togithub.com/jaegertracing/jaeger/pull/5200) </details> --- ### Configuration 📅 **Schedule**: Branch creation - "on tuesday" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/open-telemetry/opentelemetry-collector-contrib). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yMzguMSIsInVwZGF0ZWRJblZlciI6IjM3LjIzOC4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9--> --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: opentelemetrybot <107717825+opentelemetrybot@users.noreply.github.com>
…pen-telemetry#31709) [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [github.com/jaegertracing/jaeger](https://togithub.com/jaegertracing/jaeger) | `v1.54.0` -> `v1.55.0` | [![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fjaegertracing%2fjaeger/v1.55.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2fjaegertracing%2fjaeger/v1.55.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2fjaegertracing%2fjaeger/v1.54.0/v1.55.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fjaegertracing%2fjaeger/v1.54.0/v1.55.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- > [!WARNING] > Some dependencies could not be looked up. Check the Dependency Dashboard for more information. --- ### Release Notes <details> <summary>jaegertracing/jaeger (github.com/jaegertracing/jaeger)</summary> ### [`v1.55.0`](https://togithub.com/jaegertracing/jaeger/releases/tag/v1.55.0): Release 1.55.0 [Compare Source](https://togithub.com/jaegertracing/jaeger/compare/v1.54.0...v1.55.0) ##### Backend Changes ##### ✨ New Features: - Support uploading traces to UI in OpenTelemetry format (OTLP/JSON) ([@&open-telemetry#8203;NavinShrinivas](https://togithub.com/NavinShrinivas) in [#&open-telemetry#8203;5155](https://togithub.com/jaegertracing/jaeger/pull/5155)) - Add Elasticsearch storage support for adaptive sampling ([@&open-telemetry#8203;Pushkarm029](https://togithub.com/Pushkarm029) in [#&open-telemetry#8203;5158](https://togithub.com/jaegertracing/jaeger/pull/5158)) ##### 🐞 Bug fixes, Minor Improvements: - Add the `print-config` subcommand ([@&open-telemetry#8203;gmafrac](https://togithub.com/gmafrac) in [#&open-telemetry#8203;5200](https://togithub.com/jaegertracing/jaeger/pull/5200)) - Return more detailed errors from ES storage ([@&open-telemetry#8203;yurishkuro](https://togithub.com/yurishkuro) in [#&open-telemetry#8203;5209](https://togithub.com/jaegertracing/jaeger/pull/5209)) - Bump go version ([@&open-telemetry#8203;yurishkuro](https://togithub.com/yurishkuro) in [#&open-telemetry#8203;5180](https://togithub.com/jaegertracing/jaeger/pull/5180)) ##### 🚧 Experimental Features: - \[jaeger-v2] Add support for gRPC storarge ([@&open-telemetry#8203;james-ryans](https://togithub.com/james-ryans) in [#&open-telemetry#8203;5228](https://togithub.com/jaegertracing/jaeger/pull/5228)) - \[jaeger-v2] Add support for Elasticsearch ([@&open-telemetry#8203;akagami-harsh](https://togithub.com/akagami-harsh) in [#&open-telemetry#8203;5152](https://togithub.com/jaegertracing/jaeger/pull/5152)) ##### 📊 UI Changes - UI pinned to version [1.39.0](https://togithub.com/jaegertracing/jaeger-ui/blob/main/CHANGELOG.md#v1390-2024-03-04). ##### 👏 New Contributors - [@&open-telemetry#8203;h4shk4t](https://togithub.com/h4shk4t) made their first contribution in [https://github.com/jaegertracing/jaeger/pull/5162](https://togithub.com/jaegertracing/jaeger/pull/5162) - [@&open-telemetry#8203;NavinShrinivas](https://togithub.com/NavinShrinivas) made their first contribution in [https://github.com/jaegertracing/jaeger/pull/5155](https://togithub.com/jaegertracing/jaeger/pull/5155) - [@&open-telemetry#8203;prakrit55](https://togithub.com/prakrit55) made their first contribution in [https://github.com/jaegertracing/jaeger/pull/5197](https://togithub.com/jaegertracing/jaeger/pull/5197) - [@&open-telemetry#8203;gmafrac](https://togithub.com/gmafrac) made their first contribution in [https://github.com/jaegertracing/jaeger/pull/5200](https://togithub.com/jaegertracing/jaeger/pull/5200) </details> --- ### Configuration 📅 **Schedule**: Branch creation - "on tuesday" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/open-telemetry/opentelemetry-collector-contrib). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yMzguMSIsInVwZGF0ZWRJblZlciI6IjM3LjIzOC4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9--> --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: opentelemetrybot <107717825+opentelemetrybot@users.noreply.github.com>
Which problem is this PR solving?
Description of the changes
Below is an example of the output without a all flag:
How was this change tested?
Checklist
jaeger
:make lint test
jaeger-ui
:yarn lint
andyarn test