-
Notifications
You must be signed in to change notification settings - Fork 62
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
feat: makes ip address of request available in application layer #2939
base: main
Are you sure you want to change the base?
feat: makes ip address of request available in application layer #2939
Conversation
b81e167
to
e946dbf
Compare
fbaf5ca
to
2bcdac1
Compare
dc0bb30
to
2b4d451
Compare
2b1d1d0
to
e16946e
Compare
0f4c413
to
fe08a97
Compare
e4a641d
to
dd3f2d4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Big change.
Left some thoughts
packages/relay/src/lib/env.txt
Outdated
@@ -0,0 +1,150 @@ | |||
apiVersion: v1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Q: please revert this configmap file addition
@@ -106,6 +109,7 @@ export default class KoaJsonRpc { | |||
rpcApp(): (ctx: Koa.Context, _next: Koa.Next) => Promise<void> { | |||
return async (ctx: Koa.Context, _next: Koa.Next) => { | |||
this.requestId = ctx.state.reqId; | |||
this.requestIpAddress = ctx.request.ip; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Q: should we only set this if the relay operator plans to rate limit by IP?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Nana-EC the idea here is that we need this for the hbar limiter and spending plan, so we always want to have the sender's ip in order to check if its a part of the spending plan of a partner. so its not related to rate limiting but hbar limiting and we need it passed to sdkClient and the functions there
packages/server/src/server.ts
Outdated
const requestDetails = app.getRequestDetails(); | ||
logger.debug('Method name: ' + methodName); | ||
logger.debug('Request id: ' + requestDetails.requestId); | ||
logger.debug('Request ip: ' + requestDetails.ipAddress); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
drop this line for now
packages/server/src/server.ts
Outdated
const requestIdPrefix = requestId ? formatRequestIdMessage(requestId) : ''; | ||
const logAndHandleResponse = async (methodName: string, methodParams: any[], methodFunction: any) => { | ||
const requestDetails = app.getRequestDetails(); | ||
logger.debug('Method name: ' + methodName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Squash this into 1 line if needed.
That being said do we need it?
We should have a log that covers the method name no as well as the result
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah this was needed for debugging purposes only. will remove it
Signed-off-by: Konstantina Blazhukova <[email protected]>
Signed-off-by: Konstantina Blazhukova <[email protected]>
Signed-off-by: Victor Yanev <[email protected]>
…ingPlanRepository.spec.ts Signed-off-by: Victor Yanev <[email protected]>
Signed-off-by: Konstantina Blazhukova <[email protected]>
Signed-off-by: Konstantina Blazhukova <[email protected]>
Signed-off-by: Konstantina Blazhukova <[email protected]>
Signed-off-by: Konstantina Blazhukova <[email protected]>
Signed-off-by: Victor Yanev <[email protected]>
Signed-off-by: Victor Yanev <[email protected]>
Signed-off-by: Victor Yanev <[email protected]>
Signed-off-by: Victor Yanev <[email protected]>
Signed-off-by: Victor Yanev <[email protected]>
Signed-off-by: Victor Yanev <[email protected]>
Signed-off-by: Victor Yanev <[email protected]>
Signed-off-by: Konstantina Blazhukova <[email protected]>
Signed-off-by: Konstantina Blazhukova <[email protected]>
Signed-off-by: Konstantina Blazhukova <[email protected]>
Signed-off-by: Konstantina Blazhukova <[email protected]>
Signed-off-by: Konstantina Blazhukova <[email protected]>
1f9c448
to
633e385
Compare
Signed-off-by: Konstantina Blazhukova <[email protected]>
Signed-off-by: Konstantina Blazhukova <[email protected]>
Quality Gate failedFailed conditions |
Description:
Makes the ip of the sender of a request, available in the application layer. Also makes requestIdPrefix required, since we need to always have it for logging purposes
Related issue(s):
Fixes #2867
Fixes #2940