internal

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: GPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
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

View Source
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",
}
View Source
var PrometheusMetrics map[string]*prometheus.GaugeVec
View Source
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

func ResolveOtcShortHandNamespace(namespaces []string, logger ILogger) []string

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

func WithPrefixIfNotPresent(s, p string) string

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 ConfigStruct struct {
	AuthenticationData        AuthenticationData
	Namespaces                []string
	Port                      int
	WaitDuration              time.Duration
	ResourceIdNameMappingFlag bool
}

type ILogger added in v0.4.1

type ILogger interface {
	Info(msg string, tags ...interface{})
	Debug(msg string, tags ...interface{})
	Warn(msg string, tags ...interface{})
	Error(msg string, tags ...interface{})
	Panic(msg string, tags ...interface{})
	Sync() error
}

func NewLogger added in v0.4.1

func NewLogger(logLevel string) ILogger

type Logger added in v0.4.1

type Logger struct {
	// contains filtered or unexported fields
}

func (*Logger) Debug added in v0.4.1

func (l *Logger) Debug(msg string, tags ...interface{})

func (*Logger) Error added in v0.4.1

func (l *Logger) Error(msg string, tags ...interface{})

func (*Logger) Info added in v0.4.1

func (l *Logger) Info(msg string, tags ...interface{})

func (*Logger) Panic added in v0.4.1

func (l *Logger) Panic(msg string, tags ...interface{})

func (*Logger) Sync added in v0.4.1

func (l *Logger) Sync() error

func (*Logger) Warn added in v0.4.1

func (l *Logger) Warn(msg string, tags ...interface{})

type OtcNamespaces

type OtcNamespaces string

type OtcRegion added in v0.4.0

type OtcRegion string

func NewOtcRegionFromString added in v0.4.0

func NewOtcRegionFromString(region string) (OtcRegion, error)

func (OtcRegion) IamEndpoint added in v0.4.0

func (r OtcRegion) IamEndpoint() string

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.

Jump to

Keyboard shortcuts

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