datahub

package
v4.5.2000+incompatible Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2020 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateMetricsType

func GenerateMetricsType(queueType common.QueueType) dpCommon.MetricType

func GenerateQueryCondition

func GenerateQueryCondition(meta interface{}) (*dpCommon.QueryCondition, error)

func GenerateSchemaMetaData

func GenerateSchemaMetaData(queueType common.QueueType) *schemas.SchemaMeta

func IsExistContainer

func IsExistContainer(originContainers []*dpResource.Container, name string) bool

Types

type Config

type Config struct {
	Address       string        `mapstructure:"address"`
	RetryInterval retryInterval `mapstructure:"retryInterval"`
}

type ConsumerGroup

type ConsumerGroup struct {
	Name                 string `datahub:"name"`
	Namespace            string `datahub:"namespace"`
	ClusterName          string `datahub:"cluster_name"`
	TopicName            string `datahub:"topic_name"`
	TopicsName           []string
	K8sNamespace         string `datahub:"resource_k8s_namespace"`
	K8sName              string `datahub:"resource_k8s_name"`
	K8sKind              string `datahub:"resource_k8s_kind"`
	K8sReplicas          int32  `datahub:"resource_k8s_replicas"`
	K8sSpecReplicas      int32  `datahub:"resource_k8s_spec_replicas"`
	K8sMinReplicas       int32  `datahub:"resource_k8s_min_replicas"`
	K8sMaxReplicas       int32  `datahub:"resource_k8s_max_replicas"`
	ResourceCustomerName string `datahub:"resource_custom_name"`
	Policy               string `datahub:"policy"`
	AlamedaScalerName    string `datahub:"alameda_scaler_name"`
	EnableExecution      bool   `datahub:"enable_execution"`
	ResourceCPULimit     int64  `datahub:"resource_cpu_limit"`
	ResourceCPURequest   int64  `datahub:"resource_cpu_request"`
	ResourceMemLimit     int64  `datahub:"resource_memory_limit"`
	ResourceMemRequest   int64  `datahub:"resource_memory_request"`
	VolumeSize           int64  `datahub:"volume_size"`
}

type DPApplication

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

func NewDPApplication

func NewDPApplication(address string, application *dpResource.Application) *DPApplication

func (*DPApplication) CreateMetrics

func (d *DPApplication) CreateMetrics(applicationName string, metrics []*dpCommon.MetricData) error

type DPCluster

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

func NewDPCluster

func NewDPCluster(address string, cluster *dpResource.Cluster) *DPCluster

func (*DPCluster) CreateMetrics

func (d *DPCluster) CreateMetrics(cluster string, metrics []*dpCommon.MetricData) error

type DPController

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

func NewDPController

func NewDPController(address string, controller *dpResource.Controller) *DPController

func (*DPController) CreateMetrics

func (d *DPController) CreateMetrics(controllerName string, metrics []*dpCommon.MetricData) error

type DPNamespace

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

func NewDPNamespace

func NewDPNamespace(address string, namespace *dpResource.Namespace) *DPNamespace

func (*DPNamespace) CreateMetrics

func (d *DPNamespace) CreateMetrics(namespaceName string, metrics []*dpCommon.MetricData) error

type DPNode

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

func NewDPNode

func NewDPNode(address string, node *dpResource.Node) *DPNode

func (*DPNode) CreateMetrics

func (d *DPNode) CreateMetrics(nodeName string, metrics []*dpCommon.MetricData) error

type DPPod

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

func NewDPPod

func NewDPPod(address string, pod *dpResource.Pod) *DPPod

func (*DPPod) CreateMetrics

func (d *DPPod) CreateMetrics(containerName string, metrics []*dpCommon.MetricData) error

type DPWriter

type DPWriter interface {
	CreateMetrics(controllerName string, metrics []*dpCommon.MetricData) error
}

type DataHubClient

type DataHubClient struct {
	DataHub DataHubConfig
	Scope   *logUtil.Scope
	Queue   *queue.Queue
}

func NewDataHubClient

func NewDataHubClient() *DataHubClient

func (*DataHubClient) CreateData

func (d *DataHubClient) CreateData(writeDataRequest *dpData.WriteDataRequest) error

func (*DataHubClient) CreateMetrics

func (d *DataHubClient) CreateMetrics(metricsRequest *dpMetrics.CreateMetricsRequest) error

func (*DataHubClient) GetApplications

func (d *DataHubClient) GetApplications(appName string, namespace string) (*dpResource.ListApplicationsResponse, error)

func (*DataHubClient) GetCluster

func (d *DataHubClient) GetCluster(clusterName string) (*dpResource.ListClustersResponse, error)

func (*DataHubClient) GetConsumerGroupInfo

func (d *DataHubClient) GetConsumerGroupInfo(consumerGroup string, namespaceName string) (*ConsumerGroup, error)

func (*DataHubClient) GetControllers

func (d *DataHubClient) GetControllers(controllerName string, namespace string) (*dpResource.ListControllersResponse, error)

func (*DataHubClient) GetMetrics

