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: Add support for setConfig in ioredis instrumentation #689

Merged

Conversation

mustafain117
Copy link
Contributor

Which problem is this PR solving?

Short description of the changes

  • Override base setConfig function in IORedisInstrumentation
  • Unit test added to verify setConfig function works as expected, asserts instrumentation uses the new config on future operations

@Flarna
Copy link
Member

Flarna commented Oct 5, 2021

The fix doesn't match to the description in the issue which tells that the problem is that _config is only read during patching.

It seem to work in your test but this is just because it does an additional enable/disable.

There is no need to override setConfig as IORedisInstrumentationConfig extends InstrumentationConfig therefore the API in base class is fine.

@mustafain117
Copy link
Contributor Author

@Flarna Thank you for the feedback, I have updated the instrumentation to use the latest config from this instead and removed the override on setConfig.

Copy link
Member

@blumamir blumamir left a comment

Choose a reason for hiding this comment

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

Thanks for contributing and fixing this issue.
Wrote few minor optional comments. Feel free to address them or resolve if you do not want to fix them as part of this PR.

@blumamir blumamir changed the title Add support for setConfig in ioredis instrumentation fix: Add support for setConfig in ioredis instrumentation Oct 6, 2021
@codecov
Copy link

codecov bot commented Oct 6, 2021

Codecov Report

Merging #689 (0ff652d) into main (fe85fca) will increase coverage by 0.55%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main     #689      +/-   ##
==========================================
+ Coverage   96.31%   96.86%   +0.55%     
==========================================
  Files           5       11       +6     
  Lines         515      701     +186     
  Branches       97      130      +33     
==========================================
+ Hits          496      679     +183     
- Misses         19       22       +3     
Impacted Files Coverage Δ
...trumentation-document-load/src/enums/EventNames.ts 100.00% <0.00%> (ø)
...ages/auto-instrumentations-node/test/utils.test.ts 96.87% <0.00%> (ø)
...tapackages/auto-instrumentations-node/src/utils.ts 96.77% <0.00%> (ø)
...strumentation-document-load/src/instrumentation.ts 98.79% <0.00%> (ø)
...entation-document-load/src/enums/AttributeNames.ts 100.00% <0.00%> (ø)
...lemetry-instrumentation-document-load/src/utils.ts 100.00% <0.00%> (ø)

moved traceConnection to instrumentation.ts
refactored tests to use setConfig instead of new instrumentation
Copy link
Member

@blumamir blumamir left a comment

Choose a reason for hiding this comment

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

LGTM

@vmarchaud
Copy link
Member

@mustafain117 You'll need to rebase the PR

@mustafain117
Copy link
Contributor Author

@vmarchaud Done

@obecny
Copy link
Member

obecny commented Oct 14, 2021

we can't merge this as it is outdated, please iether update to latest or allow to edit

@mustafain117
Copy link
Contributor Author

@obecny Updated it

@obecny obecny added the enhancement New feature or request label Oct 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ioredis: SetConfig not supported
8 participants