types

package
v1.20.11 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ResourceApplicationType application definition
	ResourceApplicationType = "application"
	// ResourceCollectorType collector definition
	ResourceCollectorType = "collector"
	// ResourceMetricType metric definition
	ResourceMetricType = "metric"
	// ResourceTaskType task definition, describe a outer-defined metric collect settings
	ResourceTaskType = "task"
)
View Source
const (
	BcsComponentsClusterId = "bcs_unique_const_clusterid"
	BcsComponentsSchemeKey = "io.tencent.bcs.metric.component.scheme"
)

Variables

View Source
var (
	DeleteCollectorNotExist = fmt.Errorf("delete collector not exist")
)

Functions

This section is empty.

Types

type ApplicationCollectorCfg

type ApplicationCollectorCfg struct {
	Version   string         `json:"version"`   // collector configuration version
	Name      string         `json:"name"`      // collector configuration name for application
	Namespace string         `json:"namespace"` // collector configuration namespace for application
	Cfg       []CollectorCfg `json:"cfg"`       // collector configuration
}

ApplicationCollectorCfg application collector configuration

type ClusterType

type ClusterType int
const (
	ClusterUnknown ClusterType = iota
	ClusterMesos
	ClusterK8S
	BcsComponents
)

func GetClusterType

func GetClusterType(s string) ClusterType

func (ClusterType) GetContainerTypeName

func (ct ClusterType) GetContainerTypeName() string

func (ClusterType) String

func (ct ClusterType) String() string

type CollectorCfg

type CollectorCfg struct {
	CfgKey     string            `json:"cfgKey"`
	Version    string            `json:"version"`
	Meta       btypes.ObjectMeta `json:"meta"`   // pod meta define
	DataID     int               `json:"dataid"` // report data to bluking data plat by dataid
	IP         string            `json:"ip"`
	Port       uint              `json:"port"`
	Scheme     string            `json:"scheme"`
	Address    string            `json:"address"`    // http request URL
	Head       map[string]string `json:"head"`       // http head
	Parameters map[string]string `json:"parameters"` // http request parameters
	Method     string            `json:"method"`     // http method ,the value only can  be POST or GET
	Frequency  int               `json:"frequency"`  // the frequency of data collection
	Timeout    int               `json:"timeout"`

	TLSConfig TLSCollectorCfg `json:"tlsConfig"`

	MetricType            MetricType        `json:"metricType"`
	PrometheusConstLabels map[string]string `json:"constLabels"`
}

collectorCfg collector configuration

type Metric

type Metric struct {
	Version   string `json:"version"`
	Name      string `json:"name"`
	Namespace string `json:"namespace"`

	TLSConfig TLSCollectorCfg `json:"tlsConfig"`

	// mesos network
	NetworkMode interface{} `json:"networkMode"`
	NetworkType string      `json:"networkType"`

	// k8s network
	HostNetwork bool   `json:"hostNetwork"`
	DnsPolicy   string `json:"dnsPolicy"`
	// k8s secret
	Secrets []interface{} `json:"imagePullSecrets"`

	ClusterID   string `json:"clusterID"`
	ClusterType string `json:"clusterType,omitempty"`

	DataID     int               `json:"dataID"`
	Port       uint              `json:"port"`
	URI        string            `json:"uri"`
	Method     string            `json:"method"`
	Head       map[string]string `json:"head"`
	Parameters map[string]string `json:"parameters"`
	Selector   map[string]string `json:"selector"`
	Frequency  int               `json:"frequency"`
	Timeout    int               `json:"timeout"`

	ImageBase string `json:"imageBase"`

	// prometheus
	MetricType            MetricType        `json:"metricType"`
	PrometheusConstLabels map[string]string `json:"constLabels"`
}

Metric metric数据结构定义

type MetricTask

type MetricTask struct {
	ClusterID string            `json:"clusterID"`
	Namespace string            `json:"namespace"`
	Name      string            `json:"name"`
	Selector  map[string]string `json:"selector"`
	Pods      []*MetricTaskPod  `json:"pods"`
}

MetricTask define a extra settings that import from API and will be added into collect settings

type MetricTaskPod

type MetricTaskPod struct {
	IP   string            `json:"ip"`
	Port uint              `json:"port"`
	Meta btypes.ObjectMeta `json:"meta"`
}

type MetricType

type MetricType string
const (
	MetricPrometheus MetricType = "prometheus"
)

type StorageTaskIf

type StorageTaskIf struct {
	Data *MetricTask `json:"data"`
}

data struct of MetricTask in storage

type TLSCollectorCfg

type TLSCollectorCfg struct {
	IsTLS        bool   `json:"isTLS"`
	CA           string `json:"ca"`
	ClientCert   string `json:"clientCert"`
	ClientKey    string `json:"clientKey"`
	ClientKeyPwd string `json:"clientKeyPwd"`
}

func (TLSCollectorCfg) GetCA

func (tc TLSCollectorCfg) GetCA() ([]byte, error)

func (TLSCollectorCfg) GetCAPool

func (tc TLSCollectorCfg) GetCAPool() (r *x509.CertPool, err error)

func (TLSCollectorCfg) GetCertificate

func (tc TLSCollectorCfg) GetCertificate() (r tls.Certificate, err error)

func (TLSCollectorCfg) GetClientCert

func (tc TLSCollectorCfg) GetClientCert() ([]byte, error)

func (TLSCollectorCfg) GetClientKey

func (tc TLSCollectorCfg) GetClientKey() (key []byte, err error)

func (TLSCollectorCfg) GetTLSConfig

func (tc TLSCollectorCfg) GetTLSConfig() (c *tls.Config, err error)

Jump to

Keyboard shortcuts

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