Skip to content

Add an integration for GitHub.com/redis/rueidis#1098

Open
ankon wants to merge 2 commits into
newrelic:developfrom
ankon:feature/rueidis-integration
Open

Add an integration for GitHub.com/redis/rueidis#1098
ankon wants to merge 2 commits into
newrelic:developfrom
ankon:feature/rueidis-integration

Conversation

@ankon

@ankon ankon commented Oct 9, 2025

Copy link
Copy Markdown
Contributor

Links

see #983: we have been using this code in production for quite some time now.

Details

The first commit fixes the dev-shell to work on Fedora Linux. It should be a no-op on other (non-SELinux-enabled) systems.

@ankon

ankon commented May 17, 2026

Copy link
Copy Markdown
Contributor Author

Hey there! Anything we can do to move this forward? It's a bit disappointing to not even get a reply from New Relic.

@mirackara

Copy link
Copy Markdown
Contributor

Hey @ankon

Sorry about the delay. I'll review it now. Do you mind rebasing to our develop branch?

@ankon ankon force-pushed the feature/rueidis-integration branch from d66e08c to a23e504 Compare May 21, 2026 13:53
@ankon

ankon commented May 21, 2026

Copy link
Copy Markdown
Contributor Author

hey @mirackara, I rebased it onto master now.

@ankon ankon force-pushed the feature/rueidis-integration branch 2 times, most recently from c2c9f35 to af78430 Compare May 21, 2026 14:53
@mirackara

mirackara commented May 26, 2026

Copy link
Copy Markdown
Contributor

Hey @ankon, thanks! Do you mind also switching to our develop branch? otherwise this is looking good! I've also approved our workflows

@codecov-commenter

codecov-commenter commented May 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.71%. Comparing base (a12aa87) to head (49d7a97).
⚠️ Report is 8 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #1098      +/-   ##
===========================================
- Coverage    78.99%   78.71%   -0.29%     
===========================================
  Files          159      160       +1     
  Lines        15074    15144      +70     
===========================================
+ Hits         11908    11920      +12     
- Misses        2751     2809      +58     
  Partials       415      415              

see 2 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a12aa87...49d7a97. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

ankon added 2 commits May 29, 2026 14:29
This makes the dev-shell actually usable on SELinux-enabled environments.
@ankon ankon force-pushed the feature/rueidis-integration branch from af78430 to 49d7a97 Compare May 29, 2026 12:29
@ankon ankon changed the base branch from master to develop May 29, 2026 12:30

@mirackara mirackara 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.

If possible, having an example folder showing how you are using the integration would be great for others as a model. Thanks @ankon !

Comment thread docker-compose.yml

volumes:
- ${PWD}:/usr/src/app/go-agent
- ${PWD}:/usr/src/app/go-agent:rw,Z

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.

(nit): volume mounts are read-write by default. we could simplify these lines to just use :Z

}

func (h *hook) DoCache(client rueidis.Client, ctx context.Context, cmd rueidis.Cacheable, ttl time.Duration) (resp rueidis.RedisResult) {
// XXX: Is it always true that there is only one command here?

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.

In rueidis, calling .Commands() returns a slice of strings where index 0 is always the command name. I believe this is true and a safe way to get the command -- same for line 52. We can remove these comments


func (h *hook) DoStream(client rueidis.Client, ctx context.Context, cmd rueidis.Completed) rueidis.RedisResultStream {
// XXX: Is it always true that there is only one command here?
// XXX: Should we mark this as "streaming"

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.

I think marking this as streaming is a good idea. we can clear these up too

}

// Parse the first init address to get host and port.
// XXX: Does rueidis support unix sockets?

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.

APM dashboard won't be able to show where the Redis queries are going whenever a Unix socket is used. net.SplitHostPort only looks for port seperators. We could add a check before we call SplitHostPort here

addr := opt.InitAddress[0]

// Check if the address looks like a Unix domain socket path
if strings.HasPrefix(addr, "/") || strings.HasSuffix(addr, ".sock") {
    h.segment.Host = "localhost"
    h.segment.PortPathOrID = addr // New Relic allows paths/IDs in this field
} else {
    // Fall back to standard TCP parsing if it's not a Unix socket
    if host, port, err := net.SplitHostPort(addr); err == nil {
        ......
    }

Comment thread docker-compose.yml

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.

Since rueidis requires a live Redis instance to execute integration tests against, should we spin up a standard redis image inside this docker-compose.yaml?

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.

3 participants