Documentation
¶
Overview ¶
Copyright 2024 CloudDetail SPDX-License-Identifier: Apache-2.0
Copyright 2024 CloudDetail SPDX-License-Identifier: Apache-2.0
Copyright 2024 CloudDetail SPDX-License-Identifier: Apache-2.0
Index ¶
- Constants
- Variables
- func GenUUID() uuid.UUID
- func IsTableExists(tableName string) bool
- func Pop(h []int64) []int64
- func Push(h []int64, x int64) []int64
- func TableToType() map[string]string
- type AlertDetail
- type AlertEvent
- func (a *AlertEvent) GetContainerTag() string
- func (a *AlertEvent) GetDatabaseIP() string
- func (a *AlertEvent) GetDatabasePort() string
- func (a *AlertEvent) GetDatabaseURL() string
- func (a *AlertEvent) GetEndpointTag() string
- func (a *AlertEvent) GetInfraNodeTag() string
- func (a *AlertEvent) GetK8sNamespaceTag() string
- func (a *AlertEvent) GetK8sPodTag() string
- func (a *AlertEvent) GetLevelTag() string
- func (a *AlertEvent) GetNetDstIPTag() string
- func (a *AlertEvent) GetNetSrcIPTag() string
- func (a *AlertEvent) GetNetSrcNodeTag() string
- func (a *AlertEvent) GetNetSrcPidTag() string
- func (a *AlertEvent) GetNetSrcPodTag() string
- func (a *AlertEvent) GetServiceNameTag() string
- func (a *AlertEvent) GetTargetObj() string
- type AlertEventCount
- type AlertEventLevelCount
- type AlertEventLevelCountMap
- type AlertReason
- type AlertStatus
- type AlertStatusCH
- type AlertStatusPROM
- type DataGroupFilter
- type Datasource
- type ErrWithMessage
- type FlameBearer
- type I18nLanguage
- type MiddlewareInstance
- type ModifyTableTTLMap
- type Pagination
- type RelatedInstances
- type RoleFilter
- type ServiceInstance
- type ServiceInstances
- func (instances *ServiceInstances) AddInstances(list []*ServiceInstance)
- func (instances *ServiceInstances) GetInstanceIdMap() map[string]*ServiceInstance
- func (instances *ServiceInstances) GetInstanceIds() []string
- func (instances *ServiceInstances) GetInstances() []*ServiceInstance
- func (instances *ServiceInstances) GetPodInstances() []string
- type SeverityLevel
- type Stack
- type Status
- type Table
- type TableType
- type TablesQuery
- type TeamFilter
- type ToplogyRelation
- type TopologyNode
- type TopologyNodes
- func (nodes *TopologyNodes) AddServerNode(key string, service string, url string, isTraced bool)
- func (nodes *TopologyNodes) AddTopologyNode(key string, service string, url string, isTraced bool, group string, ...)
- func (nodes *TopologyNodes) GetLabels(group string) ([]string, []string, []string)
- func (nodes *TopologyNodes) GetNodes() []*TopologyNode
- type Tree
Constants ¶
const ( AlertManagerSource = "alertManager" ZabbixSource = "zabbix" )
const ( DelaySourceAlert = "delaySource" InfrastructureAlert = "infrastructureStatus" NetAlert = "netStatus" K8sEventAlert = "k8sStatus" REDMetricsAlert = "REDStatus" LogMetricsAlert = "logsStatus" AppAlert = "appStatus" ContainerAlert = "containerStaus" UndefinedAlert = "undefinedAlert" )
const ( STATUS_NORMAL = "normal" STATUS_WARNING = "warning" STATUS_CRITICAL = "critical" )
const ( ROLE_ADMIN = "admin" ROLE_MANAGER = "manager" ROLE_VIEWER = "viewer" ROLE_ANONYMOS = "anonymous" )
const ( PERMISSION_SUB_TYP_ROLE = "role" PERMISSION_SUB_TYP_USER = "user" PERMISSION_SUB_TYP_TEAM = "team" PERMISSION_TYP_FEATURE = "feature" PERMISSION_TYP_DATA = "data" )
const ( TRANSLATION_EN = "en" TRANSLATION_ZH = "zh" TRANSLATION_TYP_FEATURE = "feature" TRANSLATION_TYP_MENU = "menu" )
const ( MAPPED_TYP_MENU = "menu" MAPPED_TYP_ROUTER = "router" MAPPED_TYP_API = "api" )
const ( DATA_GROUP_SUB_TYP_USER = "user" DATA_GROUP_SUB_TYP_TEAM = "team" DATA_GROUP_SOURCE_DEFAULT = "default" DATASOURCE_TYP_NAMESPACE = "namespace" DATASOURCE_TYP_SERVICE = "service" DATASOURCE_CATEGORY_APM = "apm" DATASOURCE_CATEGORY_NORMAL = "normal" )
const ( GROUP_SERVICE = "service" GROUP_MQ = "mq" GROUP_DB = "db" GROUP_EXTERNAL = "external" )
Variables ¶
var NORMAL_ALERT_STATUS = AlertStatus{ AlertStatusCH: AlertStatusCH{ InfrastructureStatus: STATUS_NORMAL, NetStatus: STATUS_NORMAL, K8sStatus: STATUS_NORMAL, AppStatus: STATUS_NORMAL, ContainerStatus: STATUS_NORMAL, }, AlertStatusPROM: AlertStatusPROM{ LogMetricsStatus: STATUS_NORMAL, }, }
Functions ¶
func IsTableExists ¶
func TableToType ¶
Types ¶
type AlertDetail ¶
type AlertEvent ¶
type AlertEvent struct { Source string `ch:"source" json:"source,omitempty"` ID uuid.UUID `ch:"id" json:"id,omitempty"` // fault trigger time CreateTime time.Time `ch:"create_time" json:"createTime"` // Last time the fault occurred UpdateTime time.Time `ch:"update_time" json:"updateTime"` // Recovery time (only present at recovery) EndTime time.Time `ch:"end_time" json:"endTime"` // Failure event reception time (used to record data connection, no business meaning) ReceivedTime time.Time `ch:"received_time" json:"receivedTime"` Severity SeverityLevel `ch:"severity" json:"severity,omitempty"` // Fault group information Group string `ch:"group" json:"group,omitempty"` Name string `ch:"name" json:"name,omitempty"` Detail string `ch:"detail" json:"detail,omitempty"` Tags map[string]string `ch:"tags" json:"tags,omitempty"` RawTags map[string]string `ch:"raw_tags" json:"raw_tags,omitempty"` Status Status `ch:"status" json:"status,omitempty"` }
AlertEvent indicates an event in the alert_event table
func (*AlertEvent) GetContainerTag ¶
func (a *AlertEvent) GetContainerTag() string
func (*AlertEvent) GetDatabaseIP ¶
func (a *AlertEvent) GetDatabaseIP() string
func (*AlertEvent) GetDatabasePort ¶
func (a *AlertEvent) GetDatabasePort() string
func (*AlertEvent) GetDatabaseURL ¶
func (a *AlertEvent) GetDatabaseURL() string
func (*AlertEvent) GetEndpointTag ¶
func (a *AlertEvent) GetEndpointTag() string
func (*AlertEvent) GetInfraNodeTag ¶
func (a *AlertEvent) GetInfraNodeTag() string
func (*AlertEvent) GetK8sNamespaceTag ¶
func (a *AlertEvent) GetK8sNamespaceTag() string
func (*AlertEvent) GetK8sPodTag ¶
func (a *AlertEvent) GetK8sPodTag() string
func (*AlertEvent) GetLevelTag ¶
func (a *AlertEvent) GetLevelTag() string
GetLevelTag 获取级别,当前只有network告警存在
func (*AlertEvent) GetNetDstIPTag ¶
func (a *AlertEvent) GetNetDstIPTag() string
func (*AlertEvent) GetNetSrcIPTag ¶
func (a *AlertEvent) GetNetSrcIPTag() string
func (*AlertEvent) GetNetSrcNodeTag ¶
func (a *AlertEvent) GetNetSrcNodeTag() string
func (*AlertEvent) GetNetSrcPidTag ¶
func (a *AlertEvent) GetNetSrcPidTag() string
func (*AlertEvent) GetNetSrcPodTag ¶
func (a *AlertEvent) GetNetSrcPodTag() string
func (*AlertEvent) GetServiceNameTag ¶
func (a *AlertEvent) GetServiceNameTag() string
func (*AlertEvent) GetTargetObj ¶
func (a *AlertEvent) GetTargetObj() string
type AlertEventCount ¶
type AlertEventLevelCount ¶
type AlertEventLevelCount map[SeverityLevel]uint64
type AlertEventLevelCountMap ¶
type AlertEventLevelCountMap map[string]AlertEventLevelCount
func (AlertEventLevelCountMap) Add ¶
func (m AlertEventLevelCountMap) Add(key string, level SeverityLevel, eventCount uint64)
type AlertReason ¶
type AlertReason map[string][]AlertDetail
func (AlertReason) Add ¶
func (r AlertReason) Add(key string, detail AlertDetail)
type AlertStatus ¶
type AlertStatus struct { AlertStatusCH AlertStatusPROM }
func (*AlertStatus) IsAllNormal ¶
func (s *AlertStatus) IsAllNormal() bool
type AlertStatusCH ¶
type AlertStatusCH struct { InfrastructureStatus string `json:"infrastructureStatus"` // infrastructure alarm NetStatus string `json:"netStatus"` // network alarm K8sStatus string `json:"k8sStatus"` // K8s status alarm AppStatus string `json:"appStatus"` // application alarm ContainerStatus string `json:"containerStatus"` // container alarm }
func (*AlertStatusCH) IsAllNormal ¶
func (s *AlertStatusCH) IsAllNormal() bool
type AlertStatusPROM ¶
type AlertStatusPROM struct {
LogMetricsStatus string `json:"logsStatus"` // log metric alarm
}
func (*AlertStatusPROM) IsAllNormal ¶
func (s *AlertStatusPROM) IsAllNormal() bool
type DataGroupFilter ¶
type DataGroupFilter struct { Names []string Name string IDs []int64 ID int64 DatasourceList []Datasource CurrentPage *int PageSize *int }
DataGroupFilter These fields can not use at the same time.
type Datasource ¶
type Datasource struct { Datasource string `json:"datasource"` // namespaceName or serviceName Type string `json:"type,omitempty"` // namespace or service Category string `json:"category"` // normal or apm Nested []string `json:"nested,omitempty"` // Nested datasource (namespace service belongs to or service under namespace) }
type ErrWithMessage ¶
func NewErrWithMessage ¶
func NewErrWithMessage(err error, code string) ErrWithMessage
func (ErrWithMessage) Error ¶
func (e ErrWithMessage) Error() string
type FlameBearer ¶
type FlameBearer struct { Names []string `json:"names"` Levels [][]int64 `json:"levels"` NumTicks int64 `json:"numTicks"` MaxSelf int64 `json:"maxSelf"` }
func NewFlameGraph ¶
func NewFlameGraph(t *Tree, maxNodes int64) *FlameBearer
type I18nLanguage ¶
type I18nLanguage struct {
Language string `json:"language" form:"language"` // I18n language
}
type MiddlewareInstance ¶
type ModifyTableTTLMap ¶
type Pagination ¶
type RelatedInstances ¶
type RelatedInstances struct { SIs []*ServiceInstance MIs []MiddlewareInstance }
type RoleFilter ¶
RoleFilter These fields can not use at the same time.
type ServiceInstance ¶
type ServiceInstance struct { ServiceName string `json:"service"` // service name ContainerId string `json:"containerId"` // container ID PodName string `json:"podName"` // Pod name Namespace string `json:"-"` NodeName string `json:"nodeName"` // hostname Pid int64 `json:"pid"` // process number NodeIP string `json:"nodeIp"` }
func (*ServiceInstance) GetInstanceId ¶
func (instance *ServiceInstance) GetInstanceId() string
func (*ServiceInstance) MatchSvcTags ¶
func (i *ServiceInstance) MatchSvcTags(group string, tags map[string]string) bool
type ServiceInstances ¶
type ServiceInstances struct {
InstanceMap map[string]*ServiceInstance
}
The ServiceInstances contains all the mappings for the Pod, Container, and VM scenarios. The data without the Pod has been removed.
func NewServiceInstances ¶
func NewServiceInstances() *ServiceInstances
func (*ServiceInstances) AddInstances ¶
func (instances *ServiceInstances) AddInstances(list []*ServiceInstance)
func (*ServiceInstances) GetInstanceIdMap ¶
func (instances *ServiceInstances) GetInstanceIdMap() map[string]*ServiceInstance
find out the non-duplicate instance list from the collected instance information
HACK when two process with the same information except one of them has pid = 1, we always return the instance with pid > 1
func (*ServiceInstances) GetInstanceIds ¶
func (instances *ServiceInstances) GetInstanceIds() []string
func (*ServiceInstances) GetInstances ¶
func (instances *ServiceInstances) GetInstances() []*ServiceInstance
func (*ServiceInstances) GetPodInstances ¶
func (instances *ServiceInstances) GetPodInstances() []string
type SeverityLevel ¶
type SeverityLevel uint8
const ( SeverityLevelUnknown SeverityLevel = iota SeverityLevelInfo SeverityLevelWarning SeverityLevelError SeverityLevelCritical )
func Str2SeverityLevel ¶
func Str2SeverityLevel(levelText string) SeverityLevel
func (*SeverityLevel) Scan ¶
func (s *SeverityLevel) Scan(src interface{}) error
Scan implements sql.Scanner so SeverityLevel can be read from databases transparently. Currently, database types that map to uint8 and []byte are supported.
type TablesQuery ¶
type TeamFilter ¶
type ToplogyRelation ¶
type ToplogyRelation struct { ParentService string `json:"parentService"` ParentEndpoint string `json:"parentEndpoint"` Service string `json:"service"` Endpoint string `json:"endpoint"` IsTraced bool `json:"isTraced"` Group string `json:"group"` System string `json:"system"` }
func NewServerRelation ¶
func NewServerRelation(parentService, parentEndPoint, service, endpoint string, isTraced bool) *ToplogyRelation
type TopologyNode ¶
type TopologyNode struct { Service string `json:"service"` Endpoint string `json:"endpoint"` IsTraced bool `json:"isTraced"` Group string `json:"group"` System string `json:"system"` }
func NewServerNode ¶
func NewServerNode(service string, url string, isTraced bool) *TopologyNode
type TopologyNodes ¶
type TopologyNodes struct {
Nodes map[string]*TopologyNode
}
func NewTopologyNodes ¶
func NewTopologyNodes() *TopologyNodes
func (*TopologyNodes) AddServerNode ¶
func (nodes *TopologyNodes) AddServerNode(key string, service string, url string, isTraced bool)
func (*TopologyNodes) AddTopologyNode ¶
func (*TopologyNodes) GetLabels ¶
func (nodes *TopologyNodes) GetLabels(group string) ([]string, []string, []string)
func (*TopologyNodes) GetNodes ¶
func (nodes *TopologyNodes) GetNodes() []*TopologyNode
type Tree ¶
type Tree struct {
// contains filtered or unexported fields
}
func (*Tree) InsertStack ¶
func (*Tree) MergeFlameGraph ¶
func (t *Tree) MergeFlameGraph(src *FlameBearer)