SAP / cf-java-logging-support

The Java Logging Support for Cloud Foundry supports the creation of structured log messages and the collection of request metrics
Apache License 2.0
77 stars 48 forks source link

Consider x-correlation-id as well #64

Open HrFlorianHoffmann opened 4 years ago

HrFlorianHoffmann commented 4 years ago

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.

KarstenSchnitter commented 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.

CLAassistant commented 4 years ago

CLA assistant check
All committers have signed the CLA.