model

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2020 License: Apache-2.0 Imports: 6 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildLabelsMap added in v0.6.0

func BuildLabelsMap(name, stat string) map[string]string

BuildLabelsMap initiates a labels map out of a given metric name and optionally histogram stat Exported for external usage (Kiali)

Types

type Aggregation

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

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"`
	StartCollapsed bool            `json:"startCollapsed"`
	ChartType      *string         `json:"chartType,omitempty"`
	Min            *int            `json:"min,omitempty"`
	Max            *int            `json:"max,omitempty"`
	Metrics        []*SampleStream `json:"metrics"`
	XAxis          *string         `json:"xAxis"`
	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

func (*Chart) FillHistogram added in v0.6.0

func (chart *Chart) FillHistogram(ref v1alpha1.MonitoringDashboardMetric, from prometheus.Histogram, conversionParams ConversionParams)

func (*Chart) FillMetric added in v0.6.0

func (chart *Chart) FillMetric(ref v1alpha1.MonitoringDashboardMetric, from prometheus.Metric, conversionParams ConversionParams)

type ConversionParams added in v0.6.1

type ConversionParams struct {
	Scale            float64
	SortLabel        string
	SortLabelParseAs string
	RemoveSortLabel  bool
}

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, initialLabels map[string]string, conversionParams ConversionParams) []*SampleStream

Jump to

Keyboard shortcuts

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