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

Support Correlation ID #1580

Open
PierreFritsch opened this issue Oct 26, 2023 · 1 comment
Open

Support Correlation ID #1580

PierreFritsch opened this issue Oct 26, 2023 · 1 comment
Labels
feature request javascript Pull requests that update Javascript code

Comments

@PierreFritsch
Copy link
Contributor

Will the sap-cloud-sdk-logger from @sap-cloud-sdk/util output the incoming correlation ID to the logs?

If not, how can we pass the correlation ID ourselves to the logger?

I couldn't find a corresponding hint in the documentation.

Background: We're seeing log entries from our app in Kibana, seemingly written by this logger, that are not instrumented with a correlation_id.

Cross-link: Also asked this question on stackoverflow - https://stackoverflow.com/questions/77366185/sap-cloud-sdk-logger-support-for-correlation-id

@tomfrenken
Copy link
Member

Hey @PierreFritsch, this functionality isn't currently built into the SDK logger, we have received a similar feature request in our own repository (as opposed to this one, which is only for the documentation) here.

If you are using our logger directly, however, you can of course get the correlation ID from the headers yourself and set it in the log context like this:

const correlationId = myRequest.headers.correlationIdHeader // Here you have to check which of your headers contains the correlation id
setLogLevel('error', `Correlation ID: ${correlationId}`);

@jjtang1985 jjtang1985 changed the title Documentation: sap-cloud-sdk-logger Support for Correlation ID Support Correlation ID Nov 1, 2023
@marikaner marikaner added the javascript Pull requests that update Javascript code label Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request javascript Pull requests that update Javascript code
Projects
None yet
Development

No branches or pull requests

3 participants