Welcome to the new Golem Cloud Docs! 👋
Observability

Observability

Golem 1.5 includes built-in observability through the OpenTelemetry protocol. The built-in golem-otlp-exporter plugin exports agent traces, logs, and metrics to any OTLP-compatible collector.

Setting up the OTLP plugin

Enable the OTLP exporter by adding it to your golem.yaml:

components:
  my-app:ts-main:
    templates: ts
    plugins:
      - name: golem-otlp-exporter
        version: 1.5.0
        parameters:
          endpoint: "http://localhost:4318"
          signals: "traces,logs,metrics"

The following plugin configuration keys are available:

KeyDescription
endpointOTLP base URL
signalsCombination of traces, logs, metrics
headersCustom HTTP headers
service-name-modeEither agent-id or agent-type

Custom spans

Create custom spans using the golem:api/context interface:

import { startSpan, currentContext } from 'golem:api/context@1.5.0';
 
const span = startSpan('my-operation');
span.setAttribute('env', { tag: 'string', val: 'production' });
// ... do work ...
span.finish();

Trace context propagation

Trace and span IDs are automatically propagated from inbound HTTP requests through code-first routes, and outgoing HTTP requests include standard W3C trace headers (traceparent / tracestate).

TypeScript diagnostics_channel integration

For TypeScript agents, invocation context is wired to node:diagnostics_channel, enabling integration with Node.js tracing utilities:

import { tracingChannel } from 'node:diagnostics_channel';
 
const dc = tracingChannel('my-operation');
const result = dc.traceSync(
  () => { return 42; },
  { method: 'GET', url: '/api/data' }
);

Logs

When log exporting is enabled via the signals parameter, stdout/stderr output and dedicated log calls are forwarded to the OTLP collector. Standard logging APIs work out of the box — console.log in TypeScript, println! in Rust, and so on.

Metrics

The following metrics are exported per agent:

Metric NameTypeDescription
golem_invocation_countCounterNumber of agent method invocations
golem_invocation_duration_nsCounterInvocation duration in nanoseconds
golem_invocation_fuel_consumedCounterFuel consumed per invocation
golem_invocation_pending_countCounterPending invocations
golem_exit_countCounterProcess exit signals
golem_restart_countCounterFresh state creations
golem_resources_createdCounterInternal resources created
golem_resources_droppedCounterInternal resources dropped
golem_resources_activeGaugeActive internal resources
golem_update_success_countCounterSuccessful updates
golem_update_failure_countCounterFailed updates

Each metric includes the following labels: service.name, golem.agent.id, golem.component.id, and golem.component.version.

Oplog processor plugins

The OTLP exporter is a built-in oplog processor plugin. Custom oplog processor plugins can be written in Rust by implementing the process-oplog-entries interface. Golem guarantees exactly-once delivery of oplog entries to plugins.

Plugins can be installed per-component and activated or deactivated per-agent via the CLI:

golem agent activate-plugin --plugin-name my-plugin --component-name my-component --agent-name my-agent
golem agent deactivate-plugin --plugin-name my-plugin --component-name my-component --agent-name my-agent

For more details on plugin management, see the How-To Guides.