app

package
v0.0.0-...-d050cfb Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2019 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AppNode = 1
	ApiNode = 2
)
View Source
const (
	Normal = 0
	Infra  = 1
	Entry  = 2
)
View Source
const PlatformName = "openapm"
View Source
const PlatformUrl = "http://apmtest.tf56.lo/ui"

Variables

This section is empty.

Functions

func AllExceptionStats

func AllExceptionStats(intv int64) map[string]int

获取最近intv分钟所有应用的异常次数

func ApiDashboard

func ApiDashboard(c echo.Context) error

func ApiDetail

func ApiDetail(c echo.Context) error

func ApiStats

func ApiStats(c echo.Context) error

单个应用下,所有接口的统计信息

func Dashboard

func Dashboard(c echo.Context) error

func ExceptionDashboard

func ExceptionDashboard(c echo.Context) error

func ExceptionStats

func ExceptionStats(c echo.Context) error

func List

func List(c echo.Context) error

func ListWithSetting

func ListWithSetting(c echo.Context) error

func Methods

func Methods(c echo.Context) error

func QueryAPPServiceMap

func QueryAPPServiceMap(c echo.Context) error

通过App name来查询service map

func QueryAgents

func QueryAgents(c echo.Context) error

func QueryAll

func QueryAll(c echo.Context) error

func QueryAllWithSetting

func QueryAllWithSetting(c echo.Context) error

func QueryApiMap

func QueryApiMap(c echo.Context) error

通过App name来查询service map

func QueryApis

func QueryApis(c echo.Context) error

查询应用底下的所有APi

func QueryAppBaseStatusList

func QueryAppBaseStatusList(c echo.Context) error

func QueryAppDetailStatus

func QueryAppDetailStatus(c echo.Context) error

func QueryPlatformStatus

func QueryPlatformStatus(c echo.Context) error

为传化内部其它服务提供查询接口

func QueryServiceMap

func QueryServiceMap(c echo.Context) error

查询全局service map

func QueryTrace

func QueryTrace(c echo.Context) error

func QueryTraces

func QueryTraces(c echo.Context) error

traceSeries":[{"name":"success","color":"rgb(18, 147, 154,.5)","data":[{"x":1545200556716,"y":7,"traceId":"yunbaoParkApp3^1545036617750^4217","agentId":"agencyBookKeep3","startTime":"1545200556716","url":"/agencyBookKeep/financialstatementscs/getOneAccountingDataByParams","traceIp":"127.0.0.1"},

func RuntimeDashByUnixTime

func RuntimeDashByUnixTime(c echo.Context) error

func RuntimeDashboard

func RuntimeDashboard(c echo.Context) error

func SqlDashboard

func SqlDashboard(c echo.Context) error

func SqlStats

func SqlStats(c echo.Context) error

func UserSetting

func UserSetting(user string) (int, []string)

获取用户的应用设定

Types

type Agent

type Agent struct {
	AgentID  string `json:"agent_id"`
	HostName string `json:"host_name"`
	IP       string `json:"ip"`

	IsLive      bool `json:"is_live"`
	IsContainer bool `json:"is_container"`

	StartTime    string     `json:"start_time"`
	SocketID     int        `json:"socket_id"`
	OperatingEnv int        `json:"operating_env"`
	TracingAddr  string     `json:"tracing_addr "`
	Info         *AgentInfo `json:"info"`
}

type AgentInfo

type AgentInfo struct {
	AgentVersion   string          `json:"agentVersion"`
	VmVersion      string          `json:"vmVersion"`
	Pid            int             `json:"pid"`
	ServerMetaData *ServerMetaData `json:"serverMetaData"`
}

type ApiMethod

type ApiMethod struct {
	ID             int     `json:"-"`
	API            string  `json:"api"`
	ServiceType    string  `json:"service_type"`
	RatioElapsed   int     `json:"ratio_elapsed"`
	Elapsed        int     `json:"elapsed"`
	MaxElapsed     int     `json:"max_elapsed"`
	MinElapsed     int     `json:"min_elapsed"`
	Count          int     `json:"count"`
	AverageElapsed float64 `json:"average_elapsed"`
	ErrorCount     int     `json:"error_count"`

	Method string `json:"method"`
	Class  string `json:"class"`
}

