-
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
[service] Fix panic when not using NewCommand
#4139
Conversation
f4595ec
to
c313b6a
Compare
This comment has been minimized.
This comment has been minimized.
The test does not trigger this panic since it is using a custom provider, but for consistency we can change it there too.
add1b34
to
c697c76
Compare
This comment has been minimized.
This comment has been minimized.
Codecov Report
@@ Coverage Diff @@
## main #4139 +/- ##
=======================================
Coverage 87.66% 87.66%
=======================================
Files 174 174
Lines 10224 10224
=======================================
Hits 8963 8963
Misses 1011 1011
Partials 250 250
Continue to review full report at Codecov.
|
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.
Does this fully fix #4138 or there is more work to do? If fixed would be nice to add a test to show it is fixed.
Yes, the example program does not crash at startup and in general this class of crashes should be gone.
I thought I needed to do more work to work around |
metricsAddrPtr = &metricsAddrDefault | ||
metricsPrefixPtr = &metricsPrefixDefault |
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.
metricsAddrPtr = &metricsAddrDefault | |
metricsPrefixPtr = &metricsPrefixDefault | |
metricsAddrPtr = new(string) | |
metricsPrefixPtr = new(string) |
Would this be safer? Does anything use the default value that might break if it changes when the user specifies this value via CLI flags?
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.
On this particular instance it would be fine to just use new
, but on the logs side it's not
opentelemetry-collector/service/internal/telemetrylogs/logger.go
Lines 78 to 90 in afad36e
func logDeprecatedMessages(logger *zap.Logger) { | |
if *loggerLevelPtr != "deprecated" { | |
logger.Warn("`log-level` command line option has been deprecated. Use `service::telemetry::logs` in config instead!") | |
} | |
if *loggerProfilePtr != "deprecated" { | |
logger.Warn("`log-profile` command line option has been deprecated. Use `service::telemetry::logs` in config instead!") | |
} | |
if *loggerFormatPtr != "deprecated" { | |
logger.Warn("`log-format` command line option has been deprecated. Use `service::telemetry::logs` in config instead!") | |
} | |
} |
"deprecated"
. I would prefer to leave it like this for consistency
Description:
Link to tracking Issue: Fixes #4138
Testing: Reordered tests to trigger the panic