Skip to content

Add redis client only instrumentation #3143

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

Merged

Conversation

OlegZv
Copy link
Contributor

@OlegZv OlegZv commented Dec 22, 2024

Description

This PR allows instrumenting only a specific Redis client instead of the whole class (and all clients).
Changes:

  • Ability to instrument a specific Redis client with instrument_client (supports any of the existing clients such as async/cluster)
  • Added more typing for instrument and the newly added instrument_client methods (still allows **kwargs). It makes the docs easier to read/understand.
  • Moved some version "if" condition checks to global "defines" to make the code more readable.
  • Added a Redis sphinx reference so the docs can correctly link up with Redis clients.
  • Updated the docs for a more consistent structure (add specific sections).
    image

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update (updated)

How Has This Been Tested?

Ran the already included tests with python3.12 and python3.11 and redis 5.0.1. Added more tests to ensure that only the client we instrumented produces spans. I ran tox tests, ruff, linting, formatting, etc. (everything in the contributing guide).

Tested documentation changes with tox -e docs to ensure everything builds correctly and looks good.
Also, I ran tests with coverage: original coverage was 77%. Now it's 80%:
image
Note: I plan to add another PR for the FT-related commands later. (there's currently a bug in some span param parsing functions)

Does This PR Require a Core Repo Change?

  • No.

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

  • Followed the style guidelines of this project
  • Changelogs have been updated (will update after opening this PR)
  • Unit tests have been added
  • Documentation has been updated

@OlegZv OlegZv requested a review from a team as a code owner December 22, 2024 05:37
Copy link

linux-foundation-easycla bot commented Dec 22, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

@xrmx
Copy link
Contributor

xrmx commented Dec 23, 2024

@OlegZv we can only accept contributions covered by the CLA, please sign it.

@OlegZv
Copy link
Contributor Author

OlegZv commented Dec 23, 2024

@OlegZv we can only accept contributions covered by the CLA, please sign it.

Of course! I have already received a pre-approval for this contribution. Pending is the CLA review. Hopefully, I'll get a response soon. Can we still proceed to review these changes so I can work on any comments/change requests in the meantime?

@OlegZv
Copy link
Contributor Author

OlegZv commented Feb 4, 2025

@xrmx, the CLA is finally good to go!

@OlegZv
Copy link
Contributor Author

OlegZv commented Feb 27, 2025

Looking for another round of tests and approval, please! @xrmx @emdneto @lzchen

@OlegZv OlegZv requested review from xrmx, lzchen and emdneto March 12, 2025 23:17
@OlegZv
Copy link
Contributor Author

OlegZv commented Mar 31, 2025

Could someone please review and approve?
@emdneto @jeremydvoss @owais @pmcollins @sanketmehta28 @srikanthccv @tammy-baylis-swi (@open-telemetry/python-approvers)

@OlegZv OlegZv requested a review from xrmx April 29, 2025 02:29
Copy link
Member

@emdneto emdneto 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 the work on this one! I left some comments, but the changes LGTM. I'll give it a try.

@OlegZv
Copy link
Contributor Author

OlegZv commented May 2, 2025

@emdneto Thank you for the review. I implemented the changes you mentioned. Tested the resulting library with tox and regenerated the docs locally. The tests passed, and the docs look as before. The only thing left, I think, is the question about the RequestHook type (private vs. not)

@OlegZv OlegZv requested a review from emdneto May 2, 2025 15:26
@OlegZv OlegZv requested a review from emdneto May 6, 2025 03:57
Copy link
Member

@emdneto emdneto left a comment

Choose a reason for hiding this comment

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

LEft small nit. Don't want to block. Thanks!!

@xrmx
Copy link
Contributor

xrmx commented May 8, 2025

@OlegZv please fix CI

@OlegZv
Copy link
Contributor Author

OlegZv commented May 8, 2025

@OlegZv please fix CI

Fixed! Sorry for the delay.

@xrmx xrmx enabled auto-merge (squash) May 9, 2025 09:13
@xrmx xrmx merged commit 2c0033f into open-telemetry:main May 9, 2025
969 of 970 checks passed
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.

5 participants