Documentation ¶
Overview ¶
Package kafka enables writing metric values to kafka.
Index ¶
- func FromFile(filename string) (result pstore.LimitedRecordWriter, err error)
- func IsTypeSupported(t types.Type) bool
- func LMMJSONPayload(r *pstore.Record, tenantId, apiKey string, slashesToUnderscores bool) map[string]interface{}
- func LMMSerialiseAsBytes(r *pstore.Record, tenantId, apiKey string, slashesToUnderscores bool) ([]byte, error)
- func LMMSerialiseAsReader(r *pstore.Record, tenantId, apiKey string, slashesToUnderscores bool) (io.Reader, error)
- func NewFakeWriter() pstore.LimitedRecordWriter
- func NewFakeWriterToPath(path string) (pstore.LimitedRecordWriter, error)
- func ToFloat64(r *pstore.Record) float64
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FromFile ¶
func FromFile(filename string) (result pstore.LimitedRecordWriter, err error)
FromFile creates a new writer from a configuration file.
func IsTypeSupported ¶
IsTypeSupported returns true if kafka supports the given metric type
func LMMJSONPayload ¶
func LMMJSONPayload( r *pstore.Record, tenantId, apiKey string, slashesToUnderscores bool) map[string]interface{}
LMMJSONPayload returns record as a JSON struct for lmm.
func LMMSerialiseAsBytes ¶
func LMMSerialiseAsBytes( r *pstore.Record, tenantId, apiKey string, slashesToUnderscores bool) ([]byte, error)
LMMSerialiseAsBytes serialises r into an LMM json payload. tenantId and apiKey are the LMM tenantId and API key respectively. The returned payload includes these as LMM expects them.
func LMMSerialiseAsReader ¶
func LMMSerialiseAsReader( r *pstore.Record, tenantId, apiKey string, slashesToUnderscores bool) (io.Reader, error)
LMMSerialiseAsReader works like LMMSerialiseAsBytes except that it returns the payload as an io.Reader. The payload itself is 100% buffered within the returned reader.
func NewFakeWriter ¶
func NewFakeWriter() pstore.LimitedRecordWriter
NewFakeWriter creates a new writer that dumps the JSON to stdout. The tenantId and apiKey are fake for security.
func NewFakeWriterToPath ¶
func NewFakeWriterToPath(path string) (pstore.LimitedRecordWriter, error)
NewFakeWriterToPath creates a new writer that dumps the JSON to a file with given path. The tenantId and apiKey are fake for security.
Types ¶
type Config ¶
type Config struct { // The KAFKA endpoints in "hostname:port" format. // At least one is required. Endpoints []string `yaml:"endpoints"` // The KAFKA topic. Required. Topic string `yaml:"topic"` // The KAFKA clientId. Required. ClientId string `yaml:"clientId"` // User credential. Required. TenantId string `yaml:"tenantId"` // User credential. Required. ApiKey string `yaml:"apiKey"` }
Config represents the configuration of kafka. Config implements yamlutil.Config