Skip to content

[service]: add new subcommand to examine the initial configuration #11775

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

Merged
merged 56 commits into from
Feb 20, 2025

Conversation

VihasMakwana
Copy link
Contributor

@VihasMakwana VihasMakwana commented Nov 29, 2024

Description

Why is this useful?

  • Users might want to examine the config if they face any errors at boot time. This subcommand prints the configuration on stdout after merging and resolving from all the --config sources.
  • The command prints the configuration even if it's invalid. This can help user to track down the faulty piece of config.

Usage

./otelcorecol examine --config=file:file.yaml --config=http://remote:8080/config --config=file:file2.yaml

Link to tracking issue

Fixes ##11479

Testing

Added unit test cases.

Documentation

Updated readme.

@VihasMakwana VihasMakwana requested a review from a team as a code owner November 29, 2024 14:03
Co-authored-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
@VihasMakwana VihasMakwana requested a review from mauri870 December 2, 2024 15:34
bogdandrutu pushed a commit that referenced this pull request Dec 2, 2024
Copy link

codecov bot commented Dec 2, 2024

Codecov Report

Attention: Patch coverage is 90.32258% with 3 lines in your changes missing coverage. Please review.

Project coverage is 92.18%. Comparing base (56fbf4c) to head (9116f55).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
otelcol/command_print.go 90.00% 2 Missing and 1 partial ⚠️

❌ Your patch status has failed because the patch coverage (90.32%) is below the target coverage (95.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #11775      +/-   ##
==========================================
- Coverage   92.18%   92.18%   -0.01%     
==========================================
  Files         465      466       +1     
  Lines       25275    25306      +31     
==========================================
+ Hits        23301    23329      +28     
- Misses       1575     1577       +2     
- Partials      399      400       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@VihasMakwana VihasMakwana requested a review from mauri870 December 9, 2024 12:47
@VihasMakwana
Copy link
Contributor Author

@dmitryax @mauri870 can you take a look?

if err != nil {
return fmt.Errorf("error while marshaling to yaml: %w", err)
}
log.Printf("\n%s", b)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you change to fmt.Printf here? This output is likely to be piped/redirected and I would rather not have a random timestamp at the start of the output.

@mauri870
Copy link
Contributor

Reviewed again, LGTM. Thanks for adding a test to check the tool output.

@mx-psi
Copy link
Member

mx-psi commented Feb 12, 2025

cc @open-telemetry/collector-approvers This PR adds a new experimental (under a feature gate) subcommand to examine the initial configuration. I will merge this PR in one week if there are no further comments

Copy link
Contributor

@evan-bradley evan-bradley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @VihasMakwana! This looks good, I mostly have copyediting notes. The most important one is that we should describe how to use this in the changelog.

VihasMakwana and others added 11 commits February 13, 2025 18:38
Co-authored-by: Evan Bradley <11745660+evan-bradley@users.noreply.github.com>
Co-authored-by: Evan Bradley <11745660+evan-bradley@users.noreply.github.com>
Co-authored-by: Evan Bradley <11745660+evan-bradley@users.noreply.github.com>
Co-authored-by: Evan Bradley <11745660+evan-bradley@users.noreply.github.com>
Co-authored-by: Evan Bradley <11745660+evan-bradley@users.noreply.github.com>
Co-authored-by: Evan Bradley <11745660+evan-bradley@users.noreply.github.com>
Co-authored-by: Evan Bradley <11745660+evan-bradley@users.noreply.github.com>
Co-authored-by: Evan Bradley <11745660+evan-bradley@users.noreply.github.com>
Co-authored-by: Evan Bradley <11745660+evan-bradley@users.noreply.github.com>
@evan-bradley
Copy link
Contributor

@VihasMakwana it looks like you have a few failing checks and tests, could you take a look at those?

@evan-bradley
Copy link
Contributor

@VihasMakwana Sorry for the churn, needs a make gotidy now.

@mx-psi
Copy link
Member

mx-psi commented Feb 19, 2025

@VihasMakwana I will merge this after you have fixed the merge conflicts!

@VihasMakwana
Copy link
Contributor Author

@mx-psi I've rebased main. Once CI is good, this can be merged.

@mx-psi mx-psi enabled auto-merge February 20, 2025 15:29
@mx-psi mx-psi added this pull request to the merge queue Feb 20, 2025
Merged via the queue into open-telemetry:main with commit d6d07c8 Feb 20, 2025
54 of 55 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants