wireformat

package
v0.0.0-...-be26699 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2015 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package wireformat defines the format that will be used to send metric batches to the collector and receive updates.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EnvResponse

type EnvResponse struct {
	AcknowledgedBatches []string              `json:"acks,omitempty"`
	UnitStatuses        map[string]UnitStatus `json:"unit-statuses,omitempty"`
}

EnvResponse contains the response data relevant to a concrete environment.

type EnvironmentResponses

type EnvironmentResponses map[string]EnvResponse

func (EnvironmentResponses) Ack

func (e EnvironmentResponses) Ack(envUUID, batchUUID string)

Ack adds the specified the batch UUID to the list of acknowledged batches for the specified environment.

func (EnvironmentResponses) SetStatus

func (e EnvironmentResponses) SetStatus(envUUID, unitName, status, info string)

type Metric

type Metric struct {
	Key   string    `json:"key"`
	Value string    `json:"value"`
	Time  time.Time `json:"time"`
}

Metric represents a single Metric.

type MetricBatch

type MetricBatch struct {
	UUID        string    `json:"uuid"`
	EnvUUID     string    `json:"env-uuid"`
	UnitName    string    `json:"unit-name"`
	CharmUrl    string    `json:"charm-url"`
	Created     time.Time `json:"created"`
	Metrics     []Metric  `json:"metrics"`
	Credentials []byte    `json:"credentials"`
}

MetricBatch is a batch of metrics that will be sent to the metric collector

func ToWire

func ToWire(mb *state.MetricBatch) *MetricBatch

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

type Response

type Response struct {
	UUID           string               `json:"uuid"`
	EnvResponses   EnvironmentResponses `json:"env-responses"`
	NewGracePeriod time.Duration        `json:"new-grace-period"`
}

Response represents the response from the metrics collector.

type UnitStatus

type UnitStatus struct {
	Status string `json:"status"`
	Info   string `json:"info"`
}

Jump to

Keyboard shortcuts

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