func (d *DataHubClient) GetMetrics(readDataRequest *dpData.ReadDataRequest) ([]*Metrics, error)

func (*DataHubClient) GetNamespaces

func (d *DataHubClient) GetNamespaces(namespace string) (*dpResource.ListNamespacesResponse, error)

func (*DataHubClient) GetNginxInfo

func (d *DataHubClient) GetNginxInfo(serviceName string, serviceNamespace string, cluster string) (*Nginx, error)

func (*DataHubClient) GetNodes

func (d *DataHubClient) GetNodes(nodeName string) (*dpResource.ListNodesResponse, error)

func (*DataHubClient) GetPods

func (d *DataHubClient) GetPods(namespaces string, podName string) ([]*dpResource.Pod, error)

func (*DataHubClient) GetTopicInfo

func (d *DataHubClient) GetTopicInfo(topicName string, namespaceName string) (*TopicMeta, error)

func (*DataHubClient) ListNginx

func (d *DataHubClient) ListNginx(name string, namespace string, cluster string) ([]*Nginx, error)

func (*DataHubClient) OrganizeK8SClusterMapping

func (d *DataHubClient) OrganizeK8SClusterMapping() (map[string]*ObjectK8S, error)

func (*DataHubClient) ReadData

func (d *DataHubClient) ReadData(readDataRequest *dpData.ReadDataRequest) (*dpData.ReadDataResponse, error)

func (*DataHubClient) SendNotifyEvent

func (d *DataHubClient) SendNotifyEvent(id string, clusterid string, source *dpEvent.EventSource, eventType dpEvent.EventType, eventLevel dpEvent.EventLevel, k8sObject *dpEvent.K8SObjectReference, message string, data string) error

func (*DataHubClient) SetDataPipeAddress

func (d *DataHubClient) SetDataPipeAddress(address string)

func (*DataHubClient) WriteRawData

func (d *DataHubClient) WriteRawData(rawData *dpRawData.WriteRawdataRequest) error

type DataHubConfig

type DataHubConfig struct {
	DataHub            *Config `mapstructure:"datapipe"`
	DataGranularitySec int32   `mapstructure:"data_granularity_sec"`
	DataAmountInitSec  int32   `mapstructure:"data_amount_init_sec"`
	DataAmountSec      int32   `mapstructure:"data_amount_sec"`
}

type Execution

type Execution struct {
	Name             string `datahub:"name"`
	Namespace        string `datahub:"namespace"`
	ClusterName      string `datahub:"cluster_name"`
	MachineGroupName string `datahub:"machinegroup_name"`
	ExecutionTime    string `datahub:"execution_time"`
	ReplicasFrom     int32  `datahub:"replicas_from"`
	ReplicasTo       int32  `datahub:"replicas_to"`
	DeltaUpTime      int64  `datahub:"delta_up_time​"`
	DeltaDownTime    int64  `datahub:"delta_down_time"`
}

type MachineGroup

type MachineGroup struct {
	Name                                  string `datahub:"name"`
	Namespace                             string `datahub:"namespace"`
	ClusterName                           string `datahub:"cluster_name"`
	AlamedaScalerName                     string `datahub:"alameda_scaler_name"`
	AlamedaScalerNamespace                string `datahub:"alameda_scaler_namespace"`
	CpuUtilization                        int32  `datahub:"cpu_metric_utilization_target"`
	CpuUtilizationScaleUpGap              int32  `datahub:"cpu_metric_scaleup_gap"`
	CpuUtilizationScaleDownGap            int32  `datahub:"cpu_metric_scaledown_gap"`
	MemoryUtilization                     int32  `datahub:"memory_metric_utilization_target"`
	MemoryUtilizationScaleUpGap           int32  `datahub:"memory_metric_scaleup_gap"`
	MemoryUtilizationScaleDownGap         int32  `datahub:"memory_metric_scaledown_gap"`
	CpuDurationUpThresholdPercentage      int32  `datahub:"cpu_duration_up_threshold_percentage"`
	CpuDurationDownThresholdPercentage    int32  `datahub:"cpu_duration_down_threshold_percentage"`
	MemoryDurationUpThresholdPercentage   int32  `datahub:"memory_duration_up_threshold_percentage"`
	MemoryDurationDownThresholdPercentage int32  `datahub:"memory_duration_down_threshold_percentage"`
}

type MachineSet

type MachineSet struct {
	Name             string `datahub:"name"`
	Namespace        string `datahub:"namespace"`
	ClusterName      string `datahub:"cluster_name"`
	MachineGroupName string `datahub:"machinegroup_name"`
	MachineGroup     *MachineGroup
	K8sReplicas      int32 `datahub:"resource_k8s_replicas"`
	K8sSpecReplicas  int32 `datahub:"resource_k8s_spec_replicas"`
	K8sMinReplicas   int32 `datahub:"resource_k8s_min_replicas"`
	K8sMaxReplicas   int32 `datahub:"resource_k8s_max_replicas"`
}

type Metrics

