output

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 4, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package output implements the Kafka producer that pushes rolled-up bars to configured topics. It supports protobuf and JSON encoding with fire-and-forget delivery semantics.

Index

Constants

This section is empty.

Variables

View Source
var ServiceName = "tikr"

ServiceName is the OTLP resource service.name attribute. Set from main to match the configured telemetry service name.

View Source
var Version = "dev"

Version is the instrumentation scope version used in OTLP output. Set from main via ldflags to keep it in sync with the binary version.

Functions

func BarToOTLP

func BarToOTLP(bar *core.Bar) ([]byte, error)

BarToOTLP converts a rolled-up bar into OTLP protobuf bytes.

Each metric in the bar (open, high, low, close, volume, etc.) becomes a separate Gauge metric with the bar's dimensions as attributes. This makes the output consumable by any OTel-compatible backend (Grafana, Datadog, ClickHouse, etc.) without custom deserializers.

Types

type KafkaProducer

type KafkaProducer struct {
	// contains filtered or unexported fields
}

KafkaProducer pushes rolled-up bars to Kafka topics. It implements the agg.BarHook interface.

func NewKafkaProducer

func NewKafkaProducer(brokers []string, specs []*core.SeriesSpec, m *telemetry.Metrics) (*KafkaProducer, error)

NewKafkaProducer creates a Kafka writer per series topic. Each writer is configured for async, fire-and-forget delivery. Pass nil for metrics if OTel instrumentation is not needed.

func (*KafkaProducer) Close

func (kp *KafkaProducer) Close() error

Close shuts down all Kafka writers.

func (*KafkaProducer) OnBarFlushed

func (kp *KafkaProducer) OnBarFlushed(ctx context.Context, bar *core.Bar) error

OnBarFlushed encodes a Bar as OTLP protobuf and publishes it to Kafka. On any error the bar is dropped and the error is logged (fire-and-forget).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL