struct

Logit::Backend::OTLP::Config

Inherits Struct / Value / Object

Configuration options for the OTLP backend.

All timing values use Time::Span for type safety. Resource attributes follow OpenTelemetry semantic conventions.

Constructors

new(endpoint : String, batch_size : Int32 = 512, flush_interval : Time::Span = 5.seconds, headers : Hash(String, String) = {} of String => String, timeout : Time::Span = 30.seconds, resource_attributes : Hash(String, String) = {} of String => String, scope_name : String = "logit", scope_version : String = Logit::VERSION)
Source

Instance methods

batch_size

Maximum number of events per batch.

When the buffer reaches this size, it will be flushed immediately. Lower values reduce memory usage but increase HTTP overhead.

Source
batch_size=(batch_size : Int32)

Maximum number of events per batch.

When the buffer reaches this size, it will be flushed immediately. Lower values reduce memory usage but increase HTTP overhead.

Source
endpoint

OTLP HTTP endpoint URL.

Should point to an OTLP-compatible logs endpoint, typically ending in /v1/logs.

Examples:

  • http://localhost:4318/v1/logs (local collector)
  • https://otlp.example.com/v1/logs (remote collector)
Source
endpoint=(endpoint : String)

OTLP HTTP endpoint URL.

Should point to an OTLP-compatible logs endpoint, typically ending in /v1/logs.

Examples:

  • http://localhost:4318/v1/logs (local collector)
  • https://otlp.example.com/v1/logs (remote collector)
Source
flush_interval

Time between automatic flushes.

The backend will flush buffered events at this interval even if the batch size hasn't been reached. Set to a shorter interval for lower latency at the cost of more HTTP requests.

Source
flush_interval=(flush_interval : Time::Span)

Time between automatic flushes.

The backend will flush buffered events at this interval even if the batch size hasn't been reached. Set to a shorter interval for lower latency at the cost of more HTTP requests.

Source
headers

HTTP headers to include with each request.

Use this for authentication tokens or custom metadata. Common headers:

  • Authorization: Bearer <token>
  • X-API-Key: <key>
Source
headers=(headers : Hash(String, String))

HTTP headers to include with each request.

Use this for authentication tokens or custom metadata. Common headers:

  • Authorization: Bearer <token>
  • X-API-Key: <key>
Source
resource_attributes

Resource attributes attached to all log records.

These identify the source of logs in your observability platform. Common attributes (following OpenTelemetry semantic conventions):

  • service.name - Logical name of the service
  • service.version - Version of the service
  • service.namespace - Namespace for the service
  • deployment.environment - Deployment environment (production, staging)
  • host.name - Hostname of the machine
Source
resource_attributes=(resource_attributes : Hash(String, String))

Resource attributes attached to all log records.

These identify the source of logs in your observability platform. Common attributes (following OpenTelemetry semantic conventions):

  • service.name - Logical name of the service
  • service.version - Version of the service
  • service.namespace - Namespace for the service
  • deployment.environment - Deployment environment (production, staging)
  • host.name - Hostname of the machine
Source
scope_name

Instrumentation scope name.

Identifies the library producing the logs. Defaults to "logit".

Source
scope_name=(scope_name : String)

Instrumentation scope name.

Identifies the library producing the logs. Defaults to "logit".

Source
scope_version

Instrumentation scope version.

Version of the instrumentation library. Defaults to Logit::VERSION.

Source
scope_version=(scope_version : String)

Instrumentation scope version.

Version of the instrumentation library. Defaults to Logit::VERSION.

Source
timeout

HTTP request timeout.

Applies to both connection and read timeouts. If the collector doesn't respond within this time, the batch is dropped.

Source
timeout=(timeout : Time::Span)

HTTP request timeout.

Applies to both connection and read timeouts. If the collector doesn't respond within this time, the batch is dropped.

Source