phosphor

package module
v0.0.0-...-2833852 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2016 License: MIT Imports: 10 Imported by: 0

README

Go Client for Phosphor

Installation

Given this is an early release the API is currently in flux, and use of a package management tool is recommended.

go get github.com/mondough/phosphor-go

Documentation

API documentation is available on GoDoc

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrTimeout represents a timeout error while attempting to send
	ErrTimeout = errors.New("timeout queueing annotation")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Host string
	Port int

	// BufferSize is the number of events we hold in memory in the client
	// when these are being published asynchronously
	BufferSize int32

	// Sending settings
	SendTimeout   time.Duration
	MaxPacketSize int32
	// contains filtered or unexported fields
}

Config used by our client

func NewConfig

func NewConfig() *Config

NewConfig returns a Config with default settings initialized

func (*Config) Config

func (c *Config) Config() *Config

Config returns the config, so that Config satisfies the ConfigProvider interface. Note this returns a *clone* of the configuration to isolate readers from changes

func (*Config) Notify

func (c *Config) Notify() <-chan struct{}

Notify returns a channel which fires on configuration change.

In the case of a standard (static) Config type this returns a channel which will *never* fire, and *always* blocks, however this does satisfy the ConfigProvider interface and makes sense as the config never changes.

Other implementations which dynamically reload configuration can use this to trigger a configuration reload, and reinitialisation of the client while the program executes, during which traces will buffer up to the configured in memory buffer size

type ConfigProvider

type ConfigProvider interface {
	// Notify returns a channel which fires on config changes
	Notify() <-chan struct{}

	// Config returns the raw configuration
	Config() *Config
}

ConfigProvider returns configuration used by the client, and can notify a client when this changes

type Phosphor

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

Phosphor is a client which sends annotations to the phosphor server. This should be initialised with New() rather than directly

func New

func New(configProvider ConfigProvider) (*Phosphor, error)

New initialises and returns a Phosphor client This takes a config provider which can be a simple static config, or a more dynamic configuration loader which watches a remote config source

func (*Phosphor) Send

func (p *Phosphor) Send(a *phos.Annotation) error

Send an annotation to Phosphor

Jump to

Keyboard shortcuts

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