juju: github.com/juju/juju/apiserver/facades/agent/metricsender Index | Files | Directories

package metricsender

import "github.com/juju/juju/apiserver/facades/agent/metricsender"

Package metricsender contains functions for sending metrics from a controller to a remote metric collector.

Package metricsender contains functions for sending metrics from a controller to a remote metric collector.

Index

Package Files

metricsender.go nopsender.go sender.go stateinterface.go

func DefaultMaxBatchesPerSend Uses

func DefaultMaxBatchesPerSend() int

DefaultMaxBatchesPerSend returns the default number of batches per send.

func SendMetrics Uses

func SendMetrics(st ModelBackend, sender MetricSender, clock clock.Clock, batchSize int, transmitVendorMetrics bool) error

SendMetrics will send any unsent metrics over the MetricSender interface in batches no larger than batchSize.

func ToWire Uses

func ToWire(mb *state.MetricBatch, modelName string) *wireformat.MetricBatch

ToWire converts the state.MetricBatch into a type that can be sent over the wire to the collector.

type HTTPSender Uses

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

HTTPSender is the default used for sending metrics to the collector service.

func (*HTTPSender) Send Uses

func (s *HTTPSender) Send(metrics []*wireformat.MetricBatch) (*wireformat.Response, error)

Send sends the given metrics to the collector service.

type MetricSender Uses

type MetricSender interface {
    Send([]*wireformat.MetricBatch) (*wireformat.Response, error)
}

MetricSender defines the interface used to send metrics to a collection service.

type ModelBackend Uses

type ModelBackend interface {
    MetricsManager() (*state.MetricsManager, error)
    MetricsToSend(batchSize int) ([]*state.MetricBatch, error)
    SetMetricBatchesSent(batchUUIDs []string) error
    CountOfUnsentMetrics() (int, error)
    CountOfSentMetrics() (int, error)
    CleanupOldMetrics() error

    Name() string
    Unit(name string) (*state.Unit, error)
    ModelTag() names.ModelTag
    ModelConfig() (*config.Config, error)
    ControllerConfig() (controller.Config, error)
    SetModelMeterStatus(string, string) error
}

ModelBackend contains methods that are used by the metrics sender.

type NopSender Uses

type NopSender struct {
}

NopSender is a sender that acts like everything worked fine But doesn't do anything.

func (NopSender) Send Uses

func (n NopSender) Send(batches []*wireformat.MetricBatch) (*wireformat.Response, error)

Implement the send interface, act like everything is fine.

type SenderFactory Uses

type SenderFactory func(url string) MetricSender

func DefaultSenderFactory Uses

func DefaultSenderFactory() SenderFactory

DefaultSenderFactory returns the default sender factory.

Directories

PathSynopsis
testing

Package metricsender imports 12 packages (graph) and is imported by 4 packages. Updated 2019-08-23. Refresh now. Tools for package owners.