Overview
As long as the following conditions are met, a list of logs will be aggregated into a trace automatically upon ingestion:- Tracing proper timestamps of each span
- Assigning proper trace and span IDs that represent the correct parent-child relationship
How It Works
The example code:- Loads sample trace data from a JSON file
- Shifts timestamps to current time while preserving relative timing
- Remaps trace and span IDs to prevent conflicts with existing traces
- Sends processed logs to Keywords AI traces endpoint
Code Example
You can find the complete example code in our GitHub repository.Setup
To run this example:-
Install the required dependencies:
-
Set environment variables:
-
Run the example:
Key Concepts
Trace and Span IDs
Each trace has a uniquetrace_id
that groups all related spans together. Each individual operation within the trace has its own span_id
. Parent-child relationships are established using the parent_span_id
field.