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

[otelcol] Pass a real logger to ProviderSettings #10007

Conversation

TylerHelmuth
Copy link
Member

@TylerHelmuth TylerHelmuth commented Apr 19, 2024

Description

This PR creates a un-configurable logger to be used in confmap.ProviderSettings so that logging can occur while configuration is resolved. It configures the zap logger using reasonable default values since this logger will only be used while resolving config.

Example of the logger in action

receivers:
  nop:

exporters:
  otlphttp:
    endpoint: http://0.0.0.0:4317
    headers:
      # Not set
      x-test: ${env:TEMP3}
  debug:
    # set to "detailed"
    verbosity: $TEMP

service:
  pipelines:
    traces:
      receivers:
        - nop
      exporters:
        - debug

image

Link to tracking issue

Related to #9162
Related to #5615

Testing

If we like this approach I'll add tests

@TylerHelmuth TylerHelmuth requested a review from a team as a code owner April 19, 2024 18:56
@TylerHelmuth TylerHelmuth added the Skip Changelog PRs that do not require a CHANGELOG.md entry label Apr 19, 2024
@TylerHelmuth TylerHelmuth changed the title [otelcol] Pass a real logger to providersettings [otelcol] Pass a real logger to ProviderSettings Apr 19, 2024
Copy link

codecov bot commented Apr 19, 2024

Codecov Report

Attention: Patch coverage is 85.71429% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 91.66%. Comparing base (7b046d9) to head (ae7ef0b).

Files Patch % Lines
otelcol/collector.go 85.71% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #10007   +/-   ##
=======================================
  Coverage   91.65%   91.66%           
=======================================
  Files         360      360           
  Lines       16639    16652   +13     
=======================================
+ Hits        15251    15264   +13     
  Misses       1053     1053           
  Partials      335      335           

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

@evan-bradley
Copy link
Contributor

@TylerHelmuth What do you think about the approach here: #9908?

I believe this would allow us to configure the logger by storing the logs until they can be printed by an instantiated logger.

@TylerHelmuth
Copy link
Member Author

Maybe thats worth it 🤷 I figured this is such a niche need that the extra complexity to pass the logs around wasn't worth it.

If being able to configure the logger that prints confmap logs is important, I can look into the technique used in #9908, although I'd prefer not to expose the logs in the API.

@TylerHelmuth
Copy link
Member Author

TylerHelmuth commented Apr 19, 2024

Example of the "wait for the configured logger" approach: #10008

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Skip Changelog PRs that do not require a CHANGELOG.md entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants