Version: v0.1.33 Latest Latest

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

Go to latest
Published: Dec 19, 2022 License: MIT Imports: 25 Imported by: 2




View Source
const (
	DefaultTCPPort = 12355
	DefaultWSPort  = 80

The default ports that metricsdb listens on.


View Source
var ErrNilConfiguration = errors.New("illegal nil configuration data")

ErrNilConfiguration indicates validation failure.


func AreEqual added in v0.1.27

func AreEqual(c *ClientConfig, d *ClientConfig) bool

AreEqual returns true iff the two configurations are equal.


type Client

type Client struct {
	// contains filtered or unexported fields

Client is the client-view of the server.

func NewClient

func NewClient(ctx context.Context, cfg *ClientConfig) (*Client, error)

NewClient returns a new client-view of the server specified by the configuration cfg.

func (*Client) Submit

func (c *Client) Submit(ctx context.Context, p *metrics.Point) (err error)

Submit submits the given point.

func (*Client) SubmitPoints

func (c *Client) SubmitPoints(ctx context.Context, itr metrics.PointIterator) (err error)

SubmitPoints submits the points in the given iterator.

func (*Client) SubmitSlice

func (c *Client) SubmitSlice(ctx context.Context, ps []*metrics.Point) (err error)

SubmitSlice submits the given slice of points.

type ClientConfig

type ClientConfig struct {
	Address     *address.Address // The address to connect to
	SSLDisabled bool             // Disable SSL?
	SSLCert     []byte           // The SSL certificate (if any)

ClientConfig describes the configuration options we allow a user to set on a client connection.

func DefaultConfig

func DefaultConfig() *ClientConfig

DefaultConfig returns a new client configuration initialised with the default values.

The initial default value for the host and port will be read from the environment variable

PCAS_METRICS_ADDRESS = "hostname[:port]" or "ws://host/path"

on package init.

func SetDefaultConfig

func SetDefaultConfig(c *ClientConfig) *ClientConfig

SetDefaultConfig sets the default client configuration to c and returns the old default configuration. This change will be reflected in future calls to DefaultConfig.

func (*ClientConfig) Copy

func (c *ClientConfig) Copy() *ClientConfig

Copy returns a copy of the configuration.

func (*ClientConfig) Hash added in v0.1.27

func (c *ClientConfig) Hash() uint32

Hash returns a hash for the configuration.

func (*ClientConfig) URI

func (c *ClientConfig) URI() string

URI returns the URI connection string.

Note that the returned string may differ slightly from the value returned c.Address.URI(). For example, if c.Address omits a port number, an appropriate default port number is used here.

func (*ClientConfig) Validate

func (c *ClientConfig) Validate() error

Validate validates the client configuration, returning an error if there's a problem.

type Option

type Option interface {
	// contains filtered or unexported methods

Option sets options on a server.

func Metrics

func Metrics(m metrics.Interface) Option

Metrics is the metrics endpoint to which metrics data will be forwarded.

func SSLCertAndKey

func SSLCertAndKey(crt []byte, key []byte) Option

SSLCertAndKey adds the given SSL public certificate and private key to the server.

type Server

type Server struct {

Server handles client communication.

func NewServer

func NewServer(options ...Option) (*Server, error)

NewServer returns a new metricsdb server.


Path Synopsis
Package metricsdbflag provides a standard flag set for configuring the metrics package and starting metrics collection.
Package metricsdbflag provides a standard flag set for configuring the metrics package and starting metrics collection.

Jump to

Keyboard shortcuts

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