faro-web-sdk
faro-web-sdk copied to clipboard
Console instrumentation ignore span context when calling pushLog
Description
When using e.g. console.info(...
inside an active span the instrumented console doesn't provide the span context to the pushLogs call
https://github.com/grafana/faro-web-sdk/blob/3f200325c1ae146526e8b71ebb6deed391958b36/packages/web-sdk/src/instrumentations/console/instrumentation.ts#L24
If this is missing the pushLog doesn't attach tracing infos to the log statment
https://github.com/grafana/faro-web-sdk/blob/3f200325c1ae146526e8b71ebb6deed391958b36/packages/core/src/api/logs/initialize.ts#L36
Steps to reproduce
faro.api
.getOTEL()
?.trace.getTracer('frontend')
.startActiveSpan('hello world', (span) => {
// send a log message
console.info("sending hello to backend")
Expected behavior
When using console.info inside a active span the logs should have trace data
Actual behavior
No trace / span data inside the logs on the faro side for kind=log
log entries
Environment
- SDK version: 1.8.0