Skip to main content
Full OpenTelemetry observability for III Engine: distributed tracing, structured logs, performance metrics, alert rules, and trace sampling — all queryable via built-in functions.

Sample Configuration

Configuration

boolean
Whether OpenTelemetry tracing export is enabled. Defaults to false. Can also be set via OTEL_ENABLED environment variable.
string
Service name reported in traces and metrics. Defaults to "iii". Can also be set via OTEL_SERVICE_NAME.
string
Service version reported in traces (service.version OTEL attribute). Can also be set via SERVICE_VERSION.
string
Service namespace (service.namespace OTEL attribute). Can also be set via SERVICE_NAMESPACE.
string
Trace exporter type. Options:
  • memory — store traces in memory, queryable via engine::traces::list
  • otlp — export to an OTLP collector via gRPC
  • both — export via OTLP and keep in memory (enables log triggers alongside OTLP export)
Defaults to otlp. Can also be set via OTEL_EXPORTER_TYPE.
string
OTLP collector endpoint. Used when exporter is otlp or both. Defaults to "http://localhost:4317". Can also be set via OTEL_EXPORTER_OTLP_ENDPOINT.
number
Global trace sampling ratio from 0.0 (sample nothing) to 1.0 (sample everything). Defaults to 1.0. Can also be set via OTEL_TRACES_SAMPLER_ARG.
SamplingConfig
Advanced per-operation and per-service sampling rules.
number
Maximum number of spans to keep in memory when using memory or both exporter. Defaults to 1000. Can also be set via OTEL_MEMORY_MAX_SPANS.
boolean
Whether metrics collection is enabled. Defaults to false. Can also be set via OTEL_METRICS_ENABLED.
string
Metrics exporter type: memory (queryable via API) or otlp. Defaults to memory. Can also be set via OTEL_METRICS_EXPORTER.
number
How long to retain metrics in memory in seconds. Defaults to 3600 (1 hour). Can also be set via OTEL_METRICS_RETENTION_SECONDS.
number
Maximum number of metric data points to keep in memory. Defaults to 10000. Can also be set via OTEL_METRICS_MAX_COUNT.
boolean
Whether structured log storage is enabled. When not set, log storage is always initialized by the module.
string
Logs exporter type: memory, otlp, or both. Defaults to memory. Can also be set via OTEL_LOGS_EXPORTER.
number
Maximum number of log entries to keep in memory. Defaults to 1000.
number
How long to retain logs in memory in seconds. Defaults to 3600 (1 hour).
number
Fraction of logs to retain (0.0 to 1.0). Defaults to 1.0 (keep all).
boolean
Whether to print ingested logs to the console via tracing. Defaults to true.
string
Minimum log level for the engine itself. Options: trace, debug, info, warn, error. Defaults to info.
string
Log output format: default (human-readable) or json (structured JSON). Defaults to default.
AlertRule[]
List of alert rules evaluated against metrics.

Functions

Logging

function
Log an informational message.
string
required
The message to log.
object
Optional structured fields to attach to the log entry.
string
Optional trace ID for correlation.
string
Optional span ID for correlation.
string
Service name. Defaults to the function name if not provided.
function
Log a warning message. Same parameters as engine::log::info.
function
Log an error message. Same parameters as engine::log::info.
function
Log a debug message. Same parameters as engine::log::info.
function
Log a trace-level message. Same parameters as engine::log::info.

Logs API

function
Query stored log entries.
number
Start time in Unix timestamp milliseconds.
number
End time in Unix timestamp milliseconds.
string
Filter by trace ID.
string
Filter by span ID.
number
Minimum severity number (1–24, higher = more severe).
string
Filter by severity text (e.g., "ERROR", "WARN", "INFO").
number
Pagination offset. Defaults to 0.
number
Maximum number of entries to return.
object[]
Array of log entries.
number
Total number of matching log entries before pagination.
object
Echo of all input query parameters used for the request. Omitted when log storage has not yet been initialized.
number
Response timestamp in Unix milliseconds.
function
Clear all stored log entries from memory.

