mirror of
https://github.com/deepset-ai/haystack.git
synced 2025-12-02 18:06:35 +00:00
18 lines
637 B
YAML
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}
|
|
```
|