Create Log Trace
Create a log trace with optional spans. This endpoint allows you to create a complete trace with multiple spans in a single request.
Header
All requests require a valid workspace API key passed in the Authorization
header:
Parameters
The unique identifier of the project in Adaline.
The trace object containing trace details.
Unix timestamp when the trace started.
Unix timestamp when the trace ended (current time if not provided).
Name/identifier for the trace.
Status of the trace (one of: “success”, “failure”, “pending”, “unknown”).
External reference ID for the trace (e.g., traceId in your application / system).
Session ID associated with the trace (e.g., sessionId or threadId in your application / system).
Additional attributes for the trace.
Array of tags for categorization.
Array of span objects to create with the trace.
Span Object Parameters
The unique identifier of the prompt in Adaline.
The deployment ID of the prompt in Adaline.
Unix timestamp when the span started.
Unix timestamp when the span ended.
Name/identifier for the span.
Status of the span (one of: “success”, “failure”, “unknown”).
The stringified JSON content of the span (max 1MB).
Whether to run evaluation on this span.
Reference ID of the parent span.
External reference ID for the span.
Session ID associated with the span.
Additional attributes for the span.
Array of tags for categorization.
Array of events that occurred during the span.
Response
The unique identifier of the created trace.
Array of unique identifiers for the created spans.
Trace Creation Validation Rules
- Time Validation:
startedAt
must be beforeendedAt
(if provided) - Span Time Validation: Each span’s
startedAt
must be before itsendedAt
- Trace-Span Time Relationship: All spans must start after or at the trace’s
startedAt
- Reference ID Uniqueness: All span
referenceId
s must be unique within the request - Parent Reference Validation: Any
parentReferenceId
must reference another span’sreferenceId
in the same request - Trace Reference Requirement: If any span has a
referenceId
, the trace must also have areferenceId
Best Practices
-
Structured Logging: Use consistent naming conventions for traces and spans to enable better analysis.
-
Reference IDs: Use meaningful reference IDs that can be tracked across your application for better debugging.
-
Content Size Management: Monitor your content size to stay within the 1MB limit per span.
-
Batch Operations: When possible, use the trace endpoint to create multiple spans in a single request.
-
Time Accuracy: Ensure timestamps are accurate and represent the actual start/end times of operations.
-
Meaningful Attributes: Use attributes and tags to add context that will be useful for analysis and debugging.
-
Session Tracking: Use session IDs consistently to track user sessions across multiple traces.