topology

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2022 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JavaProcessType   = "jvm_memory"
	NodeJsProcessType = "nodejs_memory"
)
View Source
const (
	TypeService        = "Service"
	TypeMysql          = "Mysql"
	TypeRedis          = "Redis"
	TypeRocketMQ       = "RocketMQ"
	TypeExternal       = "ExternalService"
	TypeInternal       = "InternalService"
	TypeDubbo          = "Dubbo"
	TypeSidecar        = "SideCar"
	TypeGateway        = "APIGateway"
	TypeRegisterCenter = "RegisterCenter"
	TypeConfigCenter   = "ConfigCenter"
	TypeNoticeCenter   = "NoticeCenter"
	TypeElasticsearch  = "Elasticsearch"
)
View Source
const (
	Application = "application"
	Service     = "service"

	HttpIndex        = apm.Spot + apm.Sep1 + Application + apm.Sep3 + "http" + apm.Sep3 + Service
	RpcIndex         = apm.Spot + apm.Sep1 + Application + apm.Sep3 + "rpc" + apm.Sep3 + Service
	MicroIndex       = apm.Spot + apm.Sep1 + Application + apm.Sep3 + "micro" + apm.Sep3 + Service
	MqIndex          = apm.Spot + apm.Sep1 + Application + apm.Sep3 + "mq" + apm.Sep3 + Service
	DbIndex          = apm.Spot + apm.Sep1 + Application + apm.Sep3 + "db" + apm.Sep3 + Service
	CacheIndex       = apm.Spot + apm.Sep1 + Application + apm.Sep3 + "cache" + apm.Sep3 + Service
	ServiceNodeIndex = apm.Spot + apm.Sep1 + "service_node"
)
View Source
const (
	TargetServiceNode   = "TargetServiceNode"
	SourceServiceNode   = "SourceServiceNode"
	TargetAddonNode     = "TargetAddonNode"
	SourceAddonNode     = "SourceAddonNode"
	TargetComponentNode = "TargetComponentNode"
	TargetOtherNode     = "TargetOtherNode"
	SourceMQNode        = "SourceMQNode"
	TargetMQNode        = "TargetMQNode"
	TargetMQServiceNode = "TargetMQServiceNode"
	OtherNode           = "OtherNode"
)
View Source
const (
	HttpRecMircoIndexType = "http-rpc-mirco"
	MQDBCacheIndexType    = "mq-db-cache"
	ServiceNodeIndexType  = "service-node"
)
View Source
const (
	ExceptionTimeSortStrategy  = "time"
	ExceptionCountSortStrategy = "count"
)
View Source
const TimeLayout = "2006-01-02 15:04:05"

Variables

View Source
var (
	ApplicationSearchTag = SearchTag{
		Tag:   "application",
		Label: "应用名称",
		Type:  "select",
	}

	ServiceSearchTag = SearchTag{
		Tag:   "service",
		Label: "服务名称",
		Type:  "select",
	}
)
View Source
var (
	ReServiceNode  = regexp.MustCompile("^" + ServiceNodeIndex + "(.*)$")
	ReHttpRpcMicro = regexp.MustCompile("^(" + HttpIndex + "|" + RpcIndex + "|" + MicroIndex + ")(.*)$")
	ReMqDbCache    = regexp.MustCompile("^(" + MqIndex + "|" + DbIndex + "|" + CacheIndex + ")(.*)$")
)
View Source
var Aggregations map[string]*AggregationCondition
View Source
var ErrorReqMetricNames = []string{
	"application_http_error",
	"application_rpc_error",
	"application_cache_error",
	"application_db_error",
	"application_mq_error",
}
View Source
var NodeRelations map[string][]*NodeRelation
View Source
var ReqMetricNames = []string{
	"application_http_service",
	"application_rpc_service",
	"application_cache_service",
	"application_db_service",
	"application_mq_service",
}
View Source
var ReqMetricNamesDesc = map[string]string{
	"application_http_service":  "HTTP 请求",
	"application_rpc_service":   "RPC 请求",
	"application_cache_service": "缓存请求",
	"application_db_service":    "数据库请求",
	"application_mq_service":    "MQ 请求",
}

Functions

