File: monitor_metrics_definitions.go

package info (click to toggle)
golang-github-linode-linodego 1.55.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 13,112 kB
  • sloc: makefile: 96; sh: 52; python: 24
file content (61 lines) | stat: -rw-r--r-- 2,359 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package linodego

import (
	"context"
)

// MonitorMetricsDefinition represents an ACLP MetricsDefinition object
type MonitorMetricsDefinition struct {
	AvailableAggregateFunctions []AggregateFunction `json:"available_aggregate_functions"`
	Dimensions                  []MonitorDimension  `json:"dimensions"`
	IsAlertable                 bool                `json:"is_alertable"`
	Label                       string              `json:"label"`
	Metric                      string              `json:"metric"`
	MetricType                  MetricType          `json:"metric_type"`
	ScrapeInterval              string              `json:"scrape_interval"`
	Unit                        MetricUnit          `json:"unit"`
}

// Enum object for MetricType
type MetricType string

const (
	MetricTypeCounter   MetricType = "counter"
	MetricTypeHistogram MetricType = "histogram"
	MetricTypeGauge     MetricType = "gauge"
	MetricTypeSummary   MetricType = "summary"
)

// Enum object for Unit
type MetricUnit string

const (
	MetricUnitCount          MetricUnit = "count"
	MetricUnitPercent        MetricUnit = "percent"
	MetricUnitByte           MetricUnit = "byte"
	MetricUnitSecond         MetricUnit = "second"
	MetricUnitBitsPerSecond  MetricUnit = "bits_per_second"
	MetricUnitMillisecond    MetricUnit = "millisecond"
	MetricUnitKB             MetricUnit = "KB"
	MetricUnitMB             MetricUnit = "MB"
	MetricUnitGB             MetricUnit = "GB"
	MetricUnitRate           MetricUnit = "rate"
	MetricUnitBytesPerSecond MetricUnit = "bytes_per_second"
	MetricUnitPercentile     MetricUnit = "percentile"
	MetricUnitRatio          MetricUnit = "ratio"
	MetricUnitOpsPerSecond   MetricUnit = "ops_per_second"
	MetricUnitIops           MetricUnit = "iops"
)

// MonitorDimension represents an ACLP MonitorDimension object
type MonitorDimension struct {
	DimensionLabel string   `json:"dimension_label"`
	Label          string   `json:"label"`
	Values         []string `json:"values"`
}

// ListMonitorMetricsDefinitionByServiceType lists metric definitions
func (c *Client) ListMonitorMetricsDefinitionByServiceType(ctx context.Context, serviceType string, opts *ListOptions) ([]MonitorMetricsDefinition, error) {
	e := formatAPIPath("monitor/services/%s/metric-definitions", serviceType)
	return getPaginatedResults[MonitorMetricsDefinition](ctx, c, e, opts)
}