model

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FillHistogram added in v0.3.0

func FillHistogram(from prometheus.Histogram, scale float64, name string, chart *Chart)

func FillMetric added in v0.3.0

func FillMetric(from prometheus.Metric, scale float64, name string, chart *Chart)

Types

type Aggregation

type Aggregation struct {
	Label       string `json:"label"`
	DisplayName string `json:"displayName"`
}

Aggregation is the model representing label's allowed aggregation, transformed from aggregation in MonitoringDashboard k8s resource

func ConvertAggregations

func ConvertAggregations(from v1alpha1.MonitoringDashboardSpec) []Aggregation

ConvertAggregations converts a k8s aggregations (from MonitoringDashboard k8s resource) into this models aggregations Results are sorted by DisplayName

type Chart

type Chart struct {
	Name      string                     `json:"name"`
	Unit      string                     `json:"unit"`
	Spans     int                        `json:"spans"`
	ChartType *string                    `json:"chartType,omitempty"`
	Min       *int                       `json:"min,omitempty"`
	Max       *int                       `json:"max,omitempty"`
	Metric    []*SampleStream            `json:"metric"`
	Histogram map[string][]*SampleStream `json:"histogram"`
	Error     string                     `json:"error"`
}

Chart is the model representing a custom chart, transformed from charts in MonitoringDashboard k8s resource

func ConvertChart

func ConvertChart(from v1alpha1.MonitoringDashboardChart) Chart

ConvertChart converts a k8s chart (from MonitoringDashboard k8s resource) into this models chart

type DashboardQuery

type DashboardQuery struct {
	prometheus.MetricsQuery
	Namespace         string
	LabelsFilters     map[string]string
	AdditionalLabels  []Aggregation
	RawDataAggregator string
}

DashboardQuery holds query parameters for a dashboard query

func (*DashboardQuery) FillDefaults

func (q *DashboardQuery) FillDefaults()

FillDefaults fills the struct with default parameters

type DashboardRef

type DashboardRef struct {
	Template string `json:"template"`
	Title    string `json:"title"`
}

DashboardRef holds template name and title for a custom dashboard

type ExternalLink struct {
	URL       string                                            `json:"url"`
	Name      string                                            `json:"name"`
	Variables v1alpha1.MonitoringDashboardExternalLinkVariables `json:"variables"`
}

ExternalLink provides links to external dashboards (e.g. to Grafana)

type MonitoringDashboard

type MonitoringDashboard struct {
	Title         string         `json:"title"`
	Charts        []Chart        `json:"charts"`
	Aggregations  []Aggregation  `json:"aggregations"`
	ExternalLinks []ExternalLink `json:"externalLinks"`
}

MonitoringDashboard is the model representing custom monitoring dashboard, transformed from MonitoringDashboard k8s resource

type Pod

type Pod interface {
	GetAnnotations() map[string]string
}

Pod is a simple interface to get annotations

type Runtime

type Runtime struct {
	Name          string         `json:"name"`
	DashboardRefs []DashboardRef `json:"dashboardRefs"`
}

Runtime holds the runtime title and associated dashboard template(s)

type SamplePair

type SamplePair struct {
	Timestamp int64
	Value     float64
}

func (SamplePair) MarshalJSON

func (s SamplePair) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

type SampleStream

type SampleStream struct {
	LabelSet map[string]string `json:"labelSet"`
	Values   []SamplePair      `json:"values"`
}

func ConvertMatrix

func ConvertMatrix(from pmod.Matrix, scale float64) []*SampleStream

Jump to

Keyboard shortcuts

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