publisher

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2022 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package publisher manages the publishing of metrics.

Index

Constants

View Source
const (
	TypeStdout  = "stdout"
	TypeDatadog = "datadog"
)

Set of possible publisher types.

Variables

This section is empty.

Functions

This section is empty.

Types

type Collector

type Collector interface {
	Collect() (map[string]interface{}, error)
}

Collector defines a contract a collector must support so a consumer can retrieve metrics.

type Publish

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

Publish provides the ability to receive metrics on an interval.

func New

func New(log *zap.SugaredLogger, collector Collector, interval time.Duration, publisher ...Publisher) (*Publish, error)

New creates a Publish for consuming and publishing metrics.

func (*Publish) Stop

func (p *Publish) Stop()

Stop is used to shut down the goroutine collecting metrics.

type Publisher

type Publisher func(map[string]interface{})

Publisher defines a handler function that will be called on each interval.

type Stdout

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

Stdout provide our basic publishing.

func NewStdout

func NewStdout(log *zap.SugaredLogger) *Stdout

NewStdout initializes stdout for publishing metrics.

func (*Stdout) Publish

func (s *Stdout) Publish(data map[string]interface{})

Publish publishers for writing to stdout.

Directories

Path Synopsis
Package datadog provides support for publishing metrics to DD.
Package datadog provides support for publishing metrics to DD.
Package expvar manages the publishing of metrics to stdout.
Package expvar manages the publishing of metrics to stdout.

Jump to

Keyboard shortcuts

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