metrics

package
v1.9.1-dev-migrate-dop... Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Aggregator

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

Aggregator reads PublishMetrics from a channel and distributes them to the configured Destinations.

func NewAggregator

func NewAggregator(inputChannel chan PublishMetric, publishMetricDestinations, capabilityMetricDestinations []Destination, log *logger.UPPLogger) *Aggregator

NewAggregator returns an Aggregator which reads metrics from inputChannel and distributes them to destinations.

func (*Aggregator) Run

func (a *Aggregator) Run()

Run reads PublishMetrics from a channel and distributes them to a list of Destinations. Stops reading when the channel is closed.

type Destination

type Destination interface {
	Send(pm PublishMetric)
}

Destination is the interface which defines a method to send PublishMetrics to a certain destination.

type GraphiteSender added in v1.1.0

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

GraphiteSender implements Destination interface to send PublishMetrics for capability E2E tests to Graphite.

func NewGraphiteSender added in v1.1.0

func NewGraphiteSender(cfg *config.AppConfig, log *logger.UPPLogger) *GraphiteSender

NewGraphiteSender returns a GraphiteSender.

func (*GraphiteSender) Send added in v1.1.0

func (gs *GraphiteSender) Send(pm PublishMetric)

Send transforms a Publish metric to Graphite one and sends it to Graphite endpoint.

type History

type History struct {
	PublishMetrics []PublishMetric
	// contains filtered or unexported fields
}

func NewHistory

func NewHistory(metrics []PublishMetric) *History

func (*History) First

func (h *History) First() *PublishMetric

func (*History) GetFailures

func (h *History) GetFailures() map[string]struct{}

func (*History) Len

func (h *History) Len() int

func (*History) String

func (h *History) String() string

func (*History) Update

func (h *History) Update(newPublishResult PublishMetric)

type Interval

type Interval struct {
	LowerBound int
	UpperBound int
}

Interval is a simple representation of an interval of time, with a lower and upper boundary

type PublishMetric

type PublishMetric struct {
	UUID            string
	PublishOK       bool      //did it meet the SLA?
	PublishDate     time.Time //the time WE get the message
	Platform        string
	PublishInterval Interval //the interval it was actually published in, ex. (10,20)
	Config          config.MetricConfig
	Endpoint        url.URL
	TID             string
	IsMarkedDeleted bool
	Capability      *config.Capability
}

PublishMetric holds the information about the metric we are measuring.

func (PublishMetric) String

func (pm PublishMetric) String() string

type SplunkFeeder

type SplunkFeeder struct {
	MetricLog *log.Logger
}

SplunkFeeder implements Destination interface to send PublishMetrics to Splunk. This is achieved by writing the metric into a file which is indexed by Splunk.

func NewSplunkFeeder

func NewSplunkFeeder(logPrefix string) *SplunkFeeder

NewSplunkFeeder returns a SplunkFeeder which will write the PublishMetrics to the file at filePath. If the file exists, it will be appended to.

func (SplunkFeeder) Send

func (sf SplunkFeeder) Send(pm PublishMetric)

Send logs pm into a file.

Jump to

Keyboard shortcuts

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