Traces API

function
List stored trace spans.
string
Filter by specific trace ID.
string
Filter by service name (case-insensitive substring match).
string
Filter by span name (case-insensitive substring match).
string
Filter by status (case-insensitive substring match).
number
Minimum span duration in milliseconds.
number
Maximum span duration in milliseconds.
number
Start time in Unix timestamp milliseconds.
number
End time in Unix timestamp milliseconds.
string
Sort field: "duration", "start_time", or "name". Defaults to "start_time".
string
Sort order: "asc" or "desc". Defaults to "asc".
array
Filter by span attributes. Array of [key, value] pairs (AND logic, exact match).
boolean
Include internal engine traces (engine.* functions). Defaults to false.
number
Pagination offset. Defaults to 0.
number
Pagination limit. Defaults to 100.
object[]
Array of span objects.
number
Total number of matching spans before pagination.
number
Applied pagination offset.
number
Applied pagination limit.
function
Retrieve a trace as a hierarchical span tree.
string
required
The trace ID to retrieve.
object[]
Array of root spans, each with nested child spans in a children field.
function
Clear all stored trace spans from memory.

Metrics API

function
List collected metrics with aggregated statistics.
number
Start time in Unix timestamp milliseconds.
number
End time in Unix timestamp milliseconds.
string
Filter by metric name.
number
Aggregate interval in seconds.
object
Built-in engine counters: invocations (total, success, error, deferred, by_function), workers (spawns, deaths, active), and performance (avg_duration_ms, p50_duration_ms, p95_duration_ms, p99_duration_ms, min_duration_ms, max_duration_ms).
object[]
Raw SDK metric data points collected from storage.
object[]
Time-bucketed aggregations, present only when aggregate_interval is provided alongside a time range.
number
Response timestamp in Unix milliseconds.
object
Echo of the input query parameters, present when any time filter or interval was provided.
function
List metric rollup aggregations (1-minute, 5-minute, 1-hour windows).
number
Start time in Unix timestamp milliseconds.
number
End time in Unix timestamp milliseconds.
number
Rollup level index: 0 = 1 minute, 1 = 5 minutes, 2 = 1 hour.
string
Filter by metric name.
object[]
Array of rollup objects with time-bucketed aggregations.
object[]
Array of histogram rollup objects for distribution metrics.
number
The rollup level applied: 0 = 1 minute, 1 = 5 minutes, 2 = 1 hour.
object
Echo of the input query parameters (start_time, end_time, metric_name).
number
Response timestamp in Unix milliseconds.

Baggage API

function
Get a baggage value from the current trace context.
string
required
Baggage key to retrieve.
function
Set a baggage value in the current trace context.
string
required
Baggage key.
string
required
Baggage value.
function
Get all baggage key-value pairs from the current trace context.

Sampling API

function
List all active sampling rules and their current configuration.

Health API

function
Check engine health status.
string
Health status (e.g., "healthy").
object
Per-component health with otel, metrics, logs, and spans sub-statuses.
number
Current time in Unix timestamp milliseconds.
string
Engine version.

Alerts API

function
List all configured alert rules and their current state.
function
Manually trigger evaluation of all alert rules against current metrics.

Trigger Type

This module adds a new Trigger Type: log. Register a function to react to log entries as they are produced.

Log Entry Payload

number
Timestamp of the log entry in Unix nanoseconds.
number
Observed timestamp in Unix nanoseconds.
number
Numeric severity level (1–24).
string
Severity text (e.g., "INFO", "WARN", "ERROR").
string
The log message content.
object
Structured attributes attached to the log entry.
string
Distributed tracing ID for correlating this log entry across services.
string
Span ID for correlation within a trace.
object
Resource attributes associated with the log entry.
string
Name of the service that produced the log entry.
string
Name of the instrumentation scope.
string
Version of the instrumentation scope.

Sample Code