class Logit::Backend::OTLP::PayloadBuilder

Overview

Builds OTLP JSON payloads from Logit events.

Converts an array of events to the OTLP/HTTP JSON format for logs. Follows the OpenTelemetry Protocol specification: https://opentelemetry.io/docs/specs/otlp/

Defined in:

logit/backends/otlp/payload_builder.cr

Constant Summary

SEVERITY_MAP = {LogLevel::Trace => 1, LogLevel::Debug => 5, LogLevel::Info => 9, LogLevel::Warn => 13, LogLevel::Error => 17, LogLevel::Fatal => 21}

Maps Logit LogLevel to OTLP SeverityNumber. https://opentelemetry.io/docs/specs/otel/logs/data-model/#field-severitynumber

Constructors

Instance Method Summary

Constructor Detail

def self.new(resource_attributes : Hash(String, String), scope_name : String, scope_version : String) #

[View source]

Instance Method Detail

def build(events : Array(Event)) : String #

Builds an OTLP JSON payload from an array of events.

Returns a JSON string ready to be sent to an OTLP collector.


[View source]