pulsar

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 9, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const AvroJSONDefaultSchema = `` /* 532-byte string literal not displayed */

Variables

This section is empty.

Functions

This section is empty.

Types

type Authentication

type Authentication pulsar.Authentication

func NewAuthenticationTLS

func NewAuthenticationTLS(certificatePath string, privateKeyPath string) Authentication

type AvroJSONSerializer

type AvroJSONSerializer struct {
	// contains filtered or unexported fields
}

AvroJSONSerializer represents a metrics serializer that writes Avro-JSON

func NewAvroJSONSerializer

func NewAvroJSONSerializer(r io.Reader) (*AvroJSONSerializer, error)

func (*AvroJSONSerializer) Marshal

func (a *AvroJSONSerializer) Marshal(s *Sample) ([]byte, error)

func (*AvroJSONSerializer) Unmarshal

func (a *AvroJSONSerializer) Unmarshal(data []byte) (*Sample, error)

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client allows sending batches of Prometheus samples to InfluxDB.

func NewClient

func NewClient(config Config) (*Client, error)

func (*Client) Close

func (c *Client) Close() error

func (*Client) InitConsumer

func (c *Client) InitConsumer() error

func (*Client) InitProducer

func (c *Client) InitProducer() error

func (*Client) Name

func (*Client) Name() string

Name identifies the client as a Pulsar client.

func (*Client) Receiver

func (c *Client) Receiver(ctx context.Context, sampleCh chan ReceivedSample) (done chan struct{}, err error)

Receiver watches the queue for relevant samples, unserializes them and sends via the sampleCh. A channel is returned itself, to wait for the work loop to finish

func (*Client) WithSerializer

func (c *Client) WithSerializer(s Serializer) *Client

func (*Client) Write

func (c *Client) Write(ctx context.Context, samples model.Samples) error

type ClientOptions

type ClientOptions pulsar.ClientOptions

type Config

type Config struct {
	ClientOptions
	Topic         string
	Logger        log.Logger
	ReplicaLabels []string
	Subscription  string
}

type JSONCompatSerializer

type JSONCompatSerializer struct {
}

JSONCompatSerializer represents the sample in the upstream model

func NewJSONCompatSerializer

func NewJSONCompatSerializer() *JSONCompatSerializer

func (*JSONCompatSerializer) Marshal

func (*JSONCompatSerializer) Marshal(s *Sample) ([]byte, error)

func (*JSONCompatSerializer) Unmarshal

func (*JSONCompatSerializer) Unmarshal(data []byte) (*Sample, error)

type JSONSerializer

type JSONSerializer struct {
}

JSONSerializer represents the sample in the upstream model

func NewJSONSerializer

func NewJSONSerializer() *JSONSerializer

func (*JSONSerializer) Marshal

func (*JSONSerializer) Marshal(s *Sample) ([]byte, error)

func (*JSONSerializer) Unmarshal

func (*JSONSerializer) Unmarshal(data []byte) (*Sample, error)

type ReceivedSample

type ReceivedSample struct {
	Sample  *model.Sample
	Context context.Context
	Ack     func() error
	Nack    func()
}

type Sample

type Sample struct {
	Value    model.SamplePair `json:"value"`
	Metric   model.Metric     `json:"metric,omitempty"`
	TenantID string           `json:"tenant_id,omitempty"`
}

func NewSample

func NewSample(s *model.Sample) *Sample

type Serializer

type Serializer interface {
	Marshal(*Sample) ([]byte, error)
	Unmarshal([]byte) (*Sample, error)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL