Skip to contents

Traces and Spans

Trace
Trace Class
Span
Span Class
trace_event()
Create a Trace Event
securetrace_event()
Trace Event Class (S7)
is_trace_event()
Test if an Object is a Trace Event

Context Management

with_trace()
Execute Code Within a Trace
with_span()
Execute Code Within a Span
current_trace()
Get the Current Active Trace
current_span()
Get the Current Active Span
set_default_exporter()
Set the Default Exporter
sampling
Trace Sampling
securetrace_sampler()
S7 class: securetrace_sampler
sampler_always_on()
Always-On Sampler
sampler_always_off()
Always-Off Sampler
sampler_probability()
Probability Sampler
sampler_rate_limiting()
Rate-Limiting Sampler
set_default_sampler()
Set the Default Sampler
resource()
Resource Attributes
set_resource()
Set the Default Resource
current_resource()
Get the Current Resource

Metrics

record_tokens()
Record Token Usage on the Current Span
record_latency()
Record Latency on the Current Span
record_metric()
Record a Custom Metric on the Current Span

Cost

model_costs()
Get Known Model Costs
calculate_cost()
Calculate Cost for a Model Call
add_model_cost()
Add or Update Model Pricing
trace_total_cost()
Calculate Total Cost for a Trace
resolve_model()
Resolve a Model Name
add_model_alias()
Add a Model Alias

Exporters

new_exporter()
Create a New Exporter
securetrace_exporter()
Exporter Class (S7)
jsonl_exporter()
JSONL Exporter
console_exporter()
Console Exporter
export_trace()
Export a Trace
multi_exporter()
Multi-Exporter
json_stdout_exporter()
JSON stdout Exporter
trace_schema()
JSONL Trace Schema

OTLP Export

otlp_exporter()
OTLP JSON Exporter
otlp_format_trace()
Format a Trace as OTLP JSON
flush_otlp()
Flush Buffered OTLP Traces

Prometheus

prometheus
Prometheus Metrics for securetrace
prometheus_registry()
Create a Prometheus Metrics Registry
prometheus_metrics()
Extract Prometheus Metrics from a Trace
prometheus_exporter()
Prometheus Exporter
format_prometheus()
Format Prometheus Text Exposition
serve_prometheus()
Serve Prometheus Metrics via HTTP

Context Propagation

traceparent()
Generate a W3C Traceparent Header
parse_traceparent()
Parse a W3C Traceparent Header
inject_headers()
Inject Trace Context into HTTP Headers
extract_trace_context()
Extract Trace Context from HTTP Headers

Log Correlation

trace_log_prefix()
Get Trace Context Prefix for Log Messages
with_trace_logging()
Execute Expression with Trace-Correlated Logging

Integrations

trace_llm_call()
Trace an LLM Call
trace_tool_call()
Trace a Tool Execution
trace_guardrail()
Trace a Guardrail Check
trace_execution()
Trace a Secure Code Execution
trace_graph()
Trace an orchestr Graph Execution
trace_agent()
Trace an orchestr Agent Invocation