type ApiStat

type ApiStat struct {
	API            string  `json:"api"`
	MaxElapsed     int     `json:"max_elapsed"`
	MinElapsed     int     `json:"min_elapsed"`
	Count          int     `json:"count"`
	AverageElapsed float64 `json:"average_elapsed"`
	ErrorCount     int     `json:"error_count"`
}

type ChartTraces

type ChartTraces struct {
	Suc   bool    `json:"is_suc"`
	Xaxis []int64 `json:"timeXticks"`
	Title string  `json:"subTitle"`

	Series []*TraceSeries `json:"series"`
}

type DashResult

type DashResult struct {
	Suc         bool      `json:"suc"` //是否有数据
	Timeline    []string  `json:"timeline"`
	CountList   []int     `json:"count_list"`
	ElapsedList []float64 `json:"elapsed_list"`
	ApdexList   []float64 `json:"apdex_list"`
	ErrorList   []float64 `json:"error_list"`
	ExList      []int     `json:"ex_list"`
}

type Exception

type Exception struct {
	ID             int     `json:"id"`
	Exception      string  `json:"exception"`
	ServiceType    string  `json:"service_type"`
	Elapsed        int     `json:"elapsed"`
	MaxElapsed     int     `json:"max_elapsed"`
	MinElapsed     int     `json:"min_elapsed"`
	Count          int     `json:"count"`
	AverageElapsed float64 `json:"average_elapsed"`

	Method string `json:"method"`
	Class  string `json:"class"`
}

type IntBooleanIntBooleanValue

type IntBooleanIntBooleanValue struct {
	IntValue1  int32 `json:"intValue1"`
	BoolValue1 bool  `json:"boolValue1"`
	IntValue2  int32 `json:"intValue2"`
	BoolValue2 bool  `json:"boolValue2"`
}

type IntStringStringValue

type IntStringStringValue struct {
	IntValue     int32  `json:"intValue"`
	StringValue1 string `json:"stringValue1,omitempty"`
	StringValue2 string `json:"stringValue2,omitempty"`
}

type IntStringValue

type IntStringValue struct {
	IntValue    int32  `json:"intValue"`
	StringValue string `json:"stringValue,omitempty"`
}

type LongIntIntByteByteStringValue

type LongIntIntByteByteStringValue struct {
	LongValue   int64  `json:"longValue"`
	IntValue1   int32  `json:"intValue1"`
	IntValue2   int32  `json:"intValue2,omitempty"`
	ByteValue1  int8   `json:"byteValue1,omitempty"`
	ByteValue2  int8   `json:"byteValue2,omitempty"`
	StringValue string `json:"stringValue,omitempty"`
}

type MonitorAppStatus

type MonitorAppStatus struct {
	AppName      string                  `json:"applicationName"`
	WarningLevel string                  `json:"appWarningLevel"`
	Items        []*MonitorAppStatusItem `json:"items"`
}

type MonitorAppStatusItem

type MonitorAppStatusItem struct {
	Name  string `json:"itemName"`
	Value string `json:"itemValue"`
}

type Node

type Node struct {
	Name string `json:"name"`

	SpanCount  int `json:"span_count"`  // 收到的请求次数
	ErrorCount int `json:"error_count"` // 错误次数
	Category   int `json:"category"`    // 节点类型: 0: normal 1: infra 2:entry
	// contains filtered or unexported fields
}

这里的ErrorCount和SpanCount是为了展示当前节点的内部异常情况

type NodeLink struct {
	Source      string `json:"source"`       // 起点app name
	Target      string `json:"target"`       // 终点app name
	AccessCount int    `json:"access_count"` // 请求次数
	ErrorCount  int    `json:"error_count"`  // 错误次数

	AverageDuration int `json:"avg"` // 平均耗时
	// contains filtered or unexported fields
}

这里的ErrorCount和ReqCount是为了计算请求错误率 A -> B Source: A, Target B A访问B的所有错误都计算在ErrorCount中,包含网络不通引起的错误

type QASData

