Documentation
¶
Index ¶
- Constants
- Variables
- func FilterByNamespaces(metrics []otcMetrics.MetricInfoList, namespaces []string) ([]otcMetrics.MetricInfoList, []otcMetrics.MetricInfoList)
- func IsFromNamespace(metric otcMetrics.MetricInfoList, namespaces []string) bool
- func OtcMetricInfoListToMetric(m otcMetrics.MetricInfoList) otcMetricData.Metric
- func ResolveOtcShortHandNamespace(namespaces []string, logger ILogger) []string
- func SetupPrometheusMetricsFromOtcMetrics(otcMetrics []otcMetrics.MetricInfoList, logger ILogger) map[string]*prometheus.GaugeVec
- func StandardPrometheusBatchMetricName(metric otcMetricData.BatchMetricData) string
- func StandardPrometheusMetricName(metric otcMetrics.MetricInfoList) string
- func WithPrefixIfNotPresent(s, p string) string
- type AuthenticationData
- type ConfigStruct
- type ILogger
- type Logger
- func (l *Logger) Debug(msg string, tags ...interface{})
- func (l *Logger) Error(msg string, tags ...interface{})
- func (l *Logger) Info(msg string, tags ...interface{})
- func (l *Logger) Panic(msg string, tags ...interface{})
- func (l *Logger) Sync() error
- func (l *Logger) Warn(msg string, tags ...interface{})
- type OtcNamespaces
- type OtcRegion
- type OtcWrapper
- func (c *OtcWrapper) GetDcsIdNameMapping() (map[string]string, error)
- func (c *OtcWrapper) GetDdsIdNameMapping() (map[string]string, error)
- func (c *OtcWrapper) GetDmsIdNameMapping() (map[string]string, error)
- func (c *OtcWrapper) GetEcsIdNameMapping() (map[string]string, error)
- func (c *OtcWrapper) GetElbIdNameMapping() (map[string]string, error)
- func (c *OtcWrapper) GetMetricData(metric otcMetrics.MetricInfoList) (*otcMetricData.MetricData, error)
- func (c *OtcWrapper) GetMetricDataBatched(metrics []otcMetrics.MetricInfoList) ([]otcMetricData.BatchMetricData, error)
- func (c *OtcWrapper) GetMetrics() ([]otcMetrics.MetricInfoList, error)
- func (c *OtcWrapper) GetNatIdNameMapping() (map[string]string, error)
- func (c *OtcWrapper) GetRdsIdNameMapping() (map[string]string, error)
- func (c *OtcWrapper) GetVpcIdNameMapping(projectId string) (map[string]string, error)
- type SliceWindow
Constants ¶
const ( EcsNamespace = "SYS.ECS" RdsNamespace = "SYS.RDS" DmsNamespace = "SYS.DMS" NatNamespace = "SYS.NAT" ElbNamespace = "SYS.ELB" DdsNamespace = "SYS.DDS" DcsNamespace = "SYS.DCS" VpcNamespace = "SYS.VPC" )
Variables ¶
var OtcNamespacesMapping = map[string]string{ "ECS": EcsNamespace, "BMS": "SERVICE.BMS", "AS": "SYS.AS", "EVS": "SYS.EVS", "SFS": "SYS.SFS", "EFS": "SYS.EFS", "CBR": "SYS.CBR", "VPC": VpcNamespace, "ELB": ElbNamespace, "NAT": NatNamespace, "WAF": "SYS.WAF", "DMS": DmsNamespace, "DCS": DcsNamespace, "RDS": RdsNamespace, "DDS": DdsNamespace, "NoSQL": "SYS.NoSQL", "GAUSSDB": "SYS.GAUSSDB", "GAUSSDBV5": "SYS.GAUSSDBV5", "DWS": "SYS.DWS", "ES": "SYS.ES", "OBS": "SYS.OBS", }
var PrometheusMetrics map[string]*prometheus.GaugeVec
var PrometheusVectorLabels = []string{"unit", "resource_id", "resource_name"}
Functions ¶
func FilterByNamespaces ¶
func FilterByNamespaces(metrics []otcMetrics.MetricInfoList, namespaces []string) ([]otcMetrics.MetricInfoList, []otcMetrics.MetricInfoList)
func IsFromNamespace ¶
func IsFromNamespace(metric otcMetrics.MetricInfoList, namespaces []string) bool
func OtcMetricInfoListToMetric ¶ added in v0.4.0
func OtcMetricInfoListToMetric(m otcMetrics.MetricInfoList) otcMetricData.Metric
func ResolveOtcShortHandNamespace ¶ added in v0.4.0
ResolveOtcShortHandNamespace maps the short code for the namespaces to the actual namespace name.
func SetupPrometheusMetricsFromOtcMetrics ¶
func SetupPrometheusMetricsFromOtcMetrics(otcMetrics []otcMetrics.MetricInfoList, logger ILogger) map[string]*prometheus.GaugeVec
func StandardPrometheusBatchMetricName ¶
func StandardPrometheusBatchMetricName(metric otcMetricData.BatchMetricData) string
func StandardPrometheusMetricName ¶
func StandardPrometheusMetricName(metric otcMetrics.MetricInfoList) string
func WithPrefixIfNotPresent ¶
Types ¶
type AuthenticationData ¶
type AuthenticationData struct { Username string Password string AccessKey string SecretKey string IsAkSkAuthentication bool ProjectId string DomainName string Region OtcRegion }
func (AuthenticationData) ToOtcGopherAuthOptionsProvider ¶
func (ad AuthenticationData) ToOtcGopherAuthOptionsProvider() golangsdk.AuthOptionsProvider
type ConfigStruct ¶
type ILogger ¶ added in v0.4.1
type OtcNamespaces ¶
type OtcNamespaces string
type OtcRegion ¶ added in v0.4.0
type OtcRegion string
func NewOtcRegionFromString ¶ added in v0.4.0
func (OtcRegion) IamEndpoint ¶ added in v0.4.0
type OtcWrapper ¶
type OtcWrapper struct { Region string Logger ILogger Config ConfigStruct // contains filtered or unexported fields }
func NewOtcClientFromConfig ¶
func NewOtcClientFromConfig(config ConfigStruct, logger ILogger) (*OtcWrapper, error)
func (*OtcWrapper) GetDcsIdNameMapping ¶ added in v0.6.0
func (c *OtcWrapper) GetDcsIdNameMapping() (map[string]string, error)
func (*OtcWrapper) GetDdsIdNameMapping ¶ added in v0.4.0
func (c *OtcWrapper) GetDdsIdNameMapping() (map[string]string, error)
func (*OtcWrapper) GetDmsIdNameMapping ¶
func (c *OtcWrapper) GetDmsIdNameMapping() (map[string]string, error)
func (*OtcWrapper) GetEcsIdNameMapping ¶
func (c *OtcWrapper) GetEcsIdNameMapping() (map[string]string, error)
func (*OtcWrapper) GetElbIdNameMapping ¶
func (c *OtcWrapper) GetElbIdNameMapping() (map[string]string, error)
func (*OtcWrapper) GetMetricData ¶
func (c *OtcWrapper) GetMetricData(metric otcMetrics.MetricInfoList) (*otcMetricData.MetricData, error)
func (*OtcWrapper) GetMetricDataBatched ¶
func (c *OtcWrapper) GetMetricDataBatched(metrics []otcMetrics.MetricInfoList) ([]otcMetricData.BatchMetricData, error)
func (*OtcWrapper) GetMetrics ¶
func (c *OtcWrapper) GetMetrics() ([]otcMetrics.MetricInfoList, error)
func (*OtcWrapper) GetNatIdNameMapping ¶
func (c *OtcWrapper) GetNatIdNameMapping() (map[string]string, error)
func (*OtcWrapper) GetRdsIdNameMapping ¶
func (c *OtcWrapper) GetRdsIdNameMapping() (map[string]string, error)
func (*OtcWrapper) GetVpcIdNameMapping ¶ added in v0.6.0
func (c *OtcWrapper) GetVpcIdNameMapping(projectId string) (map[string]string, error)
type SliceWindow ¶ added in v0.4.0
type SliceWindow[T any] struct { // contains filtered or unexported fields }
A slice window provides an iterator over a slice in form of windows of fixed width It is intended to be created by the NewSliceWindow function.
func NewSliceWindow ¶ added in v0.4.0
func NewSliceWindow[T any](slice []T, windowSize int) (SliceWindow[T], error)
NewSliceWindow is a function which creates a new SliceWindow on the given slice with a window size. It returns a SliceWindow if the windowSize is positive and not zero. Valid values are 1, 2, 3, 4, ...
func (*SliceWindow[T]) HasNext ¶ added in v0.4.0
func (sw *SliceWindow[T]) HasNext() bool
Returns a boolean if there is a next window on the slice available or not.
func (*SliceWindow[T]) NextWindow ¶ added in v0.4.0
func (sw *SliceWindow[T]) NextWindow()
Moves the current window position by one.
func (*SliceWindow[T]) Window ¶ added in v0.4.0
func (sw *SliceWindow[T]) Window() []T
Returns the current window on the underlying slice. This method returns an empty slice if you finished iterating over the array. Please use the HasNext method to check if you can continue iterating over it. And use NextWindow to continue to the next window in order.