domain

package
v0.0.0-...-1c5d739 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2023 License: Apache-2.0 Imports: 11 Imported by: 27

Documentation

Overview

Package domain contains graph config data objects for all domain objects

Package domain defines the monitoring profiles for control center domain objects

Package domain defines the threshold configurations in a monitoring profile

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command struct {
	Command         string
	Description     string
	CommitOnSuccess bool
}

type DataPoint

type DataPoint struct {
	Aggregator   string                `json:"aggregator"`
	Color        string                `json:"color"`
	Expression   string                `json:"expression"`
	Fill         bool                  `json:"fill"`
	Format       string                `json:"format"`
	Legend       string                `json:"legend"`
	Metric       string                `json:"metric"`       //the metric id inside the metric config (defined by metric source)
	MetricSource string                `json:"metricSource"` //the metric config id in the monitoring profile
	ID           string                `json:"id"`
	Name         string                `json:"name"`
	Rate         bool                  `json:"rate"`
	RateOptions  *DataPointRateOptions `json:"rateOptions"`
	Type         string                `json:"type"`
}

DataPoint defines a datum to be plotted within a graph

func (*DataPoint) Equals

func (point *DataPoint) Equals(that *DataPoint) bool

Equals returns if point equals that point

type DataPointRateOptions

type DataPointRateOptions struct {
	Counter        bool  `json:"counter"`
	CounterMax     int64 `json:"counterMax"`
	ResetThreshold int64 `json:"resetThreshold"`
}

DataPointRateOptions define the rate options for a data point

func (DataPointRateOptions) MarshalJSON

func (d DataPointRateOptions) MarshalJSON() ([]byte, error)

func (*DataPointRateOptions) UnmarshalJSON

func (d *DataPointRateOptions) UnmarshalJSON(data []byte) error

type DurationThreshold

type DurationThreshold struct {
	Min        *int64        //min threshold value, null for no min
	Max        *int64        //max threshold value, null for no max
	TimePeriod time.Duration //a timePeriod (window) that triggers the threshold
	Percentage int           //Percentage of violations to trigger an event: a number from 0 (any violation triggers an event) to 100 (all values must violate the threshold)
}

DurationThreshold tiggers events when a percentage of min/max thresholds are breached in a given time perion

func (DurationThreshold) MarshalJSON

func (t DurationThreshold) MarshalJSON() ([]byte, error)

func (*DurationThreshold) UnmarshalJSON

func (t *DurationThreshold) UnmarshalJSON(data []byte) error

type GraphConfig

type GraphConfig struct {
	ID          string              `json:"id"`
	Name        string              `json:"name"`
	Footer      bool                `json:"footer"`
	Format      string              `json:"format"`
	ReturnSet   string              `json:"returnset"`
	Type        string              `json:"type"`
	Tags        map[string][]string `json:"tags"`
	MinY        *int                `json:"miny"`
	MaxY        *int                `json:"maxy"`
	YAxisLabel  string              `json:"yAxisLabel"`
	TimeZone    string              `json:"timezone,omitempty"`
	DownSample  string              `json:"downsample,omitempty"`
	Description string              `json:"description"`
	Range       *GraphConfigRange   `json:"range"`
	DataPoints  []DataPoint         `json:"datapoints"`
	BuiltIn     bool                `json:"builtin"`
	Units       string              `json:"units"`
	Base        int                 `json:"base"`
}

GraphConfig defines a graph for display using central query's

func (*GraphConfig) Equals

func (graph *GraphConfig) Equals(that *GraphConfig) bool

Equals returns if graph equals that graph

func (GraphConfig) ValidEntity

func (graph GraphConfig) ValidEntity() error

ValidEntity ensures that no graph configs have an id with prefix "internal"

type GraphConfigRange

type GraphConfigRange struct {
	Start string `json:"start"`
	End   string `json:"end"`
}

GraphConfigRange defines the X-Axis for a graph

type HealthCheck

type HealthCheck struct {
	Script   string        // A script to execute to verify the health of a service.
	Interval time.Duration // The interval at which to execute the script.
	Timeout  time.Duration // A timeout in which to complete the health check.
}

HealthCheck is a health check object

func (HealthCheck) MarshalJSON

func (hc HealthCheck) MarshalJSON() ([]byte, error)

func (*HealthCheck) UnmarshalJSON

func (hc *HealthCheck) UnmarshalJSON(data []byte) error

type HealthCheckResult

type HealthCheckResult struct {
	ServiceID  string
	InstanceID string
	Name       string
	Timestamp  string
	Passed     string
}

HealthCheckResult is used internally to record the results for checking the the health of a single, regular service.

func (*HealthCheckResult) ValidEntity

func (h *HealthCheckResult) ValidEntity() error

type HealthCheckStatus

type HealthCheckStatus struct {
	Name      string  // the name of the healthcheck
	Status    string  // "passed", "failed",  "stopped", etc
	Timestamp int64   // The last time the healthcheck was performed.
	Interval  float64 // The interval at which the healthcheck was run
	StartedAt int64   // The time when the service was started.
	Failure   string  // Contains details of the failure in cases of Status="failed"
}

HealthCheckStatus is the external facing information about the results of running a health check. This type is shared by both internal servcies and regular services.

type HoltWintersThreshold

type HoltWintersThreshold struct {
	Alpha  float64 //A number from 0 to 1 that controls how quickly the model adapts to unexpected values
	Beta   float64 //A number from 0 to 1 that controls how quicly the model adapts to changes in unexpected rates changes.
	Rows   int64   //The number of points to use for predictive purposes
	Season int64   //The number of primary data points in a season.  Note that Rows must be at least as large as Season
}

