From 3eb465b78c4fa951a8ae09f9b5bac4a41dfbbb86 Mon Sep 17 00:00:00 2001 From: Florian Hoffmann Date: Fri, 19 Jun 2020 17:16:25 +0200 Subject: [PATCH] Consider x-correlation-id as well The library currently considers the header fields `x-correlationid` and `x-vcap-request-id` as carrying correlation IDs. This change would also make it aware of the field `x-correlation-id`, which is widely used in the web, today. The settings would introduce `x-correlation-id` as an alias, sub-ordinating it to the original field `x-correlationid`. Meaning, for example, the library will use `x-correlationid` > `x-correation-id` > `x-vcap-request-id`, in this order of preference. The field would not be propagated back to the request sender, although this can probably be discussed. This PR is an incomplete suggestion, to make the dimension of the changes to the production code clear. It does not adjust the unit alongside, so any automatic PR voters will/should reject this change. --- .../hcp/cf/logging/common/request/HttpHeaders.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/cf-java-logging-support-core/src/main/java/com/sap/hcp/cf/logging/common/request/HttpHeaders.java b/cf-java-logging-support-core/src/main/java/com/sap/hcp/cf/logging/common/request/HttpHeaders.java index f06b5239..22294aba 100644 --- a/cf-java-logging-support-core/src/main/java/com/sap/hcp/cf/logging/common/request/HttpHeaders.java +++ b/cf-java-logging-support-core/src/main/java/com/sap/hcp/cf/logging/common/request/HttpHeaders.java @@ -13,9 +13,14 @@ public enum HttpHeaders implements HttpHeader { - CONTENT_LENGTH("content-length"), CONTENT_TYPE("content-type"), REFERER("referer"), X_FORWARDED_FOR( - "x-forwarded-for"), X_VCAP_REQUEST_ID("x-vcap-request-id"), CORRELATION_ID("X-CorrelationID", - Fields.CORRELATION_ID, true, X_VCAP_REQUEST_ID), TENANT_ID("tenantid", Fields.TENANT_ID, true); + CONTENT_LENGTH("content-length"), + CONTENT_TYPE("content-type"), + REFERER("referer"), + X_FORWARDED_FOR("x-forwarded-for"), + X_VCAP_REQUEST_ID("x-vcap-request-id"), + CORRELATION_ID("X-CorrelationID", Fields.CORRELATION_ID, true, X_CORRELATION_ID, X_VCAP_REQUEST_ID), + X_CORRELATION_ID("X-Correlation-ID"), + TENANT_ID("tenantid", Fields.TENANT_ID, true); private HttpHeaders(String name) { this(name, null, false);