Documentation ¶
Index ¶
- Constants
- type ClusterOption
- type ComponentOption
- type ContainerOption
- type Interface
- type Level
- type Metadata
- type Metric
- type MetricData
- type MetricValue
- type NamespaceOption
- type NodeOption
- type Options
- type PVCOption
- type PodOption
- type Point
- type QueryOption
- type QueryOptions
- type WorkloadOption
- type WorkspaceOption
Constants ¶
View Source
const ( LevelCluster = 1 << iota LevelNode LevelWorkspace LevelNamespace LevelWorkload LevelPod LevelContainer LevelPVC LevelComponent )
View Source
const ( MetricTypeMatrix = "matrix" MetricTypeVector = "vector" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClusterOption ¶
type ClusterOption struct{}
func (ClusterOption) Apply ¶
func (_ ClusterOption) Apply(o *QueryOptions)
type ComponentOption ¶
type ComponentOption struct{}
func (ComponentOption) Apply ¶
func (_ ComponentOption) Apply(o *QueryOptions)
type ContainerOption ¶
type ContainerOption struct { ResourceFilter string NamespaceName string PodName string ContainerName string }
func (ContainerOption) Apply ¶
func (co ContainerOption) Apply(o *QueryOptions)
type Interface ¶
type Interface interface { GetMetric(expr string, time time.Time) Metric GetMetricOverTime(expr string, start, end time.Time, step time.Duration) Metric GetMetadata(tenantEnvID string) []Metadata //TODO Query dimensions to be improved GetAppMetadata(tenantEnvID, appID string) []Metadata GetComponentMetadata(tenantEnvID, componentID string) []Metadata GetMetricLabelSet(expr string, start, end time.Time) []map[string]string GetEndpoint() string }
Interface monitor interface
func NewPrometheus ¶
NewPrometheus new prometheus monitor
type Metric ¶
type Metric struct { MetricName string `json:"metric_name,omitempty" description:"metric name, eg. scheduler_up_sum"` MetricData `json:"data,omitempty" description:"actual metric result"` Error string `json:"error,omitempty"` }
type MetricData ¶
type MetricData struct { MetricType string `json:"resultType,omitempty" description:"result type, one of matrix, vector"` MetricValues []MetricValue `json:"result,omitempty" description:"metric data including labels, time series and values"` }
type MetricValue ¶
type MetricValue struct { Metadata map[string]string `json:"metric,omitempty" description:"time series labels"` // The type of Point is a float64 array with fixed length of 2. // So Point will always be initialized as [0, 0], rather than nil. // To allow empty Sample, we should declare Sample to type *Point Sample *Point `json:"value,omitempty" description:"time series, values of vector type"` Series []Point `json:"values,omitempty" description:"time series, values of matrix type"` }
type NamespaceOption ¶
func (NamespaceOption) Apply ¶
func (no NamespaceOption) Apply(o *QueryOptions)
type NodeOption ¶
func (NodeOption) Apply ¶
func (no NodeOption) Apply(o *QueryOptions)
type Options ¶
type Options struct {
Endpoint string `json:"endpoint,omitempty" yaml:"endpoint"`
}
Options prometheus options
type PVCOption ¶
type PVCOption struct { ResourceFilter string NamespaceName string StorageClassName string PersistentVolumeClaimName string }
func (PVCOption) Apply ¶
func (po PVCOption) Apply(o *QueryOptions)
type PodOption ¶
type PodOption struct { ResourceFilter string NodeName string NamespaceName string WorkloadKind string WorkloadName string PodName string }
func (PodOption) Apply ¶
func (po PodOption) Apply(o *QueryOptions)
type Point ¶
type Point [2]float64
The first element is the timestamp, the second is the metric value. eg, [1585658599.195, 0.528]
func (Point) MarshalJSON ¶
MarshalJSON implements json.Marshaler. It will be called when writing JSON to HTTP response Inspired by prometheus/client_golang
func (*Point) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler. This is for unmarshaling test data.
type QueryOption ¶
type QueryOption interface {
Apply(*QueryOptions)
}
type QueryOptions ¶
type QueryOptions struct { Level Level ResourceFilter string NodeName string WorkspaceName string NamespaceName string WorkloadKind string WorkloadName string PodName string ContainerName string StorageClassName string PersistentVolumeClaimName string }
func NewQueryOptions ¶
func NewQueryOptions() *QueryOptions
type WorkloadOption ¶
func (WorkloadOption) Apply ¶
func (wo WorkloadOption) Apply(o *QueryOptions)
type WorkspaceOption ¶
func (WorkspaceOption) Apply ¶
func (wo WorkspaceOption) Apply(o *QueryOptions)
Click to show internal directories.
Click to hide internal directories.