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

fix(instrumentation-redis-4): avoid diag.error spam when configured client URL is the empty string #2399

Merged

Conversation

trentm
Copy link
Contributor

@trentm trentm commented Aug 22, 2024

Issue #2389 showed that this instrumentation would crash on a Redis
client configured with {url: ''} (an empty string). The crash was
fixed in #2397. This change avoids the once-crashy code, and hence
the diag.error spam, by using the same guard before attempting to parse
the configured client URL that the Redis client itself does, if (options?.url),

Refs: #2389

…lient URL is the empty string

Issue open-telemetry#2389 showed that this instrumentation would *crash* on a Redis
client configured with `{url: ''}` (an empty string). The crash was
fixed in open-telemetry#2397. This change avoids the once-crashy code, and hence
the diag.error spam, by using the same guard before attempting to parse
the configured client URL that the Redis client itself does, `if
(options?.url)`,

Refs: open-telemetry#2389
@trentm
Copy link
Contributor Author

trentm commented Aug 22, 2024

My repro script is described here: #2389 (comment)
That shows the log spam output "before" this fix. After:

% node use-redis.js
OTEL_TRACES_EXPORTER is empty. Using default otlp exporter.
Accessing resource attributes before async attributes settled
GET bar: baz

Copy link

codecov bot commented Aug 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.54%. Comparing base (dfb2dff) to head (8d468da).
Report is 218 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2399      +/-   ##
==========================================
- Coverage   90.97%   90.54%   -0.44%     
==========================================
  Files         146      157      +11     
  Lines        7492     7622     +130     
  Branches     1502     1571      +69     
==========================================
+ Hits         6816     6901      +85     
- Misses        676      721      +45     
Files Coverage Δ
...opentelemetry-instrumentation-redis-4/src/utils.ts 88.88% <100.00%> (+5.55%) ⬆️

... and 74 files with indirect coverage changes

Copy link
Contributor

@JacksonWeber JacksonWeber left a comment

Choose a reason for hiding this comment

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

LGTM

@pichlermarc pichlermarc merged commit ec3b9c8 into open-telemetry:main Sep 4, 2024
19 checks passed
@dyladan dyladan mentioned this pull request Sep 4, 2024
@trentm trentm deleted the tm-intsr-redis-avoid-diag-error branch September 4, 2024 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants