config

package
v0.0.0-...-61e9026 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2023 License: Apache-2.0 Imports: 9 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddLabels

type AddLabels struct {
	OmitEmpty bool              `json:"omitEmpty"`
	Labels    map[string]string `json:"labels"`
}

func (*AddLabels) IncludedLabels

func (f *AddLabels) IncludedLabels() map[string]string

IncludedLabels returns the labels that should be added to input. Empty label values are omitted if OmitEmpty is true.

func (*AddLabels) Validate

func (f *AddLabels) Validate(c *Config) error

type Aggregation

type Aggregation struct {
	// The number of seconds that metrics should be aggregated prior to forwarding
	BufferSeconds int64 `json:"bufferSeconds"`
}

func (*Aggregation) Validate

func (rm *Aggregation) Validate(m *Metric, c *Config) error

type Config

type Config struct {
	Identities Identities `json:"identities"`
	Metrics    Metrics    `json:"metrics"`
	Endpoints  Endpoints  `json:"endpoints"`
	Sources    Sources    `json:"sources"`
	Filters    Filters    `json:"filters"`
}

Config contains configuration for the agent.

func Load

func Load(path string) (*Config, error)

func Parse

func Parse(data []byte) (*Config, error)

func (*Config) Validate

func (c *Config) Validate() error

type DiskEndpoint

type DiskEndpoint struct {
	ReportDir     string `json:"reportDir"`
	ExpireSeconds int64  `json:"expireSeconds"`
}

func (*DiskEndpoint) Validate

func (e *DiskEndpoint) Validate(c *Config) error

type EncodedServiceAccountKey

type EncodedServiceAccountKey []byte

EncodedServiceAccountKey is a byte array type that can hold a base64-encoded json structure. It validates that its value is valid base64-encoded json upon parsing. Upon parsing, the contents of the byte array will be the json text after base64 decoding is performed.

func (*EncodedServiceAccountKey) UnmarshalJSON

func (k *EncodedServiceAccountKey) UnmarshalJSON(data []byte) error

UnmarshalJSON sets *m to a copy of data.

type Endpoint

type Endpoint struct {
	Name           string                  `json:"name"`
	Disk           *DiskEndpoint           `json:"disk"`
	ServiceControl *ServiceControlEndpoint `json:"servicecontrol"`
	PubSub         *PubSubEndpoint         `json:"pubsub"`
}

Endpoint describes a single remote endpoint used for sending aggregated metrics.

func (*Endpoint) Validate

func (e *Endpoint) Validate(c *Config) error

type Endpoints

type Endpoints []Endpoint

Type Endpoints is a Validatable collection of Endpoint objects.

func (Endpoints) Validate

func (endpoints Endpoints) Validate(c *Config) error

type Filter

type Filter struct {
	// oneof
	AddLabels *AddLabels `json:"addLabels"`
}

func (*Filter) Validate

func (f *Filter) Validate(c *Config) error

type Filters

type Filters []Filter

func (Filters) Validate

func (m Filters) Validate(c *Config) error

type GCPIdentity

type GCPIdentity struct {
	ServiceAccountKey        *LiteralServiceAccountKey `json:"serviceAccountKey"`
	EncodedServiceAccountKey *EncodedServiceAccountKey `json:"encodedServiceAccountKey"`
}

GCPIdentity holds configuration for identifying to Google Cloud Platform services.

func (*GCPIdentity) GetServiceAccountKey

func (c *GCPIdentity) GetServiceAccountKey() []byte

func (*GCPIdentity) Validate

func (i *GCPIdentity) Validate(c *Config) error

type Heartbeat

type Heartbeat struct {
	Metric          string              `json:"metric"`
	IntervalSeconds int64               `json:"intervalSeconds"`
	Value           metrics.MetricValue `json:"value"`
	Labels          map[string]string   `json:"labels"`
}

func (*Heartbeat) Validate

func (h *Heartbeat) Validate(c *Config) error

type Identities

type Identities []Identity

Type Identities is a Validatable collection of Identity objects.

func (Identities) Get

func (identities Identities) Get(name string) *Identity

func (Identities) Validate

func (identities Identities) Validate(c *Config) error

type Identity

type Identity struct {
	Name string       `json:"name"`
	GCP  *GCPIdentity `json:"gcp"`
}

func (*Identity) Validate

func (i *Identity) Validate(c *Config) error

type LiteralServiceAccountKey

type LiteralServiceAccountKey []byte

LiteralServiceAccountKey is a byte array type that can hold a literal json structure. It validates that its value is valid json upon parsing. After parsing, the contents of the byte array will be the original json text.

func (*LiteralServiceAccountKey) UnmarshalJSON

func (k *LiteralServiceAccountKey) UnmarshalJSON(data []byte) error

type Metric

type Metric struct {
	metrics.Definition `json:",inline"`
	Endpoints          []MetricEndpoint `json:"endpoints"`

	// oneof - buffering configuration
	Aggregation *Aggregation `json:"aggregation"`
	Passthrough *Passthrough `json:"passthrough"`
}

func (*Metric) Validate

func (m *Metric) Validate(c *Config) error

type MetricEndpoint

type MetricEndpoint struct {
	Name string `json:"name"`
}

type Metrics

type Metrics []Metric

func (Metrics) GetMetricDefinition

func (m Metrics) GetMetricDefinition(name string) *metrics.Definition

GetMetricDefinition returns the metrics.Definition with the given name, or nil if it does not exist.

func (Metrics) Validate

func (m Metrics) Validate(c *Config) error

Validate checks validity of metric configuration. Specifically, it must not contain duplicate metric definitions, and metric definitions must specify valid type names.

type Passthrough

type Passthrough struct {
}

func (*Passthrough) Validate

func (rm *Passthrough) Validate(m *Metric, c *Config) error

type PubSubEndpoint

type PubSubEndpoint struct {
	Identity string `json:"identity"`
	Topic    string `json:"topic"`
}

func (*PubSubEndpoint) Validate

func (e *PubSubEndpoint) Validate(c *Config) error

type ServiceControlEndpoint

type ServiceControlEndpoint struct {
	Identity    string `json:"identity"`
	ServiceName string `json:"serviceName"`
	ConsumerId  string `json:"consumerId"`
}

func (*ServiceControlEndpoint) Validate

func (e *ServiceControlEndpoint) Validate(c *Config) error

type Source

type Source struct {
	Name string `json:"name"`

	// oneof
	Heartbeat *Heartbeat `json:"heartbeat"`
}

func (*Source) Validate

func (s *Source) Validate(c *Config) error

type Sources

type Sources []Source

func (Sources) Validate

func (m Sources) Validate(c *Config) error

type Validatable

type Validatable interface {
	Validate(*Config) error
}

Validation

Jump to

Keyboard shortcuts

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