type QASData struct {
	PlatformName         string              `json:"platformName"`
	PlatformUrl          string              `json:"platformUrl"`
	ItemNameList         []string            `json:"itemNameList"`
	MonitorAppStatusList []*MonitorAppStatus `json:"monitorAppStatusList"`
}

type QASResult

type QASResult struct {
	Code    int      `json:"code"`
	Count   int      `json:"count"`
	Message string   `json:"msg"`
	Data    *QASData `json:"data"`
}

type QDSData

type QDSData struct {
	SystemName   string `json:"systemName"`
	PlatformUrl  string `json:"platformUrl"`
	AppName      string `json:"applicationName"`
	WarningLevel string `json:"appWarningLevel"`

	Items []*MonitorAppStatusItem `json:"items"`
}

type QDSResult

type QDSResult struct {
	Code    int      `json:"code"`
	Count   int      `json:"count"`
	Message string   `json:"msg"`
	Data    *QDSData `json:"data"`
}

type QPSData

type QPSData struct {
	PlatformName   string         `json:"platformName"`
	PlatformUrl    string         `json:"platformUrl"`
	WarningLevel   string         `json:"warningLevel"`
	WarningMessage string         `json:"warningMessage"`
	Items          map[string]int `json:"items"`
}

type QPSResult

type QPSResult struct {
	Code    int      `json:"code"`
	Count   int      `json:"count"`
	Message string   `json:"msg"`
	Data    *QPSData `json:"data"`
}

type RuntimeResult

type RuntimeResult struct {
	Timeline           []string  `json:"timeline"`
	JvmCpuList         []float64 `json:"jvm_cpu_list"`
	SysCpuList         []float64 `json:"sys_cpu_list"`
	JvmHeapList        []int64   `json:"jvm_heap_list"`
	HeapMaxList        []int64   `json:"heap_max_list"`
	FullgcCountList    []int64   `json:"fullgc_count_list"`
	FullgcDurationList []int64   `json:"fullgc_duration_list"`
}

type ServerMetaData

type ServerMetaData struct {
	ServerInfo string   `json:"serverInfo"`
	VmArgs     []string `json:"vmArgs"`
}

type ServiceMapResult

type ServiceMapResult struct {
	Nodes []*Node     `json:"nodes"`
	Links []*NodeLink `json:"links"`
}

type SpanEvent

type SpanEvent struct {
	Sequence      int             `json:"sequence"`
	StartElapsed  int             `json:"startElapsed"`
	EndElapsed    int             `json:"endElapsed"`
	ServiceType   int             `json:"serviceType"`
	EndPoint      string          `json:"endPoint"`
	Annotations   []*TempTag      `json:"annotations"`
	Depth         int             `json:"depth"`
	NextSpanID    int64           `json:"nextSpanId"`
	DestinationID string          `json:"destinationId"`
	MethodID      int             `json:"apiId"`
	ExceptionInfo *IntStringValue `json:"exceptionInfo"`
}

type SpanEvents

type SpanEvents []*SpanEvent

func (SpanEvents) Len

func (o SpanEvents) Len() int

func (SpanEvents) Less

func (o SpanEvents) Less(i, j int) bool

func (SpanEvents) Swap

func (o SpanEvents) Swap(i, j int)

type SqlDashResult

type SqlDashResult struct {
	Suc         bool      `json:"suc"` //是否有数据
	Timeline    []string  `json:"timeline"`
	CountList   []int     `json:"count_list"`
	ElapsedList []float64 `json:"elapsed_list"`
	ApdexList   []float64 `json:"apdex_list"`
	ErrorList   []int     `json:"error_list"`
}

type SqlStat

type SqlStat struct {
	ID             int     `json:"id"`
	SQL            string  `json:"sql"`
	MaxElapsed     int     `json:"max_elapsed"`
	MinElapsed     int     `json:"min_elapsed"`
	Count          int     `json:"count"`
	AverageElapsed float64 `json:"average_elapsed"`
	ErrorCount     int     `json:"error_count"`
	// contains filtered or unexported fields
}

type SqlStatList

type SqlStatList []*SqlStat

func (SqlStatList) Len

func (a SqlStatList) Len() int

func (SqlStatList) Less

