-
Notifications
You must be signed in to change notification settings - Fork 14
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: store http headers through an interceptors invocation chain #550
base: development
Are you sure you want to change the base?
Conversation
56a33ce
to
7aeb440
Compare
7aeb440
to
23bf90b
Compare
private static final List<String> HTTP_HEADERS_TO_STORE = Stream.of( | ||
Proxy.HEADER_JOB_TITLE, | ||
Proxy.HEADER_CONVERSATION_ID | ||
).map(String::toLowerCase).toList(); |
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.
I don't think we need to make header names to lower case.
You can see GfLogStore tries to get http headers by upper case
@@ -67,9 +68,13 @@ private Void doSave(ProxyContext context) { | |||
private void append(ProxyContext context, LogEntry entry) throws JsonProcessingException { | |||
HttpServerRequest request = context.getRequest(); | |||
HttpServerResponse response = context.getResponse(); | |||
ApiKeyData apiKeyData = Optional.ofNullable(context.getProxyApiKeyData()) |
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.
I would suggest moving the logic for extraction header to ProxyContext.
@@ -67,9 +68,13 @@ private Void doSave(ProxyContext context) { | |||
private void append(ProxyContext context, LogEntry entry) throws JsonProcessingException { | |||
HttpServerRequest request = context.getRequest(); | |||
HttpServerResponse response = context.getResponse(); | |||
ApiKeyData apiKeyData = Optional.ofNullable(context.getProxyApiKeyData()) |
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.
ApiKeyData could be retrieved from context.getApiKeyData
directly if headers are unavailable in http request.
@@ -47,6 +55,8 @@ public class ApiKeyData { | |||
// deployment triggers interceptors | |||
private String initialDeployment; | |||
private String initialDeploymentApi; | |||
// HTTP headers to store during an interceptor invocation chain |
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.
I would rephrase the comment.
// Original HTTP headers to be stored during an interceptor invocation chain
Closes #531