-
Notifications
You must be signed in to change notification settings - Fork 1.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
[telemetry] Add disabled flag on each telemetry type, and sync logger on shutdown. #7094
Conversation
8018e51
to
718411a
Compare
Looks like the test failures may be related to the change. |
I'll take a look, thanks. |
Yes, I'm looking more into it. There is a bit of an issue with how we manage situations where we test with this logger because stderr is not available from within tests. |
26a5238
to
e309813
Compare
It turns out our tests here would fail because stderr is set by default, if no value is provided. I have developed therefore a different approach for testing: creating a log level of none where we just return a zap.NewNop() instead of building the logger. With that change, and applying that change to the yaml config files used in tests, we get all tests to pass. |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #7094 +/- ##
==========================================
- Coverage 90.99% 90.86% -0.14%
==========================================
Files 293 291 -2
Lines 14268 14072 -196
==========================================
- Hits 12983 12786 -197
Misses 1017 1017
- Partials 268 269 +1
☔ View full report in Codecov by Sentry. |
dismiss my review since significant changes were made, will look tomorrow for the new approach
Do I understand correctly that we added the new public API just to fix tests? |
I guess there isn't any way to disable logging entirely, so maybe there's value to this beyond tests here. |
919cdd5
to
189ca0a
Compare
e94584a
to
5dbf6cd
Compare
@codeboten do we go with "Enable" or "Disable" int he config otep? |
@bogdandrutu the otep currently proposes |
I didn't know there was an otep. Got a link? Mind approving the PR? |
We don't use |
Just to record somewhere: I prefer "enabled" instead of "disabled", as "disabled" requires a double-negative to have something activated (disabled=false means enabled). |
This PR was marked stale due to lack of activity. It will be closed in 14 days. |
Trying to understand what is blocking there. Are we stuck on disabled/enabled? |
This PR was marked stale due to lack of activity. It will be closed in 14 days. |
I think so. If we want to be consistent within Collector, we need to use |
I think enabled makes more sense. To keep backwards compatibility, we should assume enabled : true by default. The issue with that is we then need to use a pointer boolean, which earlier in this PR gave pause to Bogdan. We use a pointer boolean to find whether someone set the boolean expressly to false or if the value is not set (nil pointer). |
We can keep backward compatibility for end users without pointer. Default values are set https://github.com/open-telemetry/opentelemetry-collector/blob/main/otelcol/unmarshaler.go#L43, not ideal, but that's what we have |
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.
I agree that we should pursue enabled
instead of disabled
unless absolutely necessary.
This PR was marked stale due to lack of activity. It will be closed in 14 days. |
Closed as inactive. Feel free to reopen if this PR is still being worked on. |
We have |
That was discussed and was my first array into this work, but unfortunately there was pushback as maintainers said they want log level to be zap log levels. |
This PR was marked stale due to lack of activity. It will be closed in 14 days. |
Closed as inactive. Feel free to reopen if this PR is still being worked on. |
Description:
Add disabled flag on each telemetry type, and sync logger on shutdown.
Remove TODO and apply sync on telemetry shutdown