Documentation ¶
Index ¶
- Constants
- Variables
- type Factory
- func (f *Factory) AddFlags(flagSet *flag.FlagSet)
- func (f *Factory) Close() error
- func (f *Factory) CreateWriter() (metricstore.Writer, error)
- func (f *Factory) InitFromOptions(o Options)
- func (f *Factory) InitFromViper(v *viper.Viper)
- func (f *Factory) Initialize(metricsFactory metrics.Factory, logger *zap.Logger) error
- type JSONUnmarshaller
- type Marshaller
- type Options
- type ProtobufUnmarshaller
- type Unmarshaller
- type Writer
- type WriterMetrics
Constants ¶
View Source
const ( // EncodingJSON is used for timeseries encoded as Protobuf-based JSON. EncodingJSON = "json" // EncodingProto is used for timeseries encoded as Protobuf. EncodingProto = "protobuf" )
Variables ¶
View Source
var ( // AllEncodings is a list of all supported encodings. AllEncodings = []string{EncodingJSON, EncodingProto} )
Functions ¶
This section is empty.
Types ¶
type Factory ¶
Factory implements storage.Factory and creates write-only storage components backed by kafka.
func (*Factory) CreateWriter ¶
func (f *Factory) CreateWriter() (metricstore.Writer, error)
func (*Factory) InitFromOptions ¶
InitFromOptions initializes factory from options.
func (*Factory) InitFromViper ¶
InitFromViper implements plugin.Configurable
type JSONUnmarshaller ¶
type JSONUnmarshaller struct{}
JSONUnmarshaller implements Unmarshaller
func NewJSONUnmarshaller ¶
func NewJSONUnmarshaller() *JSONUnmarshaller
NewJSONUnmarshaller constructs a JSONUnmarshaller
func (*JSONUnmarshaller) Unmarshal ¶
func (J *JSONUnmarshaller) Unmarshal(msg []byte) ([]prompb.TimeSeries, error)
type Marshaller ¶
type Marshaller interface {
MarshalMetric([]prompb.TimeSeries) ([]byte, error)
}
Marshaller encodes a metric into a byte array to be sent to Kafka
type Options ¶
type Options struct { Config producer.Configuration `mapstructure:",squash"` Topic string `mapstructure:"topic"` Encoding string `mapstructure:"encoding"` }
Options stores the configuration options for Kafka
func (*Options) InitFromViper ¶
InitFromViper initializes Options with properties from viper
type ProtobufUnmarshaller ¶
type ProtobufUnmarshaller struct{}
ProtobufUnmarshaller implements Unmarshaller
func NewProtobufUnmarshaller ¶
func NewProtobufUnmarshaller() *ProtobufUnmarshaller
NewProtobufUnmarshaller constructs a ProtobufUnmarshaller
func (*ProtobufUnmarshaller) Unmarshal ¶
func (p *ProtobufUnmarshaller) Unmarshal(msg []byte) ([]prompb.TimeSeries, error)
type Unmarshaller ¶
type Unmarshaller interface {
Unmarshal([]byte) ([]prompb.TimeSeries, error)
}
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer writes metric to kafka. Implements metricstore.Writer
func NewMetricWriter ¶
func NewMetricWriter( producer sarama.AsyncProducer, marshaller Marshaller, topic string, factory metrics.Factory, logger *zap.Logger, ) *Writer
func (*Writer) WriteMetric ¶
func (w *Writer) WriteMetric(ts []prompb.TimeSeries) error
WriteMetric writes the time series to kafka.
Click to show internal directories.
Click to hide internal directories.