topo

package
v0.0.0-...-08b9edc Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2021 License: Apache-2.0 Imports: 13 Imported by: 1

Documentation

Overview

Package topoutil provides utilities to read the component topology.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNS                  = errorx.NewNamespace("topo_util")
	ErrEtcdRequestFailed   = ErrNS.NewType("etcd_request_failed")
	ErrInvalidTopologyData = ErrNS.NewType("invalid_topology_data")
)

Functions

func GetStoreInstances

func GetStoreInstances(pdAPI *pdclient.APIClient) ([]StoreInfo, []StoreInfo, error)

GetStoreInstances returns TiKV info and TiFlash info.

Types

type AlertManagerInfo

type AlertManagerInfo StandardComponentInfo

func GetAlertManagerInstance

func GetAlertManagerInstance(ctx context.Context, etcdClient *clientv3.Client) (*AlertManagerInfo, error)

type ComponentStatus

type ComponentStatus uint
const (
	ComponentStatusUnreachable ComponentStatus = 0
	ComponentStatusUp          ComponentStatus = 1
	ComponentStatusTombstone   ComponentStatus = 2
	ComponentStatusOffline     ComponentStatus = 3
	ComponentStatusDown        ComponentStatus = 4
)

type GrafanaInfo

type GrafanaInfo StandardComponentInfo

func GetGrafanaInstance

func GetGrafanaInstance(ctx context.Context, etcdClient *clientv3.Client) (*GrafanaInfo, error)

type PDInfo

type PDInfo struct {
	GitHash        string          `json:"git_hash"`
	Version        string          `json:"version"`
	IP             string          `json:"ip"`
	Port           uint            `json:"port"`
	DeployPath     string          `json:"deploy_path"`
	Status         ComponentStatus `json:"status"`
	StartTimestamp int64           `json:"start_timestamp"` // Ts = 0 means unknown
}

func GetPDInstances

func GetPDInstances(pdAPI *pdclient.APIClient) ([]PDInfo, error)

type PrometheusInfo

type PrometheusInfo StandardComponentInfo

func GetPrometheusInstance

func GetPrometheusInstance(ctx context.Context, etcdClient *clientv3.Client) (*PrometheusInfo, error)

type StandardComponentInfo

type StandardComponentInfo struct {
	IP   string `json:"ip"`
	Port uint   `json:"port"`
}

type StoreInfo

type StoreInfo struct {
	GitHash        string            `json:"git_hash"`
	Version        string            `json:"version"`
	IP             string            `json:"ip"`
	Port           uint              `json:"port"`
	DeployPath     string            `json:"deploy_path"`
	Status         ComponentStatus   `json:"status"`
	StatusPort     uint              `json:"status_port"`
	Labels         map[string]string `json:"labels"`
	StartTimestamp int64             `json:"start_timestamp"`
}

StoreInfo may be either a TiKV store info or a TiFlash store info

type TiDBInfo

type TiDBInfo struct {
	GitHash        string          `json:"git_hash"`
	Version        string          `json:"version"`
	IP             string          `json:"ip"`
	Port           uint            `json:"port"`
	DeployPath     string          `json:"deploy_path"`
	Status         ComponentStatus `json:"status"`
	StatusPort     uint            `json:"status_port"`
	StartTimestamp int64           `json:"start_timestamp"`
}

func GetTiDBInstances

func GetTiDBInstances(ctx context.Context, etcdClient *clientv3.Client) ([]TiDBInfo, error)

Jump to

Keyboard shortcuts

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