openfaas / of-watchdog

Reverse proxy for STDIO and HTTP microservices
MIT License
259 stars 115 forks source link

[Feature request] Add X-Call-Id to log lines #115

Open studiogangster opened 3 years ago

studiogangster commented 3 years ago

Expected Behaviour

The function logs should also contain an TraceID, which can be used to debug a specific function call.

Current Behaviour

Current logs shows timestamp, stderr/stdout, and function's name as prefix

Possible Solution

Modify 'bindLoggingPipe' signature and include an argument for (prefix/tag/traceId: string) in./executor/logging.go: bindLoggingPipe() The tag can be parsed from HTTP Request, and have a fallback with default prefix from the environment variable.

Context

I am using OpenFaas in the backend and triggering async call to the function via S2S call from our API Server. This can be considered as a user created Job, which might take few minutes / hours to complete. User can come back any time, and check the status / logs to track the progress of the Job ( at the frontend ). I am persisting the logs with ELK, but to cater this use case, I would have to create a custom logging logic for each function. Since, the platform allows different user to create custom functions, I don't want the enduser to implement this required logic, and have a centralised provision for the same.

Your Environment

Kubernetes

alexellis commented 3 years ago

/set title: [Feature request] Add X-Call-Id to log lines

alexellis commented 3 years ago

Thanks for using OpenFaaS. We'll consider this request in our next triage meeting.

In the meantime, I would suggest taking a look at what we have to offer companies adopting OpenFaaS for commercial use. https://www.openfaas.com/support/ and https://github.com/openfaas/faas/issues/1591

alexellis commented 3 years ago

Related to #75

In which case, using the call ID in the log line goes against the other ask to pass through text.