func GetTopologyPermission

func GetTopologyPermission(db *db.DB) httpserver.Interceptor

Types

type AggregationCondition

type AggregationCondition struct {
	Aggregation map[string]*elastic.FilterAggregation
}

type ExceptionDescription

type ExceptionDescription struct {
	InstanceId    string `json:"instance_id"`
	ExceptionType string `json:"exception_type"`
	Class         string `json:"class"`
	Method        string `json:"method"`
	Message       string `json:"message"`
	Time          string `json:"time"`
	Count         int64  `json:"count"`
}

func ExceptionOrderByCountStrategy

func ExceptionOrderByCountStrategy(exceptions ExceptionDescriptionsCountSort) []ExceptionDescription

func ExceptionOrderByStrategyExecute

func ExceptionOrderByStrategyExecute(exceptionType string, exceptions []ExceptionDescription) []ExceptionDescription

func ExceptionOrderByTimeStrategy

func ExceptionOrderByTimeStrategy(exceptions ExceptionDescriptionsTimeSort) []ExceptionDescription

type ExceptionDescriptionsCountSort

type ExceptionDescriptionsCountSort []ExceptionDescription

func (ExceptionDescriptionsCountSort) Len

func (ExceptionDescriptionsCountSort) Less

Less() by count

func (ExceptionDescriptionsCountSort) Swap

func (e ExceptionDescriptionsCountSort) Swap(i, j int)

Swap()

type ExceptionDescriptionsTimeSort

type ExceptionDescriptionsTimeSort []ExceptionDescription

func (ExceptionDescriptionsTimeSort) Len

func (ExceptionDescriptionsTimeSort) Less

func (e ExceptionDescriptionsTimeSort) Less(i, j int) bool

Less() by time

func (ExceptionDescriptionsTimeSort) Swap

func (e ExceptionDescriptionsTimeSort) Swap(i, j int)

Swap()

type Field

type Field struct {
	ELapsedCount float64 `json:"elapsed_count,omitempty"`
	ELapsedMax   float64 `json:"elapsed_max,omitempty"`
	ELapsedMean  float64 `json:"elapsed_mean,omitempty"`
	ELapsedMin   float64 `json:"elapsed_min,omitempty"`
	ELapsedSum   float64 `json:"elapsed_sum,omitempty"`
	CountSum     float64 `json:"count_sum,omitempty"`
	ErrorsSum    float64 `json:"errors_sum,omitempty"`
}

type GlobalParams

type GlobalParams struct {
	Scope     string `query:"scope" default:"micro_service"`
	ScopeId   string `query:"terminusKey" validate:"required"`
	StartTime int64  `query:"start" validate:"required"`
	EndTime   int64  `query:"end" validate:"required"`
}

type GroupByField

type GroupByField struct {
	Name     string
	SubField *GroupByField
}

type InstanceInfo

type InstanceInfo struct {
	Id     string `json:"instanceId"`
	Ip     string `json:"ip"`
	Status bool   `json:"status"`
}

type Metric

type Metric struct {
	Count     int64   `json:"count"`
	HttpError int64   `json:"http_error"`
	RT        float64 `json:"rt"`
	ErrorRate float64 `json:"error_rate"`
	Replicas  float64 `json:"replicas,omitempty"`
	Running   float64 `json:"running"`
	Stopped   float64 `json:"stopped"`
	RPS       float64 `json:"rps"`
	Duration  float64 `json:"duration"`
}

type Node

type Node struct {
	Id              string  `json:"id,omitempty"`
	Name            string  `json:"name,omitempty"`
	Type            string  `json:"type,omitempty"`
	TypeDisplay     string  `json:"typeDisplay,omitempty"`
	AddonId         string  `json:"addonId,omitempty"`
	AddonType       string  `json:"addonType,omitempty"`
	ApplicationId   string  `json:"applicationId,omitempty"`
	ApplicationName string  `json:"applicationName,omitempty"`
	RuntimeId       string  `json:"runtimeId,omitempty"`
	RuntimeName     string  `json:"runtimeName,omitempty"`
	ServiceId       string  `json:"serviceId,omitempty"`
	ServiceName     string  `json:"serviceName,omitempty"`
	DashboardId     string  `json:"dashboardId"`
	Metric          *Metric `json:"metric"`
	Parents         []*Node `json:"parents"`
}

