-
Notifications
You must be signed in to change notification settings - Fork 534
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
feat: add ioredis instrumentation #301
feat: add ioredis instrumentation #301
Conversation
Created ioredis instrumentation because the plugin API will be removed from OTel.
0ed630d
to
2d36e9e
Compare
Codecov Report
@@ Coverage Diff @@
## main #301 +/- ##
==========================================
- Coverage 95.47% 95.29% -0.19%
==========================================
Files 119 124 +5
Lines 6277 6690 +413
Branches 614 639 +25
==========================================
+ Hits 5993 6375 +382
- Misses 284 315 +31
|
the failed test seems to be caused by reusing the redis instance. If I run test local they pass the first them but fail the second time - plugin and instrumentation. |
42d499b
to
9596827
Compare
plugin-ioredis test failed again because a single redis instance is used for testing serveral node versions in parallel. As this is unrelated to this PR I don't think it should be fixed here. |
test improvements are in #303 |
Is this a direct port of the Plugin or did you make any behavior changes? |
It's a direct port. If there are behavior changes they are not intended. |
plugins/node/opentelemetry-instrumentation-ioredis/src/ioredis.ts
Outdated
Show resolved
Hide resolved
plugins/node/opentelemetry-instrumentation-ioredis/package.json
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
@blumamir I merge your changes but now a test fails - but only in node 14. |
ok, it is a flaky test as rerun resulting in green CI. For the records this was the failure:
|
@Flarna should we hold off merging this while you look at the flaky test? |
I moved to other tasks meanwhile. I think this can be done via a separate PR. |
I agree that it could be done in another PR, we'll also need to make other PR to add #239 (and other changes that have been suggested while reviewing). |
The test is creating two ioredis clients. Now we have the
The double const spanNames = [
'connect',
'connect',
'info',
'info',
'subscribe',
'subscribe', // <============= BUG
'publish',
'publish',
'unsubscribe',
'quit',
'quit',
'test span',
]; To fix the test - making it deterministic, we can do either:
const pub = new ioredis(URL, {enableReadyCheck: false});
const sub = new ioredis(URL, {enableReadyCheck: false});
...
const sub = new ioredis(URL);
await sub.subscribe('news', 'music');
const pub = new ioredis(URL);
await pub.publish('news', 'Hello world!');
...
const sub = new ioredis(URL, {lazyConnect: true});
const pub = new ioredis(URL, {lazyConnect: true});
await Promise.all([sub.connect(), pub.connect()]);
await sub.subscribe('news', 'music');
await pub.publish('news', 'Hello world!');
await pub.publish('music', 'Hello again!'); There might be some other way to await on connection to the DB which I'm not aware of. Notice that some of the suggested fixes above are also fixing the double
Hope it will get the flaky test fixed. |
@Flarna If you want, I can fix this flaky test in a separate PR once merged, or you can fix it in your PR. whichever you prefer. |
@blumamir Thanks for the infos! I think it's better to fix this in a separate PR to avoid that I have to touch files from plugin in this PR. |
f3ef976
to
d4d5f5a
Compare
I think its good to go, /cc @dyladan are you good with merging it since you made about the flaky test ? |
Created ioredis instrumentation because the plugin API will be removed from OTel.
fixes: #251