-
Notifications
You must be signed in to change notification settings - Fork 3k
[cmd/opampsupervisor] log stderr using Error #40491
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
Changes from 4 commits
6b3d009
9e1c97e
5f90c50
ee6d937
630e294
b795332
50a2dd4
f91c127
d0606b0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Use this changelog template to create an entry for release notes. | ||
|
||
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' | ||
change_type: bug_fix | ||
|
||
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) | ||
component: opampsupervisor | ||
|
||
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). | ||
note: Update passthrough logging to use Error for stderr pipe. | ||
|
||
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. | ||
issues: [40491] | ||
|
||
# (Optional) One or more lines of additional information to render under the primary note. | ||
# These lines will be padded with 2 spaces and then inserted directly into the document. | ||
# Use pipe (|) for multiline entries. | ||
subtext: | ||
|
||
# If your change doesn't affect end users or the exported elements of any package, | ||
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label. | ||
# Optional: The change log or logs in which this entry should be included. | ||
# e.g. '[user]' or '[user, api]' | ||
# Include 'user' if the change is relevant to end users. | ||
# Include 'api' if there is a change to a library API. | ||
# Default: '[user]' | ||
change_logs: [] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -157,7 +157,7 @@ func (c *Commander) startWithPassthroughLogging() error { | |
scanner := bufio.NewScanner(stderrPipe) | ||
for scanner.Scan() { | ||
line := scanner.Text() | ||
colLogger.Info(line) | ||
colLogger.Error(line) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree with this classification, although it will result in anyone using passthrough logs but not configuring the collector to use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
My understanding is that the Collector outputs to stdout for anything related to the CLI (e.g. the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't totally understand this point either, but what comes to mind is if the user is configuring the collector's own telemetry output path to be just "stderr" like so:
Then DEBUG level and above collector logs would appear as errors in the supervisor's logs. Is this the kind of bad configuration we're talking about? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe by default the collector uses stderr when running for all logs: https://github.com/open-telemetry/opentelemetry-collector/blob/b1ce36b19f7f95fd2689af2038820cc12066310f/service/telemetry/factory.go#L95-L96 This can be changed like @dpaasman00 mentioned. So a user would do service:
telemetry:
logs:
output_paths: ["stdout"]
error_output_paths: ["stderr"] There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the info. @codeboten would it be reasonable to add that config to the default configuration the Supervisor passes to the Collector as part of this change? I have the same concern as Tyler about the Supervisor printing error-level logs using non-error level logs from the Collector. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @evan-bradley sure I can add the output paths to correctly send to stderr and stdout if left unset There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. set defaults for output_paths to |
||
} | ||
if err := scanner.Err(); err != nil { | ||
c.logger.Error("Error reading agent stderr: %w", zap.Error(err)) | ||
|
Uh oh!
There was an error while loading. Please reload this page.