telemetry

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConnectionEventType = "nimona.io/telemetry/connection"
)
View Source
const (
	ObjectEventType = "nimona.io/telemetry/object"
)

Variables

View Source
var DefaultClient *metrics
View Source
var ErrStorageInit = errors.New("Error initializing storage")

ErrStorageInit is returned when a storage backend fails to initialize

Functions

func NewTelemetry

func NewTelemetry(exchange Exchanger, localPeer *crypto.PrivateKey,
	statsAddress string) error

func SendEvent

func SendEvent(ctx context.Context, event Collectable) error

Types

type Collectable

type Collectable interface {
	Collection() string
	Measurements() map[string]interface{}
	ToObject() *object.Object
}

Collectable for metric events

type Collector

type Collector interface {
	Collect(Collectable) error
}

Collector interface for collecting metrics

var DefaultCollector Collector

DefaultCollector for holding a global collector

type ConnectionEvent

type ConnectionEvent struct {
	// Event attributes
	Direction string `json:"direction"`
}

ConnectionEvent for reporting connection info

func (*ConnectionEvent) Collection

func (ce *ConnectionEvent) Collection() string

Collection returns the string representation of the structure

func (*ConnectionEvent) FromObject

func (s *ConnectionEvent) FromObject(o *object.Object) error

FromObject populates the struct from a f12n object

func (ConnectionEvent) GetType

func (s ConnectionEvent) GetType() string

GetType returns the object's type

func (*ConnectionEvent) Measurements

func (ce *ConnectionEvent) Measurements() map[string]interface{}

Measurements returns a map with all the metrics for the event

func (ConnectionEvent) ToObject

func (s ConnectionEvent) ToObject() *object.Object

ToObject returns a f12n object

type Exchanger

type Exchanger interface {
	Send(ctx context.Context, o *object.Object, address string) error
	Handle(contentType string, h func(o *object.Object) error) (func(), error)
}

type ObjectEvent

type ObjectEvent struct {
	// Event attributes
	Direction   string `json:"direction"`
	ContentType string `json:"contentType"`
	ObjectSize  int    `json:"size"`
}

ObjectEvent for reporting object metrics

func (*ObjectEvent) Collection

func (ee *ObjectEvent) Collection() string

Collection returns the string representation of the structure

func (*ObjectEvent) FromObject

func (s *ObjectEvent) FromObject(o *object.Object) error

FromObject populates the struct from a f12n object

func (ObjectEvent) GetType

func (s ObjectEvent) GetType() string

GetType returns the object's type

func (*ObjectEvent) Measurements

func (ee *ObjectEvent) Measurements() map[string]interface{}

Measurements returns a map with all the metrics for the event

func (ObjectEvent) ToObject

func (s ObjectEvent) ToObject() *object.Object

ToObject returns a f12n object

Jump to

Keyboard shortcuts

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