func (a SqlStatList) Less(i, j int) bool

func (SqlStatList) Swap

func (a SqlStatList) Swap(i, j int)

type Stat

type Stat struct {
	Name           string  `json:"name"`
	Count          int     `json:"count"`
	Apdex          float64 `json:"apdex"`
	AverageElapsed float64 `json:"average_elapsed"`
	ErrorPercent   float64 `json:"error_percent"`
	ExPercent      int     `json:"ex_percent"`

	Alive   int `json:"alive"`   // 存活节点数量
	Unalive int `json:"unalive"` // 不存活节点数量
	// contains filtered or unexported fields
}

type TagValue

type TagValue struct {
	StringValue                   string                         `json:"stringValue,omitempty"`
	BoolValue                     bool                           `json:"boolValue,omitempty"`
	IntValue                      int32                          `json:"intValue,omitempty"`
	LongValue                     int64                          `json:"longValue,omitempty"`
	ShortValue                    int16                          `json:"shortValue,omitempty"`
	DoubleValue                   float64                        `json:"doubleValue,omitempty"`
	BinaryValue                   []byte                         `json:"binaryValue,omitempty"`
	ByteValue                     int8                           `json:"byteValue,omitempty"`
	IntStringValue                *IntStringValue                `json:"intStringValue,omitempty"`
	IntStringStringValue          *IntStringStringValue          `json:"intStringStringValue,omitempty"`
	LongIntIntByteByteStringValue *LongIntIntByteByteStringValue `json:"longIntIntByteByteStringValue,omitempty"`
	IntBooleanIntBooleanValue     *IntBooleanIntBooleanValue     `json:"intBooleanIntBooleanValue,omitempty"`
}

type TempTag

type TempTag struct {
	Key   int       `json:"key"`
	Value *TagValue `json:"value"`
}

原数据annotations使用的格式

type Trace

type Trace struct {
	ID         string `json:"id"`
	API        string `json:"api"`
	Elapsed    int    `json:"y"`
	AgentID    string `json:"agent_id"`
	InputDate  int64  `json:"x"`
	Error      int    `json:"error"`
	RemoteAddr string `json:"remote_addr"`
}

type TraceSeries

type TraceSeries struct {
	Name  string   `json:"name"`
	Color string   `json:"color"`
	Data  []*Trace `json:"data"`
}

type TraceTag

type TraceTag struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

标签,原数据为annotations,统一转换为tag

type TraceTree

type TraceTree []*TraceTreeNode

type TraceTreeNode

type TraceTreeNode struct {
	ID          string `json:"id"` // seg的id,p-0/p-0-1类的形式,通过这种形式形成层级tree
	Sequence    int    `json:"seq"`
	SpanID      string `json:"span_id"`
	Type        string `json:"type"`       // 1: span 2. event 3. tag
	Depth       int    `json:"depth"`      //node在完整的链路树上所处的层级,绝对层级 Tree Depth
	SpanDepth   int    `json:"span_depth"` //node对应的event在对应span中的层级,相对层级 span depth
	AppName     string `json:"app_name"`
	MethodID    int    `json:"method_id"`
	Method      string `json:"method"`
	Duration    int    `json:"duration"` // 耗时,-1 代表不显示耗时信息
	Params      string `json:"params"`
	ServiceType string `json:"service_type"`
	AgentID     string `json:"agent_id"`
	Class       string `json:"class"`
	StartTime   string `json:"start_time"`
	Icon        string `json:"icon"`     // 有些节点会显示特殊的icon,作为样式
	IsError     bool   `json:"is_error"` // 是否是错误/异常,

	DID string `json:"did"` // 用于debug,event的destination_id
	NID string `json:"nid"` // 用于debug, event的next_span_id
	// contains filtered or unexported fields
}

为了形成全链路,我们需要把trace的span和event组成一个tree结构,span和event对应的是tree node Tags、Exceptions都将转换为node进行展示

type Traces

type Traces []*Trace

func (Traces) Len

func (a Traces) Len() int

func (Traces) Less

func (a Traces) Less(i, j int) bool

func (Traces) Swap

func (a Traces) Swap(i, j int)

Jump to

Keyboard shortcuts

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