Documentation ¶
Index ¶
- func GetVersion() string
- func InitMetrics(addr string, logger *slog.Logger)
- func InitPG(cfg *DB) (*sqlx.DB, error)
- func InitSentry(dsn, ver string) error
- func InitSlog(cfg *Logger, version string, hook bool) *slog.Logger
- func NewSyncProducer(cfg *KafkaOutput) (sarama.SyncProducer, error)
- func PrepareMessage(topic string, message []byte) *sarama.ProducerMessage
- type Consumer
- type DB
- type KafkaInput
- type KafkaOutput
- type Logger
- type LoggerLevel
- type Monitoring
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetVersion ¶ added in v0.1.1
func GetVersion() string
GetVersion returns latest git hash of commit.
func InitMetrics ¶ added in v0.1.1
InitMetrics init metrics handler for Prometheus.
func InitSentry ¶ added in v0.1.1
InitSentry init Sentry client.
func NewSyncProducer ¶ added in v0.3.1
func NewSyncProducer(cfg *KafkaOutput) (sarama.SyncProducer, error)
NewSyncProducer create new Sarama sync Producer.
func PrepareMessage ¶ added in v0.3.2
func PrepareMessage(topic string, message []byte) *sarama.ProducerMessage
PrepareMessage prepare Kafka message for sending.
Types ¶
type Consumer ¶ added in v0.3.0
type Consumer struct {
// contains filtered or unexported fields
}
Consumer represent consumer group.
func NewConsumerGroup ¶ added in v0.3.0
func NewConsumerGroup(ctx context.Context, log *slog.Logger, cfg *KafkaInput, topics string) (*Consumer, error)
NewConsumerGroup constructor for creating consumer group.
func (*Consumer) Cleanup ¶ added in v0.3.0
func (c *Consumer) Cleanup(sarama.ConsumerGroupSession) error
Cleanup is run at the end of a session, once all ConsumeClaim goroutines have exited
func (*Consumer) ConsumeClaim ¶ added in v0.3.0
func (c *Consumer) ConsumeClaim(session sarama.ConsumerGroupSession, claim sarama.ConsumerGroupClaim) error
ConsumeClaim implements ConsumerGroupHandler interface.
type DB ¶ added in v0.2.0
type DB struct { Host string `yaml:"host" env:"HOST,required" valid:"required"` Port int `yaml:"host" env:"PORT,required" valid:"required"` User string `yaml:"user" env:"USER,required" valid:"required"` Password string `yaml:"password" env:"PASSWORD"` DBName string `yaml:"db_name" env:"DB_NAME,required" valid:"required"` Schema string `yaml:"schema" env:"SCHEMA"` MaxIdleConn int `yaml:"max_idle_conn" env:"MAX_IDLE_CONN, default=2"` MaxOpenConn int `yaml:"max_open_conn" env:"MAX_OPEN_CONN"` }
DB represent struct for DB connection.
type KafkaInput ¶ added in v0.3.0
type KafkaInput struct { ClientID string `yaml:"client_id" env:"CLIENT_ID,required" valid:"required"` Brokers string `yaml:"brokers" env:"BROKERS,required" valid:"required"` ConsumerGroup string `yaml:"consumer_group" env:"CONSUMER_GROUP,required" valid:"required"` OffsetOldest bool `yaml:"offset_latest" env:"OFFSET_OLDEST"` Verbose bool `yaml:"verbose" env:"VERBOSE"` }
KafkaInput represent consumer configuration.
type KafkaOutput ¶ added in v0.3.1
type KafkaOutput struct {
Brokers string `yaml:"brokers" env:"BROKERS,required" valid:"required"`
}
KafkaOutput represent consumer configuration.
type Logger ¶
type Logger struct { Level LoggerLevel `yaml:"level" env:"LEVEL,required" valid:"required"` Fmt string `yaml:"fmt" env:"FMT,default=json"` }
Logger represent configuration for any logger.
type LoggerLevel ¶
type LoggerLevel string
LoggerLevel log levels.
const ( LoggerLevelDebug LoggerLevel = "debug" LoggerLevelInfo LoggerLevel = "info" LoggerLevelWarn LoggerLevel = "warn" LoggerLevelError LoggerLevel = "error" )
type Monitoring ¶ added in v0.1.1
type Monitoring struct { SentryDSN string `yaml:"sentry_dsn" env:"SENTRY_DSN"` PromAddr string `yaml:"prom_addr" env:"PROM_ADDR"` }
Monitoring represent configuration for any monitoring.