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

Enable tracing in Redis clients #893

Merged
merged 2 commits into from
Mar 16, 2024
Merged

Conversation

sevein
Copy link
Contributor

@sevein sevein commented Mar 15, 2024

This pull request enables tracing instrumentation in our Redis clients using the redisotel package.

TraceQL query examples

Find watcher triggers

This is likely the most interesting outcome of this work. Now watchers start a root span (watcher.poll) representing the interaction with Redis using the blmove command to wait until the notification is delivered by MinIO. In Grafana, search for:

{name=~"watcher.poll"}

image

The gantt chart shows that we remove the notification from the queue using lrem command, but only once we've successfully started the workflow instance. The workflow continues running and recording spans as part of the same trace, including the entire workflow execution, activities, etc...

Find creation of WebSocket auth tickets

We can see how authentication tickets are stored in Redis:

{name="api" && .http.route="/package/monitor"}

image

Find application publishing events

We can also find spans related to the operation of publishing events into the event service, e.g.:

{name="publish"}

Find Redis traces

A more general approach:

{.db.system="redis"}

image

Copy link

codecov bot commented Mar 15, 2024

Codecov Report

Attention: Patch coverage is 45.28302% with 29 lines in your changes are missing coverage. Please review.

Project coverage is 47.34%. Comparing base (7e99584) to head (0fb0243).

❗ Current head 0fb0243 differs from pull request most recent head 39e0299. Consider uploading reports for the commit 39e0299 to get more accurate results

Files Patch % Lines
main.go 0.00% 15 Missing ⚠️
internal/watcher/minio.go 71.42% 2 Missing and 2 partials ⚠️
cmd/enduro-a3m-worker/main.go 0.00% 2 Missing ⚠️
cmd/enduro-am-worker/main.go 0.00% 2 Missing ⚠️
internal/api/auth/ticket_store.go 77.77% 1 Missing and 1 partial ⚠️
internal/event/redis.go 77.77% 1 Missing and 1 partial ⚠️
internal/watcher/watcher.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #893      +/-   ##
==========================================
+ Coverage   47.27%   47.34%   +0.07%     
==========================================
  Files          95       95              
  Lines        5172     5206      +34     
==========================================
+ Hits         2445     2465      +20     
- Misses       2494     2505      +11     
- Partials      233      236       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sevein sevein force-pushed the dev/add-watcher-instrumentation branch from 0fb0243 to 838fc31 Compare March 15, 2024 12:01
Copy link
Collaborator

@djjuhasz djjuhasz left a comment

Choose a reason for hiding this comment

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

Cool! 😎

sevein added 2 commits March 16, 2024 05:37
Set one minute and made it configurable. This ensures that we're not flooding
the telemetry backend with too many traces.
- Enable tracing in Redis clients using the redisotel package.
- Create watcher root spans.
- Use context in `event` package to ensure that spans are distributed properly.

[skip codecov]
@sevein sevein force-pushed the dev/add-watcher-instrumentation branch from 838fc31 to 39e0299 Compare March 16, 2024 05:40
@sevein sevein merged commit b63bb1a into main Mar 16, 2024
11 checks passed
@sevein sevein deleted the dev/add-watcher-instrumentation branch March 16, 2024 05:53
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.

2 participants