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

[service] Add omitempty tag to config fields #12501

Merged
merged 1 commit into from
Feb 27, 2025

Conversation

evan-bradley
Copy link
Contributor

Description

Update config structs in the service module to include omitempty tags.

Link to tracking issue

Works toward #12191

@evan-bradley evan-bradley requested a review from a team as a code owner February 26, 2025 19:08
@evan-bradley evan-bradley requested a review from songy23 February 26, 2025 19:08
Copy link

codecov bot commented Feb 26, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.16%. Comparing base (216046a) to head (a15bd9c).
Report is 19 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #12501   +/-   ##
=======================================
  Coverage   92.16%   92.16%           
=======================================
  Files         465      465           
  Lines       25201    25201           
=======================================
  Hits        23226    23226           
  Misses       1576     1576           
  Partials      399      399           

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

Comment on lines 31 to 32
Logs LogsConfig `mapstructure:"logs"`
Metrics MetricsConfig `mapstructure:"metrics"`
Copy link
Member

Choose a reason for hiding this comment

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

Do these need omitempty too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I probably should have included this in the PR description, my bad. I only added omitempty to fields where the zero value is also the default. Otherwise the zero value won't be emitted during serialization and it would be impossible to generate configs that set the zero value.

For these fields, we have default configurations for both the Logs and Metrics fields, so I didn't add omitempty so they can be unset if need be.

@codeboten codeboten added this pull request to the merge queue Feb 27, 2025
Merged via the queue into open-telemetry:main with commit 0faea29 Feb 27, 2025
54 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.

3 participants