docs/modules/module-observability.mdx
Full OpenTelemetry observability for III Engine: distributed tracing, structured logs, performance metrics, alert rules, and trace sampling — all queryable via built-in functions.
modules::observability::OtelModule
- class: modules::observability::OtelModule
config:
enabled: true
service_name: my-service
service_version: 1.0.0
exporter: memory
metrics_enabled: true
logs_enabled: true
memory_max_spans: 1000
sampling_ratio: 1.0
alerts:
- name: high-error-rate
metric: iii.invocations.error
threshold: 10
operator: ">"
window_seconds: 60
action:
type: log
Defaults to otlp. Can also be set via OTEL_EXPORTER_TYPE.
</ResponseField>
<Expandable title="SamplingRule">
<ResponseField name="operation" type="string">
Operation name pattern (supports wildcards like `"api.*"`).
</ResponseField>
<ResponseField name="service" type="string">
Service name pattern to match.
</ResponseField>
<ResponseField name="rate" type="number" required>
Sampling rate for this rule (`0.0` to `1.0`).
</ResponseField>
</Expandable>
</ResponseField>
<ResponseField name="parent_based" type="boolean">
If `true`, inherit the sampling decision from the parent span.
</ResponseField>
<ResponseField name="rate_limit" type="RateLimitConfig">
<Expandable title="RateLimitConfig">
<ResponseField name="max_traces_per_second" type="number">
Maximum number of traces to sample per second.
</ResponseField>
</Expandable>
</ResponseField>
<Expandable title="AlertAction">
`{ "type": "log" }` — Log the alert (default)
`{ "type": "webhook", "url": "https://..." }` — Send a webhook notification
`{ "type": "function", "path": "my::alert::handler" }` — Invoke a registered function
</Expandable>
</ResponseField>
This module adds a new Trigger Type: log.
Register a function to react to log entries as they are produced.
<Expandable title="Trigger Config"> <ResponseField name="level" type="string"> The log level to subscribe to: `info`, `warn`, `error`, `debug`, or `trace`. When omitted, the trigger fires for all levels. </ResponseField> </Expandable>const fn = iii.registerFunction(
{ id: 'monitoring::onError' },
async (logEntry) => {
await sendAlert({
message: logEntry.body,
severity: logEntry.severity_text,
traceId: logEntry.trace_id,
})
return {}
},
)
iii.registerTrigger({
type: 'log',
function_id: fn.id,
config: { level: 'error' },
})