Log Trace
This API allows you to create a log trace with optional spans.
Request
Header
Bearer Token Authentication
All API requests must include a valid workspace API key in the Authorization header using the Bearer token format.
You can create your workspace API key in Adaline by visiting Settings > API Keys.
Body
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. This is usually the traceId used within your application / system.
Session ID associated with the trace. This is usually the sessionId / threadId / chatId used within your application / system.
Additional attributes for the trace. Key-value pairs of attributes. Keys must be strings, values must be strings, numbers, or booleans.
Array of tags for categorization. Each tag must be a string.
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). Refer Span Content.
Whether to run evaluation on this span.
Reference ID of the parent span. This is usually the parent span’s spanId used within your application / system.
External reference ID for the span. This is usually the spanId used within your application / system.
Session ID associated with the span. This is usually the sessionId / threadId / chatId used within your application / system.
Additional attributes for the span. Key-value pairs of attributes. Keys must be strings, values must be strings, numbers, or booleans.
Array of tags for categorization. Each tag must be a string.
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.