Sitelet https://github.com/redis/node-redis/pull/3105
Skip to content

Extend proxy - #3105

Merged
nkaradzhov merged 2 commits into
redis:masterfrom
nkaradzhov:extend-proxy
Oct 21, 2025
Merged

nkaradzhov merged 2 commits into
redis:masterfrom
nkaradzhov:extend-proxy

Conversation

@nkaradzhov

Copy link
Copy Markdown
Collaborator

The purpose for this PR is to extend the proxy to provide couple of new functionalities:

  • request/response
  • response transformations
  • resp support

@jit-ci jit-ci Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

❌ The following Jit checks failed to run:

  • secret-detection-trufflehog

#jit_bypass_commit in this PR to bypass, Jit Admin privileges required.

More info in the Jit platform.

@nkaradzhov

Copy link
Copy Markdown
Collaborator Author

#jit_bypass_commit

@bobymicroby bobymicroby left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. I've left some minor improvement suggestions.

Comment thread packages/test-utils/lib/redis-proxy.ts Outdated
this.emit('data', connectionId, 'client->server', data);
serverSocket.write(data);

if(!this.interceptorInitializer) {

@bobymicroby bobymicroby Oct 21, 2025 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm wondering if we can eliminate the branch prediction (if(!this.interceptorInitializer)) entirely by implementing a default "socket write/noop" interceptor that simply performs the socket write when no initializer is provided.

@nkaradzhov nkaradzhov Oct 21, 2025 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

yes, we can totally do this, in fact it was like that before, but i thought this is better. i will move it back

interface ActiveConnection extends ConnectionInfo {
readonly clientSocket: net.Socket;
readonly serverSocket: net.Socket;
inflightRequestsCount: number

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What do you think about borrowing from node-redis's cache stats approach ? We could start by tracking inflightRequestsCount initially and add more metrics later. This design integrates well if you want to hook in traces, metrics, or logs.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

this is only to distinguish between request/response and push for now. it will go away in nest iteration

@nkaradzhov
nkaradzhov marked this pull request as ready for review October 21, 2025 11:47
@nkaradzhov
nkaradzhov merged commit b8267c9 into redis:master Oct 21, 2025
17 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.

2 participants