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

feat: store http headers through an interceptors invocation chain #550

Open
wants to merge 1 commit into
base: development
Choose a base branch
from

Conversation

alekseyvdovenko
Copy link
Contributor

@alekseyvdovenko alekseyvdovenko commented Oct 25, 2024

Closes #531

private static final List<String> HTTP_HEADERS_TO_STORE = Stream.of(
Proxy.HEADER_JOB_TITLE,
Proxy.HEADER_CONVERSATION_ID
).map(String::toLowerCase).toList();
Copy link
Collaborator

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())
Copy link
Collaborator

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())
Copy link
Collaborator

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
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
2 participants