API Reference
Complete API reference for Mantis SDK tracing module.
Module: mantisdk.tracing
The main tracing module providing all public APIs.
import mantisdk.tracing as tracingQuick Reference
Insight Platform
| Page | Description |
|---|---|
| Insight REST API | Public API for traces, observations, scores, dashboards, datasets, prompts, and project resources |
| Insight SQL API | Read-only ClickHouse analytics over traces, observations, and scores |
| Insight CLI | Terminal workflow for API smoke checks, SQL diagnostics, and project operations |
| OTel Ingestion | OpenTelemetry trace ingestion endpoint reference |
Initialization
| Function | Description |
|---|---|
init() | Initialize tracing |
instrument() | Enable auto-instrumentation |
shutdown() | Graceful shutdown |
flush() | Force flush spans |
Span Creation
| Function | Description |
|---|---|
trace | Create root spans (decorator/context manager) |
span() | Create child spans (context manager) |
tool() | Create tool spans (context manager) |
atrace() | Async root spans |
aspan() | Async child spans |
Utilities
| Function | Description |
|---|---|
get_current_span() | Get active span |
insight_exporter() | Create Insight exporter |
Semantic Conventions
| Module | Description |
|---|---|
semconv | Standard attribute names |
Import Patterns
# Full module import (recommended)
import mantisdk.tracing as tracing
tracing.init()
tracing.trace("name")
# Specific imports
from mantisdk.tracing import init, trace, span, semconv
# Semantic conventions
from mantisdk.tracing.semconv import USER_ID, SESSION_ID, ObservationType
# Exporter utilities
from mantisdk.tracing.exporters.insight import is_insight_configuredType Annotations
from opentelemetry.trace import Span, SpanKind
from opentelemetry.sdk.trace.export import SpanExporter
# Function signatures
def init(
*,
service_name: str | None = None,
instrument_default: bool = True,
exporters: list[SpanExporter] | None = None,
force: bool = False,
) -> None: ...
def trace(
name_or_func: str | Callable | None = None,
*,
name: str | None = None,
input: Any = None,
kind: SpanKind = SpanKind.INTERNAL,
attributes: dict[str, Any] | None = None,
capture_input: bool = True,
capture_output: bool = True,
) -> Span | Callable: ...Next Steps
- Tracing Module API - Full function reference
- Semantic Conventions - Attribute constants
- Environment Variables - Configuration reference