Skip to Content
OpenTelemetry Sinks

OpenTelemetry Sinks

Please contact us if you are interested in this feature.

Spiral makes it easy to set up an OpenTelemetry  sink for writing log and trace data into a table (metrics are currently not supported).

Installation

To get started, create a new project and initialize a new sink. You can override the default table names as well as configure multiple regions.

spiral projects create --name "OpenTelemetry Sink" <project-id> spiral otel init <project-id> \ --logs-table "otel.logs" \ --traces-table "otel.traces" \ --region "fly-ewr" \ --region "fly-lhr" \ https://<otel-sink-id>.sprl.io

In this example, logs will be written to the <project-id>.otel.logs table and traces will be written to the <project-id>.otel.traces table.

Client Configuration

OpenTelemetry Sinks are protected by mutual TLS .

Run the following command to generate a new client certificate.

spiral otel rotate-cert <otel-sink-id> -o client.crt

Only the three most recent client certificates are stored. If you rotate the certificate more than three times, the oldest certificate will no longer work.

This certificate file must be deployed to your OpenTelemetry producers. For example:

from opentelemetry.sdk.resources import SERVICE_NAME, Resource from opentelemetry import trace from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter from opentelemetry.sdk.trace import TracerProvider from opentelemetry.sdk.trace.export import BatchSpanProcessor # Service name is required for most backends resource = Resource(attributes={ SERVICE_NAME: "your-service-name" }) trace_provider = TracerProvider(resource=resource) trace_provider.add_span_processor(BatchSpanProcessor(OTLPSpanExporter( endpoint="https://<otel-sink-id>.sprl.io", certificate_file="<path/to/client.crt>", ))) trace.set_tracer_provider(trace_provider)

See the OpenTelemetry documentation  for more information on configuring your language-specific client.

Last updated on