HoltWintersThreshold adds the ability to fire threshold events when a device exceeds cyclical predicted values

type HostIPAndPort

type HostIPAndPort struct {
	HostIP   string
	HostPort string
}

type Metric

type Metric struct {
	ID          string //id is a unique idenitifier for the metric
	Name        string //name is a canonical name for the metric
	Description string //description of this metric
	Counter     bool   // Counter is true if this metric is a constantly incrementing measure
	CounterMax  *int64 `json:"CounterMax,omitempty"`
	ResetValue  int64  // If metric is a counter, ResetValue is the maximum counter value before a rollover occurs
	Unit        string // Unit of measure for metric
	BuiltIn     bool   // is this metric supplied by the serviced runtime?
}

Metric defines the meta-data for a single metric

type MetricBuilder

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

MetricBuilder aggregates a url, method, and metrics for building a MetricConfig

func NewMetricConfigBuilder

func NewMetricConfigBuilder(RequestURI, Method string) (*MetricBuilder, error)

NewMetricConfigBuilder creates a factory to create MetricConfig instances.

func (*MetricBuilder) Config

func (builder *MetricBuilder) Config(ID, Name, Description, Start string) (*MetricConfig, error)

Config builds a MetricConfig using all defined MetricRequests and resets the metrics requets

func (*MetricBuilder) Metric

func (builder *MetricBuilder) Metric(metric Metric) *MetricMetricBuilder

Metric appends a metric configuration to the MetricBuilder

type MetricConfig

type MetricConfig struct {
	ID          string      // a unique identifier for the metrics
	Name        string      // a canonical name for the metrics
	Description string      // a description of the metrics
	Query       QueryConfig // the http query to request metrics
	Metrics     []Metric    // meta-data describing all metrics
}

MetricConfig defines a collection of metrics and the query to request said metrics

func (*MetricConfig) Equals

func (config *MetricConfig) Equals(that *MetricConfig) bool

Equals equality test for MetricConfig

func (MetricConfig) ValidEntity

func (config MetricConfig) ValidEntity() error

ValidEntity ensures the metric config is not named "metrics"

type MetricMetricBuilder

type MetricMetricBuilder struct {
	Metric
	Tags map[string][]string //tags required for querying a metric
}

MetricMetricBuilder contains data to build the MetricConfig.Metrics and QueryConfig.Data

func (*MetricMetricBuilder) SetTag

func (request *MetricMetricBuilder) SetTag(Name string, Values ...string) *MetricMetricBuilder

SetTag puts a tag into the metric request object

func (*MetricMetricBuilder) SetTags

func (request *MetricMetricBuilder) SetTags(tags map[string][]string) *MetricMetricBuilder

SetTags sets tags to value

type MinMax

type MinMax struct {
	Min     int
	Max     int
	Default int
}

func (*MinMax) Validate

func (minmax *MinMax) Validate() error

Validate ensure that the values in min max are valid. Max >= Min >=0 returns error otherwise

type MinMaxThreshold

type MinMaxThreshold struct {
	Min string //min threshold value
	Max string //max threshold value
}

MinMaxThreshold triggers events when a metric breaches either min or max threshold value

type MonitorProfile

type MonitorProfile struct {
	MetricConfigs    []MetricConfig    //metrics for domain object
	GraphConfigs     []GraphConfig     //graphs for a domain object
	ThresholdConfigs []ThresholdConfig //thresholds for a domain object
}

MonitorProfile describes metrics, thresholds and graphs to monitor an object's performance

func (*MonitorProfile) Equals

func (profile *MonitorProfile) Equals(that *MonitorProfile) bool

Equals equality test for MonitorProfile

func (*MonitorProfile) ReBuild

func (profile *MonitorProfile) ReBuild(timeSpan string, tags map[string][]string) (*MonitorProfile, error)

ReBuild metrics, graphs and thresholds with the new tags, also set graphs units based on datapoints

func (MonitorProfile) ValidEntity

func (profile MonitorProfile) ValidEntity() error

ValidEntity ensures the monitor profile is valid before it is written to the database.

type Prereq

type Prereq struct {
	Name   string
	Script string
}

type QueryConfig

type QueryConfig struct {
	RequestURI string      // the http request uri for grabbing metrics
	Method     string      // the http method to retrieve metrics
	Headers    http.Header // http headers required to make request
	Data       string      // the http request body to request metrics
}

QueryConfig defines the parameters to request a collection of metrics

func (*QueryConfig) Equals

func (config *QueryConfig) Equals(that *QueryConfig) bool

Equals compares two QueryConfig objects for equality

type ThresholdConfig

type ThresholdConfig struct {
	ID          string //a unique id for thresholds
	Name        string //canonical name of threshold
	Type        string //type of threshold (MinMax, Duration, ValueChange, or HoltWinters)
	Description string //description of threshold
	AppliedTo   int    //how should this threshold be applied 0=everything, 1=services only, 2=running services only

	MetricSource string                 //id of the MetricConfig this is applied to
	DataPoints   []string               //List of metrics within a MetricConfig this is applied to
	Threshold    interface{}            // threshold data (either MinMaxThreshold, DurationThreshold, HoltWintersThreshold)
	EventTags    map[string]interface{} //all relevant event data
}

ThresholdConfig defines all meta-data for a threshold on a metric with in a monitoring profile

func (*ThresholdConfig) Equals

func (config *ThresholdConfig) Equals(that *ThresholdConfig) bool

Equals compares two threshold configs for equality

Jump to

Keyboard shortcuts

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