haystack/releasenotes/notes/log-trace-correlation-78bcf418718b24b4.yaml
Tobias Wochinger 6fce2dbb11
feat: log trace correlation (#7206)
* feat: implement support for trace-log correlation

* docs: add release notes
2024-02-27 10:06:53 +01:00

18 lines
637 B
YAML

---
enhancements:
- |
If using JSON logging in conjunction with tracing, Haystack will automatically add correlation IDs to the logs.
This is done by getting the necessary information from the current span and adding it to the log record.
You can customize this by overriding the `get_correlation_data_for_logs` of your tracer's span:
```python
from haystack.tracing import Span
class OpenTelemetrySpan(Span):
...
def get_correlation_data_for_logs(self) -> Dict[str, Any]:
span_context = ...
return {"trace_id": span_context.trace_id, "span_id": span_context.span_id}
```