API Reference
Semantic Conventions

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

ConstantValueCategory
TRACE_NAMEinsight.trace.nameTrace
TRACE_INPUTinsight.trace.inputTrace
TRACE_OUTPUTinsight.trace.outputTrace
TRACE_METADATAinsight.trace.metadataTrace
TRACE_TAGSinsight.trace.tagsTrace
TRACE_PUBLICinsight.trace.publicTrace
USER_IDinsight.user.idUser
SESSION_IDinsight.session.idSession
ENVIRONMENTinsight.environmentEnvironment
RELEASEinsight.releaseEnvironment
VERSIONinsight.versionEnvironment
OBSERVATION_TYPEinsight.observation.typeObservation
OBSERVATION_INPUTinsight.observation.inputObservation
OBSERVATION_OUTPUTinsight.observation.outputObservation
OBSERVATION_METADATAinsight.observation.metadataObservation
OBSERVATION_LEVELinsight.observation.levelObservation
OBSERVATION_STATUS_MESSAGEinsight.observation.status_messageObservation
MODEL_NAMEinsight.observation.model.nameModel
MODEL_PARAMETERSinsight.observation.model.parametersModel