proposal

package
v0.0.0-...-e5d1c0a Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AlertMessage

type AlertMessage struct {
	ProjectName  string      `json:"project_name"`  // 项目名,用于区分不同项目告警信息
	Env          string      `json:"env"`           // 运行环境
	TraceID      string      `json:"trace_id"`      // 唯一ID,用于追踪关联
	HOST         string      `json:"host"`          // 请求 HOST
	URI          string      `json:"uri"`           // 请求 URI
	Method       string      `json:"method"`        // 请求 Method
	ErrorMessage interface{} `json:"error_message"` // 错误信息
	ErrorStack   string      `json:"error_stack"`   // 堆栈信息
	Timestamp    time.Time   `json:"timestamp"`     // 时间戳
}

AlertMessage 告警信息

func (*AlertMessage) Marshal

func (a *AlertMessage) Marshal() (jsonRaw []byte)

Marshal 序列化到JSON

type MetricsMessage

type MetricsMessage struct {
	ProjectName  string  `json:"project_name"`  // 项目名,用于区分不同项目告警信息
	Env          string  `json:"env"`           // 运行环境
	TraceID      string  `json:"trace_id"`      // 唯一ID,用于追踪关联
	HOST         string  `json:"host"`          // 请求 HOST
	Path         string  `json:"path"`          // 请求 Path
	Method       string  `json:"method"`        // 请求 Method
	HTTPCode     int     `json:"http_code"`     // HTTP 状态码
	BusinessCode int     `json:"business_code"` // 业务码
	CostSeconds  float64 `json:"cost_seconds"`  // 耗时,单位:秒
	IsSuccess    bool    `json:"is_success"`    // 状态,是否成功
}

MetricsMessage 指标信息

func (*MetricsMessage) Marshal

func (m *MetricsMessage) Marshal() (jsonRaw []byte)

Marshal 序列化到JSON

type NotifyHandler

type NotifyHandler func(msg *AlertMessage)

NotifyHandler 告警的发送句柄

type RecordHandler

type RecordHandler func(msg *MetricsMessage)

RecordHandler 指标的记录句柄

type SessionUserInfo

type SessionUserInfo struct {
	UserID     int64  `json:"user_id"`   // 用户ID
	UserName   string `json:"user_name"` // 用户名
	UserCId    int64  `json:"user_cid"`  //用户机构
	UserDeptId int64  `json:"dept_id"`   //部门id
}

SessionUserInfo 当前用户会话信息

func (*SessionUserInfo) Marshal

func (user *SessionUserInfo) Marshal() (jsonRaw []byte)

Marshal 序列化到JSON

Jump to

Keyboard shortcuts

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