activity

package
v0.34.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDimsFromContext

func GetDimsFromContext(ctx context.Context) *[]attribute.KeyValue

func WithDims

func WithDims(ctx context.Context, dims ...attribute.KeyValue) context.Context

Types

type BufferedClientOptions

type BufferedClientOptions struct {
	Sink       Sink
	SinkPeriod time.Duration
	BufferSize int
	Logger     *zap.Logger
}

type Client

type Client interface {
	With(dims ...attribute.KeyValue) Client
	Emit(ctx context.Context, name string, value float64, dims ...attribute.KeyValue)
	Close() error
}

func NewBufferedClient

func NewBufferedClient(opts BufferedClientOptions) Client

func NewNoopClient

func NewNoopClient() Client

type ConsoleSink

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

func NewConsoleSink

func NewConsoleSink(logger *zap.Logger, level zapcore.Level) *ConsoleSink

NewConsoleSink might be used for a local run

func (*ConsoleSink) Close

func (s *ConsoleSink) Close() error

func (*ConsoleSink) Sink

func (s *ConsoleSink) Sink(_ context.Context, events []Event) error

type Event

type Event struct {
	Time  time.Time
	Name  string
	Value float64
	Dims  []attribute.KeyValue
}

func (*Event) Marshal

func (e *Event) Marshal() ([]byte, error)

type KafkaSink

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

KafkaSink sinks events to a Kafka cluster.

func NewKafkaSink

func NewKafkaSink(brokers, topic string) (*KafkaSink, error)

func (*KafkaSink) Close

func (s *KafkaSink) Close() error

func (*KafkaSink) Sink

func (s *KafkaSink) Sink(_ context.Context, events []Event) error

Sink doesn't wait till all events are delivered to Kafka

type NoopSink

type NoopSink struct{}

func NewNoopSink

func NewNoopSink() *NoopSink

func (*NoopSink) Close

func (n *NoopSink) Close() error

func (*NoopSink) Sink

func (n *NoopSink) Sink(_ context.Context, _ []Event) error

type Sink

type Sink interface {
	Sink(ctx context.Context, events []Event) error
	Close() error
}

Sink is used by a bufferedClient to flush collected Event-s.

Jump to

Keyboard shortcuts

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