Open HrFlorianHoffmann opened 4 years ago
Thanks or your contribution. We have issue #45 addressing exactly this question. Adding the alias in the library is rather easy, as demonstrated by your PR. But there are some more things to consider here. Main focus of this library is to aid development of Java applications running on the SAP Cloud Platform using the Cloud Foundry stack. This platform centrally generates request logs in the gorouter, that are shipped along the application logs filtered by this library. The request logs however, only contain a selected set of HTTP headers. This set contains the already supported X-CorrelationID
, but not the proposed x-correlation-id
. Developers would lack the ability to correlate the request logs with the application logs when using the new header, thus weakening the overall feature. Therefore, we decided to only support X-CorrelationID
in the library as an opinionated approach to correlation ids within the platform.
The library currently considers the header fields
x-correlationid
andx-vcap-request-id
as carrying correlation IDs. This change would also make it aware of the fieldx-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 fieldx-correlationid
. Meaning, for example, the library will usex-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.