type NodeRelation

type NodeRelation struct {
	Source []*NodeType
	Target *NodeType
}

type NodeType

type NodeType struct {
	Type         string
	GroupByField *GroupByField
	SourceFields []string
	Filter       *elastic.BoolQuery
	Aggregation  map[string]*elastic.SumAggregation
}
var (
	TargetServiceNodeType   *NodeType
	SourceServiceNodeType   *NodeType
	TargetAddonNodeType     *NodeType
	SourceAddonNodeType     *NodeType
	TargetComponentNodeType *NodeType
	TargetOtherNodeType     *NodeType
	SourceMQNodeType        *NodeType
	TargetMQNodeType        *NodeType
	TargetMQServiceNodeType *NodeType
	OtherNodeType           *NodeType

	ServiceNodeAggregation map[string]*elastic.SumAggregation
	NodeAggregation        map[string]*elastic.SumAggregation
)

type ProcessParams

type ProcessParams struct {
	TerminusKey string `query:"terminusKey" validate:"required"`
	ServiceName string `query:"serviceName" validate:"required"`
}

type ReadWriteBytes

type ReadWriteBytes struct {
	Timestamp  int64   `json:"timestamp"`  // unit: s
	ReadBytes  float64 `json:"readBytes"`  // unit: b
	WriteBytes float64 `json:"writeBytes"` // unit: b
}

type ReadWriteBytesSpeed

type ReadWriteBytesSpeed struct {
	Timestamp       int64   `json:"timestamp"`       // format: yyyy-MM-dd HH:mm:ss
	ReadBytesSpeed  float64 `json:"readBytesSpeed"`  // unit: b/s
	WriteBytesSpeed float64 `json:"writeBytesSpeed"` // unit: b/s
}

type RequestTransaction

type RequestTransaction struct {
	RequestType      string  `json:"requestType"`
	RequestCount     float64 `json:"requestCount"`
	RequestAvgTime   float64 `json:"requestAvgTime"`
	RequestErrorRate float64 `json:"requestErrorRate"`
}

type Response

type Response struct {
	Nodes []*Node `json:"nodes"`
}

type SearchTag

type SearchTag struct {
	Tag   string `json:"tag"`
	Label string `json:"label"`
	Type  string `json:"type"`
}

type ServiceDashboard

type ServiceDashboard struct {
	Id              string  `json:"service_id"`
	Name            string  `json:"service_name"`
	ReqCount        int64   `json:"req_count"`
	ReqErrorCount   int64   `json:"req_error_count"`
	ART             float64 `json:"avg_req_time"`           // avg response time
	RSInstanceCount string  `json:"running_instance_count"` // running / stopped
	RuntimeId       string  `json:"runtime_id"`
	RuntimeName     string  `json:"runtime_name"`
	ApplicationId   string  `json:"application_id"`
	ApplicationName string  `json:"application_name"`
}

type ServiceInstance

type ServiceInstance struct {
	ApplicationName     string `json:"applicationName,omitempty"`
	ServiceId           string `json:"serviceId,omitempty"`
	ServiceName         string `json:"serviceName,omitempty"`
	ServiceInstanceName string `json:"serviceInstanceName,omitempty"`
	ServiceInstanceId   string `json:"serviceInstanceId,omitempty"`
	InstanceState       string `json:"instanceState,omitempty"`
	PlatformVersion     string `json:"platformVersion,omitempty"`
	StartTime           string `json:"startTime,omitempty"`
	LastHeartbeatTime   string `json:"lastHeartbeatTime,omitempty"`
}

type ServiceParams

type ServiceParams struct {
	Scope       string `query:"scope" default:"micro_service"`
	ScopeId     string `query:"terminusKey" validate:"required"`
	StartTime   int64  `query:"start" validate:"required"`
	EndTime     int64  `query:"end" validate:"required"`
	ServiceName string `query:"serviceName" validate:"required"`
	ServiceId   string `query:"serviceId" validate:"required"`
	InstanceId  string `query:"instanceId"`
}

type ServicesVo

