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 ¶
var ServiceName = "tikr"
ServiceName is the OTLP resource service.name attribute. Set from main to match the configured telemetry service name.
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 ¶
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 ¶
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).