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

Improve logging of component start errors #10440

Merged
merged 1 commit into from
Jul 18, 2024

Conversation

swiatekm
Copy link
Contributor

@swiatekm swiatekm commented Jun 19, 2024

Description

Improved logging of component start errors, so the log lines appear where they chronologically happen, rather than at the end. They also use the component logger, which makes them look nicer.

Output before change:

2024-06-19T14:15:30.822+0200    info    service@v0.103.0/service.go:115 Setting up own telemetry...
2024-06-19T14:15:30.822+0200    info    service@v0.103.0/telemetry.go:96        Serving metrics {"address": ":8888", "level": "Normal"}
2024-06-19T14:15:30.823+0200    info    service@v0.103.0/service.go:182 Starting otelcorecol... {"Version": "0.103.0-dev", "NumCPU": 32}
2024-06-19T14:15:30.823+0200    info    extensions/extensions.go:35     Starting extensions...
2024-06-19T14:15:30.823+0200    info    service@v0.103.0/service.go:245 Starting shutdown...
2024-06-19T14:15:30.823+0200    info    extensions/extensions.go:61     Stopping extensions...
2024-06-19T14:15:30.823+0200    info    service@v0.103.0/service.go:259 Shutdown complete.
Error: cannot start pipelines: failed to resolve authenticator "oauth2client": authenticator not found
2024/06/19 14:15:30 collector server run finished with error: cannot start pipelines: failed to resolve authenticator "oauth2client": authenticator not found

Output after change:

2024-06-19T14:25:18.324+0200    info    service@v0.103.0/service.go:115 Setting up own telemetry...
2024-06-19T14:25:18.325+0200    info    service@v0.103.0/telemetry.go:96        Serving metrics {"address": ":8888", "level": "Normal"}
2024-06-19T14:25:18.326+0200    info    service@v0.103.0/service.go:182 Starting otelcorecol... {"Version": "0.103.0-dev", "NumCPU": 32}
2024-06-19T14:25:18.326+0200    info    extensions/extensions.go:35     Starting extensions...
2024-06-19T14:25:18.326+0200    error   graph/graph.go:428      Failed to start component       {"error": "failed to resolve authenticator \"oauth2client\": authenticator not found", "type": "Exporter", "id": "otlphttp"}
2024-06-19T14:25:18.326+0200    info    service@v0.103.0/service.go:245 Starting shutdown...
2024-06-19T14:25:18.326+0200    info    extensions/extensions.go:61     Stopping extensions...
2024-06-19T14:25:18.326+0200    info    service@v0.103.0/service.go:259 Shutdown complete.
Error: cannot start pipelines: failed to resolve authenticator "oauth2client": authenticator not found
2024/06/19 14:25:18 collector server run finished with error: cannot start pipelines: failed to resolve authenticator "oauth2client": authenticator not found

We've added the following line:

2024-06-19T14:25:18.326+0200    error   graph/graph.go:428      Failed to start component       {"error": "failed to resolve authenticator \"oauth2client\": authenticator not found", "type": "Exporter", "id": "otlphttp"}

For extensions, the new line looks like so:

2024-06-25T16:59:18.513+0200    error    extensions/extensions.go:54     Failed to start extension      {"kind": "extension", "name": "memory_limiter", "error": "failed to get memory limit"}

Link to tracking issue

Fixes #7078

Copy link

codecov bot commented Jun 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.33%. Comparing base (2d51bc4) to head (6157936).

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #10440   +/-   ##
=======================================
  Coverage   92.33%   92.33%           
=======================================
  Files         403      403           
  Lines       18725    18733    +8     
=======================================
+ Hits        17289    17297    +8     
  Misses       1076     1076           
  Partials      360      360           

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

@swiatekm swiatekm force-pushed the fix/service/component-logging branch 2 times, most recently from 706f964 to 97a1013 Compare June 25, 2024 15:07
@swiatekm swiatekm marked this pull request as ready for review June 25, 2024 15:25
@swiatekm swiatekm requested a review from a team as a code owner June 25, 2024 15:25
@swiatekm swiatekm force-pushed the fix/service/component-logging branch from 97a1013 to d9b7448 Compare July 3, 2024 16:06
@swiatekm swiatekm marked this pull request as draft July 3, 2024 16:31
@swiatekm swiatekm force-pushed the fix/service/component-logging branch 3 times, most recently from 28f8868 to 7cc3eea Compare July 4, 2024 10:14
@swiatekm swiatekm marked this pull request as ready for review July 4, 2024 10:43
@swiatekm swiatekm force-pushed the fix/service/component-logging branch from 7cc3eea to 0a6609d Compare July 18, 2024 13:01
@mx-psi
Copy link
Member

mx-psi commented Jul 18, 2024

Can you fix CI? After that I am happy to merge this

@swiatekm swiatekm force-pushed the fix/service/component-logging branch from 0a6609d to 6157936 Compare July 18, 2024 13:10
@swiatekm
Copy link
Contributor Author

Can you fix CI? After that I am happy to merge this

Rebased on main after #10661, should be enough.

@mx-psi mx-psi added the Skip Changelog PRs that do not require a CHANGELOG.md entry label Jul 18, 2024
@mx-psi mx-psi merged commit fbadc23 into open-telemetry:main Jul 18, 2024
66 of 67 checks passed
@github-actions github-actions bot added this to the next release milestone Jul 18, 2024
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.

Improve logging for component start errors
2 participants