Skip to content

Commit

Permalink
feat(openmeter): export new kafka collector (#902)
Browse files Browse the repository at this point in the history
  • Loading branch information
hekike authored May 14, 2024
1 parent 55ef0ab commit 0883f29
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions openmeter/ingest/kafkaingest/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import (
"log/slog"

"github.com/confluentinc/confluent-kafka-go/v2/kafka"
"go.opentelemetry.io/otel/metric"

"github.com/openmeterio/openmeter/internal/ingest/kafkaingest"
"github.com/openmeterio/openmeter/openmeter/ingest/kafkaingest/serializer"
)

// Collector is a receiver of events that handles sending those events to a downstream Kafka broker.
Expand All @@ -15,3 +17,12 @@ type Collector = kafkaingest.Collector
func KafkaProducerGroup(ctx context.Context, producer *kafka.Producer, logger *slog.Logger) (execute func() error, interrupt func(error)) {
return kafkaingest.KafkaProducerGroup(ctx, producer, logger)
}

func NewCollector(
producer *kafka.Producer,
serializer serializer.Serializer,
namespacedTopicTemplate string,
metricMeter metric.Meter,
) (*Collector, error) {
return kafkaingest.NewCollector(producer, serializer, namespacedTopicTemplate, metricMeter)
}

0 comments on commit 0883f29

Please sign in to comment.