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

otellogr: Fix nil context panic #6527

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

flc1125
Copy link
Member

@flc1125 flc1125 commented Dec 23, 2024

Fixes #6509

@flc1125 flc1125 requested review from pellared and a team as code owners December 23, 2024 14:37
Copy link

codecov bot commented Dec 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 68.5%. Comparing base (f24cc13) to head (e74c2c5).

Additional details and impacted files

Impacted file tree graph

@@          Coverage Diff          @@
##            main   #6527   +/-   ##
=====================================
  Coverage   68.5%   68.5%           
=====================================
  Files        200     200           
  Lines      16781   16782    +1     
=====================================
+ Hits       11500   11501    +1     
  Misses      4935    4935           
  Partials     346     346           
Files with missing lines Coverage Δ
bridges/otellogr/logsink.go 100.0% <100.0%> (ø)

@dmathieu dmathieu changed the title Fixed an issue where otellogr emits nil context which leads to panic in exporters Fix nil context panic in otelloger Jan 6, 2025
CHANGELOG.md Outdated Show resolved Hide resolved
bridges/otellogr/logsink.go Outdated Show resolved Hide resolved
bridges/otellogr/logsink.go Outdated Show resolved Hide resolved
bridges/otellogr/logsink.go Outdated Show resolved Hide resolved
bridges/otellogr/logsink.go Outdated Show resolved Hide resolved
- Remove `ctx` field and related context handling from `LogSink` struct
- Simplify `Enabled` method to use `context.Background()` directly
- Remove `WithContext` method and associated tests
- Clean up test cases related to context handling
bridges/otellogr/logsink.go Outdated Show resolved Hide resolved
bridges/otellogr/logsink.go Outdated Show resolved Hide resolved
bridges/otellogr/logsink_test.go Outdated Show resolved Hide resolved
Copy link
Member

@dmathieu dmathieu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure a consensus has been reached in #6509.

@@ -176,6 +176,7 @@ func NewLogSink(name string, options ...Option) *LogSink {
logger: c.provider.Logger(name, opts...),
levelSeverity: c.levelSeverity,
opts: opts,
ctx: context.Background(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last thing, but we should be testing the behavior that currently triggers a panic.

@pellared pellared changed the title Fix nil context panic in otelloger otellogr: Fix nil context panic Jan 7, 2025
@pellared
Copy link
Member

pellared commented Jan 7, 2025

I'm not sure a consensus has been reached in #6509.

I think this is the proper fix and we probably do not need anything more than this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

otellogr emits nil context causing panic in exporters
3 participants