Observability
OpenTelemetry-based traces, metrics, logs, alerts, and sampling.
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::OtelModuleSample Configuration
- 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: logConfiguration
Whether OpenTelemetry tracing export is enabled. Defaults to false. Can also be set via OTEL_ENABLED environment variable.
Service name reported in traces and metrics. Defaults to "iii". Can also be set via OTEL_SERVICE_NAME.
Service version reported in traces (service.version OTEL attribute). Can also be set via SERVICE_VERSION.
Service namespace (service.namespace OTEL attribute). Can also be set via SERVICE_NAMESPACE.
Trace exporter type. Options:
memory— store traces in memory, queryable viaengine::traces::listotlp— export to an OTLP collector via gRPCboth— export via OTLP and keep in memory (enables log triggers alongside OTLP export)
Defaults to otlp. Can also be set via OTEL_EXPORTER_TYPE.
OTLP collector endpoint. Used when exporter is otlp or both. Defaults to "http://localhost:4317". Can also be set via OTEL_EXPORTER_OTLP_ENDPOINT.
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.
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.
Whether metrics collection is enabled. Defaults to false. Can also be set via OTEL_METRICS_ENABLED.
Metrics exporter type: memory (queryable via API) or otlp. Defaults to memory. Can also be set via OTEL_METRICS_EXPORTER.
How long to retain metrics in memory in seconds. Defaults to 3600 (1 hour). Can also be set via OTEL_METRICS_RETENTION_SECONDS.
Maximum number of metric data points to keep in memory. Defaults to 10000. Can also be set via OTEL_METRICS_MAX_COUNT.
Whether structured log storage is enabled. When not set, log storage is always initialized by the module.
Logs exporter type: memory, otlp, or both. Defaults to memory. Can also be set via OTEL_LOGS_EXPORTER.
How long to retain logs in memory in seconds. Defaults to 3600 (1 hour).
Whether to print ingested logs to the console via tracing. Defaults to true.
Minimum log level for the engine itself. Options: trace, debug, info, warn, error. Defaults to info.
Log output format: default (human-readable) or json (structured JSON). Defaults to default.
Functions
Logging
Logs API
Traces API
Metrics API
Baggage API
Sampling API
Health API
Alerts API
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
Sample Code
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' },
})