type ServicesVo struct {
	StartTime   int64               `query:"start" validate:"required"`
	EndTime     int64               `query:"end" validate:"required"`
	TerminusKey string              `query:"terminusKey" validate:"required"`
	Tags        map[string][]string `query:"tags"`
}

type Tag

type Tag struct {
	Component             string `json:"component,omitempty"`
	DBType                string `json:"db_type,omitempty"`
	DBSystem              string `json:"db_system,omitempty"`
	Host                  string `json:"host,omitempty"`
	HttpUrl               string `json:"http_url,omitempty"`
	PeerServiceScope      string `json:"peer_service_scope,omitempty"`
	PeerAddress           string `json:"peer_address,omitempty"`
	PeerService           string `json:"peer_service,omitempty"`
	DBHost                string `json:"db_host,omitempty"`
	SourceProjectId       string `json:"source_project_id,omitempty"`
	SourceProjectName     string `json:"source_project_name,omitempty"`
	SourceWorkspace       string `json:"source_workspace,omitempty"`
	SourceTerminusKey     string `json:"source_terminus_key,omitempty"`
	SourceApplicationId   string `json:"source_application_id,omitempty"`
	SourceApplicationName string `json:"source_application_name,omitempty"`
	SourceRuntimeId       string `json:"source_runtime_id,omitempty"`
	SourceRuntimeName     string `json:"source_runtime_name,omitempty"`
	SourceServiceName     string `json:"source_service_name,omitempty"`
	SourceServiceId       string `json:"source_service_id,omitempty"`
	SourceAddonID         string `json:"source_addon_id,omitempty"`
	SourceAddonType       string `json:"source_addon_type,omitempty"`
	TargetInstanceId      string `json:"target_instance_id,omitempty"`
	TargetProjectId       string `json:"target_project_id,omitempty"`
	TargetProjectName     string `json:"target_project_name,omitempty"`
	TargetWorkspace       string `json:"target_workspace,omitempty"`
	TargetTerminusKey     string `json:"target_terminus_key,omitempty"`
	TargetApplicationId   string `json:"target_application_id,omitempty"`
	TargetApplicationName string `json:"target_application_name,omitempty"`
	TargetRuntimeId       string `json:"target_runtime_id,omitempty"`
	TargetRuntimeName     string `json:"target_runtime_name,omitempty"`
	TargetServiceName     string `json:"target_service_name,omitempty"`
	TargetServiceId       string `json:"target_service_id,omitempty"`
	TargetAddonID         string `json:"target_addon_id,omitempty"`
	TargetAddonType       string `json:"target_addon_type,omitempty"`
	TerminusKey           string `json:"terminus_key,omitempty"`
	ProjectId             string `json:"project_id,omitempty"`
	ProjectName           string `json:"project_name,omitempty"`
	Workspace             string `json:"workspace,omitempty"`
	ApplicationId         string `json:"application_id,omitempty"`
	ApplicationName       string `json:"application_name,omitempty"`
	RuntimeId             string `json:"runtime_id,omitempty"`
	RuntimeName           string `json:"runtime_name,omitempty"`
	ServiceName           string `json:"service_name,omitempty"`
	ServiceId             string `json:"service_id,omitempty"`
	ServiceInstanceId     string `json:"service_instance_id,omitempty"`
	ServiceIp             string `json:"service_ip,omitempty"`
	Type                  string `json:"type,omitempty"`
}

type TopologyNodeRelation

type TopologyNodeRelation struct {
	Name      string                  `json:"name,omitempty"`
	Timestamp int64                   `json:"timestamp,omitempty"`
	Tags      Tag                     `json:"tags,omitempty"`
	Fields    Field                   `json:"fields,omitempty"`
	Parents   []*TopologyNodeRelation `json:"parents,omitempty"`
	Metric    *Metric                 `json:"metric,omitempty"`
}

type Vo

type Vo struct {
	StartTime   int64    `query:"startTime"`
	EndTime     int64    `query:"endTime"`
	TerminusKey string   `query:"terminusKey" validate:"required"`
	Tags        []string `query:"tags"`
	Debug       bool     `query:"debug"`
}

Jump to

Keyboard shortcuts

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