Semantic Conventions API
Reference for mantisdk.tracing.semconv module.
Overview
Semantic conventions provide standardized attribute names for consistent trace data.
import mantisdk.tracing as tracing
span.set_attribute(tracing.semconv.USER_ID, "user-123")Trace-Level Attributes
For root spans (traces):
TRACE_NAME
Value: insight.trace.name
Name of the trace.
span.set_attribute(tracing.semconv.TRACE_NAME, "user-query-workflow")TRACE_INPUT
Value: insight.trace.input
Input to the trace.
span.set_attribute(tracing.semconv.TRACE_INPUT, user_query)TRACE_OUTPUT
Value: insight.trace.output
Output from the trace.
span.set_attribute(tracing.semconv.TRACE_OUTPUT, result)TRACE_METADATA
Value: insight.trace.metadata
Additional metadata (JSON string).
span.set_attribute(tracing.semconv.TRACE_METADATA, '{"source": "api", "version": "1.0"}')TRACE_TAGS
Value: insight.trace.tags
Tags for filtering (JSON array string).
span.set_attribute(tracing.semconv.TRACE_TAGS, '["production", "high-priority"]')TRACE_PUBLIC
Value: insight.trace.public
Whether the trace is publicly visible.
span.set_attribute(tracing.semconv.TRACE_PUBLIC, True)User & Session
USER_ID
Value: insight.user.id
Unique user identifier.
span.set_attribute(tracing.semconv.USER_ID, "user-123")SESSION_ID
Value: insight.session.id
Session identifier.
span.set_attribute(tracing.semconv.SESSION_ID, "session-456")Environment & Version
ENVIRONMENT
Value: insight.environment
Deployment environment.
span.set_attribute(tracing.semconv.ENVIRONMENT, "production")RELEASE
Value: insight.release
Release identifier.
span.set_attribute(tracing.semconv.RELEASE, "v1.2.3")VERSION
Value: insight.version
Version string.
span.set_attribute(tracing.semconv.VERSION, "1.2.3")Observation-Level Attributes
For child spans (observations):
OBSERVATION_TYPE
Value: insight.observation.type
Type of observation. Use ObservationType enum values.
from mantisdk.tracing.semconv import ObservationType
span.set_attribute(tracing.semconv.OBSERVATION_TYPE, ObservationType.GENERATION)OBSERVATION_INPUT
Value: insight.observation.input
Input to the operation.
span.set_attribute(tracing.semconv.OBSERVATION_INPUT, input_data)OBSERVATION_OUTPUT
Value: insight.observation.output
Output from the operation.
span.set_attribute(tracing.semconv.OBSERVATION_OUTPUT, output_data)OBSERVATION_METADATA
Value: insight.observation.metadata
Additional metadata (JSON string).
span.set_attribute(tracing.semconv.OBSERVATION_METADATA, '{"items": 5}')OBSERVATION_LEVEL
Value: insight.observation.level
Log level. Use ObservationLevel enum values.
from mantisdk.tracing.semconv import ObservationLevel
span.set_attribute(tracing.semconv.OBSERVATION_LEVEL, ObservationLevel.WARNING)OBSERVATION_STATUS_MESSAGE
Value: insight.observation.status_message
Status message.
span.set_attribute(tracing.semconv.OBSERVATION_STATUS_MESSAGE, "Completed successfully")Model Attributes
MODEL_NAME
Value: insight.observation.model.name
Model identifier.
span.set_attribute(tracing.semconv.MODEL_NAME, "gpt-4o-mini")MODEL_PARAMETERS
Value: insight.observation.model.parameters
Model parameters (JSON string).
span.set_attribute(tracing.semconv.MODEL_PARAMETERS, '{"temperature": 0.7, "max_tokens": 1000}')Enums
ObservationType
Valid values for OBSERVATION_TYPE:
from mantisdk.tracing.semconv import ObservationType
ObservationType.SPAN # "span"
ObservationType.GENERATION # "generation"
ObservationType.EVENT # "event"ObservationLevel
Valid values for OBSERVATION_LEVEL:
from mantisdk.tracing.semconv import ObservationLevel
ObservationLevel.DEBUG # "DEBUG"
ObservationLevel.DEFAULT # "DEFAULT"
ObservationLevel.WARNING # "WARNING"
ObservationLevel.ERROR # "ERROR"Complete Reference Table
| Constant | Value | Category |
|---|---|---|
TRACE_NAME | insight.trace.name | Trace |
TRACE_INPUT | insight.trace.input | Trace |
TRACE_OUTPUT | insight.trace.output | Trace |
TRACE_METADATA | insight.trace.metadata | Trace |
TRACE_TAGS | insight.trace.tags | Trace |
TRACE_PUBLIC | insight.trace.public | Trace |
USER_ID | insight.user.id | User |
SESSION_ID | insight.session.id | Session |
ENVIRONMENT | insight.environment | Environment |
RELEASE | insight.release | Environment |
VERSION | insight.version | Environment |
OBSERVATION_TYPE | insight.observation.type | Observation |
OBSERVATION_INPUT | insight.observation.input | Observation |
OBSERVATION_OUTPUT | insight.observation.output | Observation |
OBSERVATION_METADATA | insight.observation.metadata | Observation |
OBSERVATION_LEVEL | insight.observation.level | Observation |
OBSERVATION_STATUS_MESSAGE | insight.observation.status_message | Observation |
MODEL_NAME | insight.observation.model.name | Model |
MODEL_PARAMETERS | insight.observation.model.parameters | Model |