type Metrics struct {
	Time                        *timestamp.Timestamp
	ClusterName                 string  `datahub:"cluster_name"`
	ResourceK8sKind             string  `datahub:"resource_k8s_kind"`
	ResourceK8sName             string  `datahub:"resource_k8s_name"`
	ResourceK8sNamespace        string  `datahub:"resource_k8s_namespace"`
	ResourceK8sServiceName      string  `datahub:"resource_k8s_service_name"`
	ResourceK8sServiceNamespace string  `datahub:"resource_k8s_service_namespace"`
	Value                       float64 `datahub:"value"`
}

type Nginx

type Nginx struct {
	Name                    string `datahub:"resource_k8s_name"`
	Namespace               string `datahub:"resource_k8s_namespace"`
	ClusterName             string `datahub:"cluster_name"`
	K8sNamespace            string `datahub:"resource_k8s_namespace"`
	K8sName                 string `datahub:"resource_k8s_name"`
	K8sKind                 string `datahub:"resource_k8s_kind"`
	K8sReplicas             int32  `datahub:"resource_k8s_replicas"`
	K8sSpecReplicas         int32  `datahub:"resource_k8s_spec_replicas"`
	K8sMinReplicas          int32  `datahub:"resource_k8s_min_replicas"`
	K8sMaxReplicas          int32  `datahub:"resource_k8s_max_replicas"`
	K8sServiceName          string `datahub:"resource_k8s_service_name"`
	K8sServiceNamespace     string `datahub:"resource_k8s_service_namespace"`
	K8sRouteNames           string `datahub:"resource_k8s_route_name"`
	K8sRouteNamespace       string `datahbu:"resource_k8s_route_namespace"`
	Policy                  string `datahub:"policy"`
	AlamedaScalerName       string `datahub:"alameda_scaler_name"`
	AlamedaScalerNamespace  string `datahub:"alameda_scaler_namespace"`
	EnableExecution         bool   `datahub:"enable_execution"`
	ExportedNamespace       string `datahub:"exporter_namespace"`
	ExportedPods            string `datahub:"exporter_pods"`
	ResourceCPULimit        int64  `datahub:"resource_cpu_limit"`
	ResourceCPURequest      int64  `datahub:"resource_cpu_request"`
	ResourceMemLimit        int64  `datahub:"resource_memory_limit"`
	ResourceMemRequest      int64  `datahub:"resource_memory_request"`
	ReplicaMarginPercentage int32  `datahub:"replica_margin_percentage"`
	HttpResponseTime        int64  `datahub:"http_response_time"`
	ExporterPods            []string
	K8sRouteName            []string
}

type ObjectK8S

type ObjectK8S struct {
	SubObject []*ObjectK8S
	// contains filtered or unexported fields
}

func NewObjectK8S

func NewObjectK8S(oType string, oObject interface{}) *ObjectK8S

func (*ObjectK8S) GetContainers

func (k *ObjectK8S) GetContainers() ([]*dpResource.Container, error)

func (*ObjectK8S) GetObject

func (k *ObjectK8S) GetObject() interface{}

func (*ObjectK8S) GetType

func (k *ObjectK8S) GetType() string

type ObjectMeta

type ObjectMeta struct {
	Name                 string `datahub:"name,omitempty"`
	Namespace            string `datahub:"namespace,omitempty"`
	NodeName             string `datahub:"node_name,omitempty"`
	ClusterName          string `datahub:"cluster_name,omitempty"`
	Topic                string `datahub:"topic_name,omitempty"`
	MachineSetName       string `datahub:"machineset_name"`
	MachineSetNamespace  string `datahub:"machineset_namespace"`
	MachineGroupName     string `datahub:"machinegroup_name"`
	ResourceK8sName      string `datahub:"resource_k8s_name"`
	ResourceK8sNamespace string `datahub:"resource_k8s_namespace"`
	ResourceK8sKind      string `datahub:"resource_k8s_kind"`
	ServiceK8sName       string `datahub:"resource_k8s_service_name"`
	ServiceK8sNamespace  string `datahub:"resource_k8s_service_namespace"`
	Parent               interface{}
}

type ResourceNode

type ResourceNode struct {
	Name                string `datahub:"name"`
	Namespace           string `datahub:"namespace"`
	ClusterName         string `datahub:"cluster_name"`
	MachineSetNamespace string `datahub:"machineset_namespace"`
	MachineSetName      string `datahub:"machineset_name"`
	RoleMasker          string `datahub:"role_master"`
	RoleWorker          string `datahub:"role_worker"`
	RoleInfra           string `datahub:"role_infra"`
	CPUCores            int32  `datahub:"node_cpu_cores"`
	MemoryBytes         int64  `datahub:"node_memory_bytes"`
	NetworkMbps         int64  `datahub:"node_network_mbps"`
}

type Topic

type Topic struct {
	Name        string `datahub:"name"`
	Namespace   string `datahub:"namespace"`
	ClusterName string `datahub:"cluster_name"`
}

type TopicMeta

type TopicMeta struct {
	Name        string
	Namespace   string
	ClusterName string
	TopicName   string
}

Jump to

Keyboard shortcuts

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