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

Revert "Revert "Fix: Force usage of case-sensitive keys in configurations (#6876)" (#6988)" #7021

Merged

Conversation

gbbr
Copy link
Member

@gbbr gbbr commented Jan 25, 2023

This reverts commit 80cabdd.

Closes #7002

@gbbr gbbr requested review from a team and bogdandrutu January 25, 2023 09:35
@codecov
Copy link

codecov bot commented Jan 25, 2023

Codecov Report

Base: 90.36% // Head: 89.88% // Decreases project coverage by -0.48% ⚠️

Coverage data is based on head (77b4981) compared to base (1af31a0).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7021      +/-   ##
==========================================
- Coverage   90.36%   89.88%   -0.48%     
==========================================
  Files         243      245       +2     
  Lines       14598    14724     +126     
==========================================
+ Hits        13191    13235      +44     
- Misses       1138     1219      +81     
- Partials      269      270       +1     
Impacted Files Coverage Δ
confmap/confmap.go 90.12% <100.00%> (+0.18%) ⬆️
featuregate/registry.go 70.65% <0.00%> (-13.56%) ⬇️
service/graph.go 71.42% <0.00%> (-8.58%) ⬇️
service/nodes.go 4.49% <0.00%> (-8.41%) ⬇️
pdata/plog/plogotlp/grpc.go 73.33% <0.00%> (-5.24%) ⬇️
pdata/ptrace/ptraceotlp/grpc.go 73.33% <0.00%> (-5.24%) ⬇️
pdata/pmetric/pmetricotlp/grpc.go 73.33% <0.00%> (-5.24%) ⬇️
service/service.go 66.14% <0.00%> (-1.36%) ⬇️
otelcol/config.go 96.38% <0.00%> (ø)
service/zpages.go 64.00% <0.00%> (ø)
... and 12 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@bogdandrutu
Copy link
Member

Some things that I have in mind and will like answers/someone to think about:

@gbbr
Copy link
Member Author

gbbr commented Jan 27, 2023

@rapphil I think you may want to jump in here considering you have opened to original PR.

@rapphil
Copy link
Contributor

rapphil commented Jan 27, 2023

@bogdandrutu
Based on https://github.com/open-telemetry/opentelemetry-collector/blob/main/component/componenttest/configtest.go#L34 can we say that we only support case sensitive configurations with with lowercase keys? (otherwise why would we enforce the tags to be lowercase?)

So answering your questions:

We have a test helper for configs that disallow uppercase, see https://github.com/open-telemetry/opentelemetry-collector/blob/main/component/componenttest/configtest.go#L34. Please consider to come with a fix there as well if needed.

We don't need to fix anything as this check function is enforcing case-sensitive tags in the config structs, so it aligns with the validation that will happen in mapstructrure when the configuration is Unmarshalled into a struct.

By default because fields need to be public they are uppercase. In case of not having a "mapstructure" tag they will be uppercased in the config, is that expected? Do we want to be lowercase by default if no tag?

This will only happen if a config is not validated using the CheckConfigStruct function. yes, we should check this case.

@bogdandrutu
Copy link
Member

@gbbr you need to also remove the wrong comment from IsSet

@gbbr
Copy link
Member Author

gbbr commented Jan 30, 2023

Thanks for flagging that Bogdan, done.

@bogdandrutu bogdandrutu merged commit bdf63b7 into open-telemetry:main Jan 31, 2023
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.

Collector supports case insensitive configuration but it is not properly handled across the codebase.
3 participants