Skip to content

Create Client side metrics#14197

Open
fosky94 wants to merge 10 commits into
GoogleCloudPlatform:mainfrom
fosky94:main
Open

Create Client side metrics#14197
fosky94 wants to merge 10 commits into
GoogleCloudPlatform:mainfrom
fosky94:main

Conversation

@fosky94

@fosky94 fosky94 commented May 19, 2026

Copy link
Copy Markdown
Member

Description

Added a new sample code to log client side metrics and traces for redis. this will be added to the public docs once this sample code is posted

client libraries that need to be installed:

pip install redis opentelemetry-api opentelemetry-sdk opentelemetry-instrumentation-redis opentelemetry-exporter-gcp-trace opentelemetry-exporter-gcp-monitoring

@fosky94 fosky94 requested review from a team as code owners May 19, 2026 22:43
@product-auto-label product-auto-label Bot added samples Issues that are directly related to samples. api: memorystore labels May 19, 2026
@google-cla

google-cla Bot commented May 19, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a Python script for monitoring Redis client-side metrics and tracing using OpenTelemetry, specifically targeting Google Cloud Trace and Monitoring. It includes a wrapper function, smart_redis_call, designed to handle retries and measure various latency metrics. The review feedback identifies two significant areas for improvement: the removal of redundant connection pool operations that introduce unnecessary overhead and latency, and the correction of a misleading 'application blocking latency' metric that uses an expensive and unrepresentative string conversion of the Redis response.

Comment thread memorystore/redis/client_side_metrics/main.py
Comment thread memorystore/redis/client_side_metrics/main.py
@fosky94

fosky94 commented May 19, 2026

Copy link
Copy Markdown
Member Author

added CLA and solved comments

@snippet-bot

snippet-bot Bot commented Jun 9, 2026

Copy link
Copy Markdown

Here is the summary of changes.

You are about to add 1 region tag.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

@fosky94 fosky94 left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

added region tags

@XrossFox

XrossFox commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Hello, just as a reminder, since we no longer have functioning pipelines, could you add a screenshot of the execution locally? This was added as a requirement for merging python sample changes.

@fosky94

fosky94 commented Jul 9, 2026

Copy link
Copy Markdown
Member Author

Hello, just as a reminder, since we no longer have functioning pipelines, could you add a screenshot of the execution locally? This was added as a requirement for merging python sample changes.

Thank you! Please find below screenshots on the execution:

Screenshot 2026-07-09 at 1 10 48 PM Screenshot 2026-07-09 at 1 12 18 PM Screenshot 2026-07-09 at 1 12 28 PM Screenshot 2026-07-09 at 1 12 36 PM

Comment thread memorystore/redis/client_side_metrics/main_test.py Outdated
Comment thread memorystore/redis/client_side_metrics/requirements.txt Outdated
Comment thread memorystore/redis/client_side_metrics/requirements.txt Outdated
Comment thread memorystore/redis/client_side_metrics/main.py Outdated
Comment thread memorystore/redis/client_side_metrics/main.py Outdated
Comment thread memorystore/redis/client_side_metrics/main.py Outdated

@fosky94 fosky94 left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Applied all recommended dependency pinning, file separation, and PEP-8 global variable fixes requested by XrossFox.

Comment thread memorystore/redis/client_side_metrics/main_test.py Outdated
Comment thread memorystore/redis/client_side_metrics/requirements.txt Outdated
Comment thread memorystore/redis/client_side_metrics/requirements.txt Outdated
Comment thread memorystore/redis/client_side_metrics/main.py Outdated
Comment thread memorystore/redis/client_side_metrics/main.py Outdated
Comment thread memorystore/redis/client_side_metrics/main.py Outdated

@XrossFox XrossFox left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Generally speaking, i think it looks okay now, i'd just like to request a screenshot of the execution of pytest locally. LGTM.

Comment thread memorystore/redis/client_side_metrics/main_test.py
Comment thread memorystore/redis/client_side_metrics/main_test.py Outdated
Comment thread memorystore/redis/client_side_metrics/requirements.txt Outdated
@fosky94

fosky94 commented Jul 10, 2026

Copy link
Copy Markdown
Member Author

pytest tests passed with local redis: Screenshot 2026-07-09 at 9 05 24 PM
pytest tests passed 1 skip when the machine doesn't have a local redis running: Screenshot 2026-07-09 at 9 08 44 PM

@fosky94 fosky94 left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

applied changes, added screenshot of tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: memorystore samples Issues that are directly related to samples.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants