observability

package
v1.23.0-alpha.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2022 License: Apache-2.0 Imports: 45 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AlertCountRet

type AlertCountRet struct {
	Total    AlertCountStatus `json:"total,omitempty"`
	Firing   AlertCountStatus `json:"firing,omitempty"`
	Resolved AlertCountStatus `json:"resolved,omitempty"`
}

type AlertCountStatus

type AlertCountStatus struct {
	TodayCount     int  `json:"todayCount"`
	YesterdayCount int  `json:"yesterdayCount"`
	IsIncrease     bool `json:"isIncrease"` // 今天相比昨天,是否在增加
	Percent        int  `json:"percent"`    // 增加/减少的百分数,-1 表示无穷大,0 表示不增不减
}

type AlertGraph

type AlertGraph struct {
	ProjectName string
	Date        string
	Count       int64

	DateTimeStamp int64
}

type AlertMessageGroup

type AlertMessageGroup struct {
	// group by字段
	Fingerprint string
	StartsAt    *time.Time `gorm:"index"` // 告警开始时间

	// 附加字段
	Message        string
	EndsAt         *time.Time // 告警结束时间
	CreatedAt      *time.Time // 上次告警时间
	Status         string     // firing or resolved
	Labels         datatypes.JSON
	SilenceCreator string
	// 计数
	Count int64
}

type AppInfo

type AppInfo struct {
	AppLabel    string `json:"appLabel"`
	CollectedBy string `json:"collectedBy"` // 由哪个flow采集的日志
}

type KV added in v1.23.0

type KV struct {
	LabelName  string                `json:"labelname"`
	LabelValue string                `json:"labelvalue"`
	Value      prommodel.SampleValue `json:"value"`
}

type LogCollector

type LogCollector struct {
	Apps           map[string]string `json:"apps"` // 要采集的应用, appname-applabel key-value
	Outputs        []string          `json:"outputs"`
	ClusterOutputs []string          `json:"clusterOutputs"`
	EnableMetrics  bool              `json:"enableMetrics"` // 是否启用日志采集监控
	PluginConfig   `json:"pluginConfig"`
}

type MetricQueryReq

type MetricQueryReq struct {
	// 查询范围
	Cluster   string
	Namespace string

	// 查询目标
	*prometheus.PromqlGenerator
	Expr string // 不传则自动生成

	Query *promql.Query

	// 时间
	Start string // 开始时间
	End   string // 结束时间
	Step  string // 样本间隔, 单位秒

	Label      string // 要查询的标签值
	TargetName string // panel中多个查询的id
}

type MonitorCollector

type MonitorCollector struct {
	Service string `json:"service"` // 服务名
	Port    string `json:"port"`    // 端口名
	Path    string `json:"path"`    // 采集路径
}

type ObservabilityHandler

type ObservabilityHandler struct {
	base.BaseHandler
	AppStoreOpt       *helm.Options
	ChartmuseumClient *helm.ChartmuseumClient
	// contains filtered or unexported fields
}

func (*ObservabilityHandler) AddAppLogCollector

func (h *ObservabilityHandler) AddAppLogCollector(c *gin.Context)

AddAppLogCollector 应用级日志采集器 @Tags Observability @Summary 应用级日志采集器 @Description 应用级日志采集器 @Accept json @Produce json @Param cluster path string true "cluster" @Param namespace path string true "namespace" @Param form body LogCollector true "采集器内容" @Success 200 {object} handlers.ResponseStruct{Data=string} "resp" @Router /v1/observability/cluster/{cluster}/namespaces/{namespace}/logging/apps [post] @Security JWT

func (*ObservabilityHandler) AddDashboardTemplates added in v1.22.0

func (h *ObservabilityHandler) AddDashboardTemplates(c *gin.Context)

AddDashboardTemplates 导入监控面板模板 @Tags Observability @Summary 导入监控面板模板 @Description 导入监控面板模板 @Accept json @Produce json @Param form body models.MonitorDashboardTpl true "模板内容" @Success 200 {object} handlers.ResponseStruct{Data=string} "resp" @Router /v1/observability/template/dashboard [post] @Security JWT

func (*ObservabilityHandler) AddOrUpdateMonitorCollector

func (h *ObservabilityHandler) AddOrUpdateMonitorCollector(c *gin.Context)

AddOrUpdateMonitorCollector 添加/更新监控采集器 @Tags Observability @Summary 添加/更新监控采集器 @Description 添加/更新监控采集器 @Accept json @Produce json @Param cluster path string true "cluster" @Param namespace path string true "namespace" @Param form body MonitorCollector true "采集器内容" @Success 200 {object} handlers.ResponseStruct{Data=string} "resp" @Router /v1/observability/cluster/{cluster}/namespaces/{namespace}/monitor [post] @Security JWT

func (*ObservabilityHandler) AddRules added in v1.22.0

func (h *ObservabilityHandler) AddRules(c *gin.Context)

AddRules 添加promql模板三级目录rule @Tags Observability @Summary 添加promql模板三级目录rule @Description 添加promql模板三级目录rule @Accept json @Produce json @Param tenant_id path string true "租户ID" @Param param body models.PromqlTplRule true "rule" @Success 200 {object} handlers.ResponseStruct{Data=[]models.PromqlTplScope} "resp" @Router /v1/observability/tenant/{tenant_id}/template/rules [post] @Security JWT

func (*ObservabilityHandler) AlertByGroup

func (h *ObservabilityHandler) AlertByGroup(c *gin.Context)

AlertByGroup 告警分组统计 @Tags Observability @Summary 告警分组统计 @Description 告警分组统计 @Accept json @Produce json @Param tenant_id query string true "租户ID" @Param start query string false "开始时间,格式 2006-01-02T15:04:05Z07:00" @Param end query string false "结束时间,格式 2006-01-02T15:04:05Z07:00" @Param groupby query string true "按什么分组(project_name, alert_type)" @Success 200 {object} handlers.ResponseStruct{Data=[]TableRet} "resp" @Router /v1/observability/tenant/{tenant_id}/alerts/group [get] @Security JWT

func (*ObservabilityHandler) AlertGraph

func (h *ObservabilityHandler) AlertGraph(c *gin.Context)

AlertGraph 告警趋势图 @Tags Observability @Summary 告警趋势图 @Description 告警趋势图 @Accept json @Produce json @Param tenant_id query string true "租户ID" @Param start query string false "开始时间,格式 2006-01-02T15:04:05Z07:00" @Param end query string false "结束时间,格式 2006-01-02T15:04:05Z07:00" @Success 200 {object} handlers.ResponseStruct{Data=model.Matrix} "resp" @Router /v1/observability/tenant/{tenant_id}/alerts/graph [get] @Security JWT

func (*ObservabilityHandler) AlertHistory

func (h *ObservabilityHandler) AlertHistory(c *gin.Context)

AlertHistory 告警历史 @Tags Observability @Summary 告警历史 @Description 告警历史 @Accept json @Produce json @Param cluster path string true "cluster" @Param namespace path string true "namespace" @Param name path string true "name" @Param status query string false "告警状态(resolved, firing), 为空则是所有状态" @Param CreatedAt_gte query string false "CreatedAt_gte" @Param CreatedAt_lte query string false "CreatedAt_lte" @Param page query int false "page" @Param size query int false "size" @Success 200 {object} handlers.ResponseStruct{Data=[]AlertMessageGroup} "规则" @Router /v1/observability/cluster/{cluster}/namespaces/{namespace}/alerts/{name}/history [get] @Security JWT

func (*ObservabilityHandler) AlertRepeats

func (h *ObservabilityHandler) AlertRepeats(c *gin.Context)

AlertHistory 重复的告警记录 @Tags Observability @Summary 重复的告警记录 @Description 重复的告警记录 @Accept json @Produce json @Param cluster path string true "cluster" @Param namespace path string true "namespace" @Param name path string true "name" @Param fingerprint query string true "告警指纹" @Param starts_at query string true "告警开始时间" @Param page query int false "page" @Param size query int false "size" @Success 200 {object} handlers.ResponseStruct{Data=[]models.AlertMessage} "规则" @Router /v1/observability/cluster/{cluster}/namespaces/{namespace}/alerts/{name}/repeats [get] @Security JWT

func (*ObservabilityHandler) AlertToday

func (h *ObservabilityHandler) AlertToday(c *gin.Context)

AlertToday 今日告警数量统计 @Tags Observability @Summary 今日告警数量统计 @Description 今日告警数量统计 @Accept json @Produce json @Param tenant_id path string true "租户ID" @Param status query string false "状态(firing, resolved)" @Success 200 {object} handlers.ResponseStruct{Data=AlertCountStatus} "resp" @Router /v1/observability/tenant/{tenant_id}/alerts/today [get] @Security JWT

func (*ObservabilityHandler) CreateChannel added in v1.22.0

func (h *ObservabilityHandler) CreateChannel(c *gin.Context)

CreateChannel 创建告警渠道 @Tags Observability @Summary 创建告警渠道 @Description 创建告警渠道 @Accept json @Produce json @Param tenant_id path string true "租户id, 所有租户为_all" @Param form body models.AlertChannel true "body" @Success 200 {object} handlers.ResponseStruct{Data=string} "resp" @Router /v1/observability/tenant/{tenant_id}/channels [post] @Security JWT

func (*ObservabilityHandler) CreateDashboard

func (h *ObservabilityHandler) CreateDashboard(c *gin.Context)

CreateDashboard 创建监控dashboad @Tags Observability @Summary 创建监控dashboad @Description 创建监控dashboad @Accept json @Produce json @Param environment_id path string true "环境ID" @Success 200 {object} handlers.ResponseStruct{Data=string} "resp" @Router /v1/observability/environment/{environment_id}/monitor/dashboard [post] @Security JWT

func (*ObservabilityHandler) CreateLoggingAlertRule

func (h *ObservabilityHandler) CreateLoggingAlertRule(c *gin.Context)

CreateLoggingAlertRule 创建日志告警规则 @Tags Observability @Summary 创建日志告警规则 @Description 创建日志告警规则 @Accept json @Produce json @Param cluster path string true "cluster" @Param namespace path string true "namespace" @Param form body observe.LoggingAlertRule true "body" @Success 200 {object} handlers.ResponseStruct{Data=string} "resp" @Router /v1/observability/cluster/{cluster}/namespaces/{namespace}/logging/alerts [post] @Security JWT

func (*ObservabilityHandler) CreateMonitorAlertRule

func (h *ObservabilityHandler) CreateMonitorAlertRule(c *gin.Context)

CreateMonitorAlertRule 创建监控告警规则 @Tags Observability @Summary 创建监控告警规则 @Description 创建监控告警规则 @Accept json @Produce json @Param cluster path string true "cluster" @Param namespace path string true "namespace" @Param form body observe.MonitorAlertRule true "body" @Success 200 {object} handlers.ResponseStruct{Data=string} "resp" @Router /v1/observability/cluster/{cluster}/namespaces/{namespace}/monitor/alerts [post] @Security JWT

func (*ObservabilityHandler) DashboardDetail

func (h *ObservabilityHandler) DashboardDetail(c *gin.Context)

DashboardDetail 监控dashboard详情 @Tags Observability @Summary 监控dashboard详情 @Description 监控dashboard详情 @Accept json @Produce json @Param environment_id path string true "环境ID" @Param dashboard_id path uint true "dashboard id" @Success 200 {object} handlers.ResponseStruct{Data=models.MonitorDashboard} "监控dashboard列表" @Router /v1/observability/environment/{environment_id}/monitor/dashboard/{dashboard_id} [get] @Security JWT

func (*ObservabilityHandler) DashboardQuery added in v1.23.0

func (h *ObservabilityHandler) DashboardQuery(c *gin.Context)

DashboardDetail 监控dashboard panne指标查询 @Tags Observability @Summary 监控dashboard panne指标查询 @Description 监控dashboard panne指标查询 @Accept json @Produce json @Param environment_id path string true "环境ID" @Param dashboard_id path uint true "dashboard id" @Param panel_id query uint true "panel id" @Param labelpairs query string false "标签键值对(value为空或者_all表示所有,支持正则), eg. labelpairs[host]=k8s-master&labelpairs[pod]=_all" @Param start query string false "开始时间,默认现在-30m" @Param end query string false "结束时间,默认现在" @Param step query int false "step, 单位秒,默认0" @Success 200 {object} handlers.ResponseStruct{Data=map[string]prommodel.Matrix} "pannel 查询结果" @Router /v1/observability/environment/{environment_id}/monitor/dashboard/{dashboard_id}/query [get] @Security JWT

func (*ObservabilityHandler) DeleteChannel added in v1.22.0

func (h *ObservabilityHandler) DeleteChannel(c *gin.Context)

DeleteChannel 删除告警渠道 @Tags Observability @Summary 删除告警渠道 @Description 删除告警渠道 @Accept json @Produce json @Param tenant_id path string true "租户id, 所有租户为_all" @Param channel_id path string true "告警渠道id" @Param form body models.AlertChannel true "body" @Success 200 {object} handlers.ResponseStruct{Data=string} "resp" @Router /v1/observability/tenant/{tenant_id}/channels/{channel_id} [delete] @Security JWT

func (*ObservabilityHandler) DeleteDashboard

func (h *ObservabilityHandler) DeleteDashboard(c *gin.Context)

DeleteDashboard 删除监控dashboad @Tags Observability @Summary 删除监控dashboad @Description 删除监控dashboad @Accept json @Produce json @Param environment_id path string true "环境ID" @Param dashboard_id path uint true "dashboard id" @Success 200 {object} handlers.ResponseStruct{Data=string} "resp" @Router /v1/observability/environment/{environment_id}/monitor/dashboard/{dashboard_id} [delete] @Security JWT

func (*ObservabilityHandler) DeleteDashboardTemplate added in v1.22.0

func (h *ObservabilityHandler) DeleteDashboardTemplate(c *gin.Context)

DeleteDashboardTemplate 删除监控面板模板 @Tags Observability @Summary 删除监控面板模板 @Description 删除监控面板模板 @Accept json @Produce json @Param name path string true "模板名" @Success 200 {object} handlers.ResponseStruct{Data=models.MonitorDashboardTpl} "resp" @Router /v1/observability/template/dashboard/{name} [delete] @Security JWT

func (*ObservabilityHandler) DeleteLoggingAlertRule

func (h *ObservabilityHandler) DeleteLoggingAlertRule(c *gin.Context)

DeleteLoggingAlertRule 删除日志告警规则 @Tags Observability @Summary 删除日志告警规则 @Description 删除日志告警规则 @Accept json @Produce json @Param cluster path string true "cluster" @Param namespace path string true "namespace" @Param name path string true "name" @Success 200 {object} handlers.ResponseStruct{Data=string} "resp" @Router /v1/observability/cluster/{cluster}/namespaces/{namespace}/logging/alerts/{name} [delete] @Security JWT

func (*ObservabilityHandler) DeleteMonitorAlertRule

func (h *ObservabilityHandler) DeleteMonitorAlertRule(c *gin.Context)

DeleteMonitorAlertRule 删除AlertRule @Tags Observability @Summary 修改监控告警规则 @Description 修改监控告警规则 @Accept json @Produce json @Param cluster path string true "cluster" @Param namespace path string true "namespace" @Param name path string true "name" @Param source query string true "source" @Success 200 {object} handlers.ResponseStruct{Data=string} "resp" @Router /v1/observability/cluster/{cluster}/namespaces/{namespace}/monitor/alerts/{name} [delete] @Security JWT

func (*ObservabilityHandler) DeleteMonitorCollector

func (h *ObservabilityHandler) DeleteMonitorCollector(c *gin.Context)

DeleteMonitorCollector 删除监控采集器 @Tags Observability @Summary 删除监控采集器 @Description 删除监控采集器 @Accept json @Produce json @Param cluster path string true "cluster" @Param namespace path string true "namespace" @Param service query string true "服务名" @Success 200 {object} handlers.ResponseStruct{Data=string} "resp" @Router /v1/observability/cluster/{cluster}/namespaces/{namespace}/monitor [delete] @Security JWT

func (*ObservabilityHandler) DeleteRules added in v1.22.0

func (h *ObservabilityHandler) DeleteRules(c *gin.Context)

DeleteRules 删除promql模板三级目录rule @Tags Observability @Summary 删除promql模板三级目录rule @Description 删除promql模板三级目录rule @Accept json @Produce json @Param tenant_id path string true "租户ID" @Param rule_id path string true "rule ID" @Success 200 {object} handlers.ResponseStruct{Data=[]models.PromqlTplScope} "resp" @Router /v1/observability/tenant/{tenant_id}/template/rules/{rule_id} [delete] @Security JWT

func (*ObservabilityHandler) DisableAlertRule

func (h *ObservabilityHandler) DisableAlertRule(c *gin.Context)

DisableAlertRule 禁用告警规则 @Tags Observability @Summary 禁用告警规则 @Description 禁用告警规则 @Accept json @Produce json @Param cluster path string true "cluster" @Param namespace path string true "namespace" @Param name path string true "name" @Success 200 {object} handlers.ResponseStruct{Data=string} "resp" @Router /v1/observability/cluster/{cluster}/namespaces/{namespace}/alerts/{name}/actions/disable [post] @Security JWT

func (*ObservabilityHandler) EnableAlertRule

func (h *ObservabilityHandler) EnableAlertRule(c *gin.Context)

DisableAlertRule 启用告警规则 @Tags Observability @Summary 启用告警规则 @Description 启用告警规则 @Accept json @Produce json @Param cluster path string true "cluster" @Param namespace path string true "namespace" @Param name path string true "name" @Success 200 {object} handlers.ResponseStruct{Data=string} "resp" @Router /v1/observability/cluster/{cluster}/namespaces/{namespace}/alerts/{name}/actions/enable [post] @Security JWT

func (*ObservabilityHandler) ExporterSchema

func (h *ObservabilityHandler) ExporterSchema(c *gin.Context)

ExporterSchema 获取exporter的schema @Tags Observability @Summary 获取exporter的schema @Description 获取exporter的schema @Accept json @Produce json @Param name path string true "exporter app name" @Success 200 {object} handlers.ResponseStruct{Data=object} "resp" @Router /v1/observability/monitor/exporters/{name}/schema [get] @Security JWT

func (*ObservabilityHandler) GetChannel added in v1.22.0

func (h *ObservabilityHandler) GetChannel(c *gin.Context)

GetChannel 渠道列表详情 @Tags Observability @Summary 渠道列表详情 @Description 渠道列表详情 @Accept json @Produce json @Param tenant_id path string true "租户id, 所有租户为_all" @Param channel_id path string true "告警渠道id" @Success 200 {object} handlers.ResponseStruct{Data=models.AlertChannel} "resp" @Router /v1/observability/tenant/{tenant_id}/channels/{channel_id} [get] @Security JWT

func (*ObservabilityHandler) GetDashboardTemplate added in v1.22.0

func (h *ObservabilityHandler) GetDashboardTemplate(c *gin.Context)

GetDashboardTemplate 监控面板模板详情 @Tags Observability @Summary 监控面板模板详情 @Description 监控面板模板详情 @Accept json @Produce json @Param name path string true "模板名" @Success 200 {object} handlers.ResponseStruct{Data=models.MonitorDashboardTpl} "resp" @Router /v1/observability/template/dashboard/{name} [get] @Security JWT

func (*ObservabilityHandler) GetLoggingAlertRule

func (h *ObservabilityHandler) GetLoggingAlertRule(c *gin.Context)

GetLoggingAlertRule 日志告警规则详情 @Tags Observability @Summary 日志告警规则详情 @Description 日志告警规则详情 @Accept json @Produce json @Param cluster path string true "cluster" @Param namespace path string true "namespace" @Param name path string true "name" @Success 200 {object} handlers.ResponseStruct{Data=observe.LoggingAlertRule} "resp" @Router /v1/observability/cluster/{cluster}/namespaces/{namespace}/logging/alerts/{name} [get] @Security JWT

func (*ObservabilityHandler) GetMonitorAlertRule

func (h *ObservabilityHandler) GetMonitorAlertRule(c *gin.Context)

GetMonitorAlertRule 监控告警规则详情 @Tags Observability @Summary 监控告警规则详情 @Description 监控告警规则详情 @Accept json @Produce json @Param cluster path string true "cluster" @Param namespace path string true "namespace" @Param name path string true "name" @Success 200 {object} handlers.ResponseStruct{Data=observe.MonitorAlertRule} "resp" @Router /v1/observability/cluster/{cluster}/namespaces/{namespace}/monitor/alerts/{name} [get] @Security JWT

func (*ObservabilityHandler) GetMonitorCollector

func (h *ObservabilityHandler) GetMonitorCollector(c *gin.Context)

GetMonitorCollector 监控采集器详情 @Tags Observability @Summary 监控采集器详情 @Description 监控采集器详情 @Accept json @Produce json @Param cluster path string true "cluster" @Param namespace path string true "namespace" @Param service query string true "服务名" @Success 200 {object} handlers.ResponseStruct{Data=MonitorCollector} "resp" @Router /v1/observability/cluster/{cluster}/namespaces/{namespace}/monitor [get] @Security JWT

func (*ObservabilityHandler) GetRule added in v1.22.0

func (h *ObservabilityHandler) GetRule(c *gin.Context)

GetRule 获取promql模板三级目录rule @Tags Observability @Summary 获取promql模板三级目录rule @Description 获取promql模板三级目录rule @Accept json @Produce json @Param tenant_id path string true "租户ID" @Param rule_id path string true "rule ID" @Param preload query string false "Resource, Resource.Scope" @Success 200 {object} handlers.ResponseStruct{Data=models.PromqlTplScope} "resp" @Router /v1/observability/tenant/{tenant_id}/template/rules/{rule_id} [get] @Security JWT

func (*ObservabilityHandler) LabelNames

func (h *ObservabilityHandler) LabelNames(c *gin.Context)

LabelNames 查群prometheus label names @Tags Observability @Summary 查群prometheus label names @Description 查群prometheus label names @Accept json @Produce json @Param cluster path string true "集群名" @Param namespace path string true "命名空间,所有namespace为_all" @Param resource query string false "查询资源" @Param rule query string false "查询规则" @Param start query string false "开始时间,默认现在-30m" @Param end query string false "结束时间,默认现在" @Param expr query string true "promql表达式" @Success 200 {object} handlers.ResponseStruct{Data=[]string} "resp" @Router /v1/observability/cluster/{cluster}/namespaces/{namespace}/monitor/metrics/labelnames [get] @Security JWT

func (*ObservabilityHandler) LabelValues

func (h *ObservabilityHandler) LabelValues(c *gin.Context)

Query 监控标签值 @Tags Observability @Summary 监控标签值 @Description 查询label对应的标签值 @Accept json @Produce json @Param label query string true "要查询的标签" @Param cluster path string true "集群名" @Param namespace path string true "命名空间,所有namespace为_all" @Param resource query string false "查询资源" @Param rule query string false "查询规则" @Param unit query string false "单位" @Param labelpairs query string false "标签键值对(value为空或者_all表示所有,支持正则), eg. labelpairs[host]=k8s-master&labelpairs[pod]=_all" @Param expr query string false "promql表达式" @Param start query string false "开始时间,默认现在-30m" @Param end query string false "结束时间,默认现在" @Param step query int false "step, 单位秒,默认0" @Success 200 {object} handlers.ResponseStruct{Data=[]string} "Metrics配置" @Router /v1/observability/cluster/{cluster}/namespaces/{namespace}/monitor/metrics/labelvalues [get] @Security JWT

func (*ObservabilityHandler) ListChannels added in v1.22.0

func (h *ObservabilityHandler) ListChannels(c *gin.Context)

ListChannels 告警渠道列表 @Tags Observability @Summary 告警渠道列表 @Description 告警渠道列表 @Accept json @Produce json @Param tenant_id path string true "租户id, 所有租户为_all" @Param search query string false "search in (name)" @Param page query int false "page" @Param size query int false "size" @Success 200 {object} handlers.ResponseStruct{Data=[]models.AlertChannel} "resp" @Router /v1/observability/tenant/{tenant_id}/channels [get] @Security JWT

func (*ObservabilityHandler) ListDashboard

func (h *ObservabilityHandler) ListDashboard(c *gin.Context)

ListDashboard 监控dashboard列表 @Tags Observability @Summary 监控dashboard列表 @Description 监控dashboard列表 @Accept json @Produce json @Param environment_id path string true "环境ID" @Success 200 {object} handlers.ResponseStruct{Data=[]models.MonitorDashboard} "监控dashboard列表" @Router /v1/observability/environment/{environment_id}/monitor/dashboard [get] @Security JWT

func (*ObservabilityHandler) ListDashboardTemplates

func (h *ObservabilityHandler) ListDashboardTemplates(c *gin.Context)

ListDashboardTemplates 监控面板模板列表 @Tags Observability @Summary 监控面板模板列表 @Description 监控面板模板列表 @Accept json @Produce json @Param page query int false "page" @Param size query int false "size" @Success 200 {object} handlers.ResponseStruct{Data=[]models.MonitorDashboardTpl} "resp" @Router /v1/observability/template/dashboard [get] @Security JWT

func (*ObservabilityHandler) ListLogApps

func (h *ObservabilityHandler) ListLogApps(c *gin.Context)

ListLogApps 获取支持日志采集的应用及标签 @Tags Observability @Summary 获取支持日志采集的应用及标签 @Description 获取支持日志采集的应用及标签 @Accept json @Produce json @Param cluster path string true "cluster" @Param namespace path string true "namespace" @Success 200 {object} handlers.ResponseStruct{Data=map[string]AppInfo} "resp" @Router /v1/observability/cluster/{cluster}/namespaces/{namespace}/logging/apps [get] @Security JWT

func (*ObservabilityHandler) ListLoggingAlertRule

func (h *ObservabilityHandler) ListLoggingAlertRule(c *gin.Context)

ListLoggingAlertRule 日志告警规则列表 @Tags Observability @Summary 日志告警规则列表 @Description 日志告警规则列表 @Accept json @Produce json @Param cluster path string true "cluster" @Param namespace path string true "namespace" @Success 200 {object} handlers.ResponseStruct{Data=[]observe.LoggingAlertRule} "resp" @Router /v1/observability/cluster/{cluster}/namespaces/{namespace}/logging/alerts [get] @Security JWT

func (*ObservabilityHandler) ListMonitorAlertRule

func (h *ObservabilityHandler) ListMonitorAlertRule(c *gin.Context)

ListMonitorAlertRule 监控告警规则列表 @Tags Observability @Summary 监控告警规则列表 @Description 监控告警规则列表 @Accept json @Produce json @Param cluster path string true "cluster" @Param namespace path string true "namespace" @Success 200 {object} handlers.ResponseStruct{Data=[]observe.MonitorAlertRule} "resp" @Router /v1/observability/cluster/{cluster}/namespaces/{namespace}/monitor/alerts [get] @Security JWT

func (*ObservabilityHandler) ListResources added in v1.22.0

func (h *ObservabilityHandler) ListResources(c *gin.Context)

ListResources 获取promql模板二级目录resource @Tags Observability @Summary 获取promql模板二级目录resource @Description 获取promql模板二级目录resource @Accept json @Produce json @Param tenant_id path int true "租户ID" @Param scope_id path int true "scope id" @Param preload query string false "choices (Scope, Rules)" @Param search query string false "search in (name)" @Param page query int false "page" @Param size query int false "size" @Success 200 {object} handlers.ResponseStruct{Data=[]models.PromqlTplScope} "resp" @Router /v1/observability/tenant/{tenant_id}/template/scopes/{scope_id}/resources [get] @Security JWT

func (*ObservabilityHandler) ListRules added in v1.22.0

func (h *ObservabilityHandler) ListRules(c *gin.Context)

ListRules 获取promql模板三级目录rule @Tags Observability @Summary 获取promql模板三级目录rule @Description 获取promql模板三级目录rule @Accept json @Produce json @Param tenant_id path string true "租户ID" @Param resource_id path string true "resource id" @Param preload query string false "choices (Resource, Resource.Scope)" @Param search query string false "search in (name, show_name)" @Param page query int false "page" @Param size query int false "size" @Success 200 {object} handlers.ResponseStruct{Data=[]models.PromqlTplScope} "resp" @Router /v1/observability/tenant/{tenant_id}/template/resources{resource_id}/rules [get] @Security JWT

func (*ObservabilityHandler) ListScopes added in v1.22.0

func (h *ObservabilityHandler) ListScopes(c *gin.Context)

ListScopes 获取promql模板一级目录scope @Tags Observability @Summary 获取promql模板一级目录scope @Description 获取promql模板一级目录scope @Accept json @Produce json @Param tenant_id path string true "租户ID" @Param page query int false "page" @Param size query int false "size" @Param search query string false "search in (name)" @Param preload query string false "choices (Resources)" @Success 200 {object} handlers.ResponseStruct{Data=[]models.PromqlTplScope} "resp" @Router /v1/observability/tenant/{tenant_id}/template/scopes [get] @Security JWT

func (*ObservabilityHandler) MonitorCollectorStatus added in v1.22.0

func (h *ObservabilityHandler) MonitorCollectorStatus(c *gin.Context)

MonitorCollectorStatus 监控采集器状态 @Tags Observability @Summary 监控采集器状态 @Description 监控采集器状态 @Accept json @Produce json @Param cluster path string true "cluster" @Param namespace path string true "namespace" @Param service query string true "服务名" @Success 200 {object} handlers.ResponseStruct{Data=promv1.ActiveTarget} "resp" @Router /v1/observability/cluster/{cluster}/namespaces/{namespace}/monitor/status [get] @Security JWT

func (*ObservabilityHandler) NamespaceLogCollector

func (h *ObservabilityHandler) NamespaceLogCollector(c *gin.Context)

NamespaceLogCollector namespace级日志采集器 @Tags Observability @Summary namespace级日志采集器 @Description namespace级日志采集器 @Accept json @Produce json @Param cluster path string true "cluster" @Param namespace path string true "namespace" @Param enable query bool true "是否启用日志采集" @Success 200 {object} handlers.ResponseStruct{Data=string} "resp" @Router /v1/observability/cluster/{cluster}/namespaces/{namespace}/logging [put] @Security JWT

func (*ObservabilityHandler) OtelMetricsGraphs added in v1.22.0

func (h *ObservabilityHandler) OtelMetricsGraphs(c *gin.Context)

OtelMetricsGraphs OtelMetricsGraphs @Tags Observability @Summary OtelMetricsGraphs @Description OtelMetricsGraphs @Accept json @Produce json @Param cluster path string true "集群名" @Param namespace path string true "命名空间" @Param service query string false "jaeger service" @Param start query string false "开始时间,默认现在-30m" @Param end query string false "结束时间,默认现在" @Success 200 {object} handlers.ResponseStruct{Data=object} "resp" @Router /v1/observability/cluster/{cluster}/namespaces/{namespace}/otel/metrics/graphs [get] @Security JWT

func (*ObservabilityHandler) OtelOverview added in v1.23.0

func (h *ObservabilityHandler) OtelOverview(c *gin.Context)

OtelOverview 应用性能监控概览 @Tags Observability @Summary 应用性能监控概览 @Description 应用性能监控概览 @Accept json @Produce json @Param cluster path string true "集群名" @Param namespace path string true "命名空间" @Param start query string false "开始时间,默认现在-30m" @Param end query string false "结束时间,默认现在" @Param pick query string false "选择什么值(max/min/avg), default max" @Param page query int false "page" @Param size query int false "size" @Success 200 {object} handlers.ResponseStruct{Data=OtelOverViewResp} "resp" @Router /v1/observability/cluster/{cluster}/namespaces/{namespace}/otel/appmonitor/overview [get] @Security JWT

func (*ObservabilityHandler) OtelServiceOperations added in v1.23.0

func (h *ObservabilityHandler) OtelServiceOperations(c *gin.Context)

OtelServiceOperations 应用操作 @Tags Observability @Summary 应用操作 @Description 应用操作 @Accept json @Produce json @Param cluster path string true "集群名" @Param namespace path string true "命名空间" @Param service_name path string true "应用" @Param start query string false "开始时间,默认现在-30m" @Param end query string false "结束时间,默认现在" @Success 200 {object} handlers.ResponseStruct{Data=handlers.PageData{List=[]OtelView}} "resp" @Router /v1/observability/cluster/{cluster}/namespaces/{namespace}/otel/appmonitor/services/{service_name}/operations [get] @Security JWT

func (*ObservabilityHandler) OtelServiceRequests added in v1.23.0

func (h *ObservabilityHandler) OtelServiceRequests(c *gin.Context)

OtelServiceRequests 应用请求 @Tags Observability @Summary 应用请求 @Description 应用请求 @Accept json @Produce json @Param cluster path string true "集群名" @Param namespace path string true "命名空间" @Param service_name path string true "应用" @Param start query string false "开始时间,默认现在-30m" @Param end query string false "结束时间,默认现在" @Success 200 {object} handlers.ResponseStruct{Data=gin.H} "resp" @Router /v1/observability/cluster/{cluster}/namespaces/{namespace}/otel/appmonitor/services/{service_name}/requests [get] @Security JWT

func (*ObservabilityHandler) OtelServiceTraces added in v1.23.0

func (h *ObservabilityHandler) OtelServiceTraces(c *gin.Context)

OtelServiceTraces 应用traces @Tags Observability @Summary 应用traces @Description 应用traces @Accept json @Produce json @Param cluster path string true "集群名" @Param namespace path string true "命名空间" @Param service_name path string true "应用" @Param start query string false "开始时间,默认现在-30m" @Param end query string false "结束时间,默认现在" @Param maxDuration query string true "trace的maxDuration" @Param minDuration query string true "trace的minDuration" @Param limit query int true "limit" @Param page query int false "page" @Param size query int false "size" @Success 200 {object} handlers.ResponseStruct{Data=handlers.PageData{List=[]observe.Trace}} "resp" @Router /v1/observability/cluster/{cluster}/namespaces/{namespace}/otel/appmonitor/services/{service_name}/traces [get] @Security JWT

func (*ObservabilityHandler) OtelServices added in v1.23.0

func (h *ObservabilityHandler) OtelServices(c *gin.Context)

OtelServices 应用性能监控服务 @Tags Observability @Summary 应用性能监控服务 @Description 应用性能监控服务 @Accept json @Produce json @Param cluster path string true "集群名" @Param namespace path string true "命名空间,所有namespace为_all" @Param start query string false "开始时间,默认现在-30m" @Param end query string false "结束时间,默认现在" @Param page query int false "page" @Param size query int false "size" @Success 200 {object} handlers.ResponseStruct{Data=handlers.PageData{List=[]OtelView}} "resp" @Router /v1/observability/cluster/{cluster}/namespaces/{namespace}/otel/appmonitor/services [get] @Security JWT

func (*ObservabilityHandler) QueryRange

func (h *ObservabilityHandler) QueryRange(c *gin.Context)

Query 监控指标查询 @Tags Observability @Summary 监控指标查询 @Description 监控指标查询 @Accept json @Produce json @Param cluster path string true "集群名" @Param namespace path string true "命名空间,所有namespace为_all" @Param resource query string false "查询资源" @Param rule query string false "查询规则" @Param unit query string false "单位" @Param labelpairs query string false "标签键值对(value为空或者_all表示所有,支持正则), eg. labelpairs[host]=k8s-master&labelpairs[pod]=_all" @Param expr query string false "promql表达式" @Param start query string false "开始时间,默认现在-30m" @Param end query string false "结束时间,默认现在" @Param step query int false "step, 单位秒,默认0" @Success 200 {object} handlers.ResponseStruct{Data=object} "Metrics配置" @Router /v1/observability/cluster/{cluster}/namespaces/{namespace}/monitor/metrics/queryrange [get] @Security JWT

func (*ObservabilityHandler) RegistRouter

func (h *ObservabilityHandler) RegistRouter(rg *gin.RouterGroup)

func (*ObservabilityHandler) SearchAlert

func (h *ObservabilityHandler) SearchAlert(c *gin.Context)

SearchAlert 搜索告警 @Tags Observability @Summary 搜索告警 @Description 搜索告警 @Accept json @Produce json @Param tenant_id path string true "租户ID,所有租户为_all" @Param project query string false "项目名,默认所有" @Param environment query string false "环境名,默认所有" @Param cluster query string false "集群名,默认所有" @Param namespace query string false "命名空间,默认所有" @Param alertname query string false "告警名,默认所有" @Param search query string false "告警消息内容和标签,中间以空格隔开,eg. pod=mypod container=mycontainer alertcontent" @Param tpl query string false "告警模板,默认所有, scope.resource.rule" @Param labelpairs query string false "标签键值对,不支持正则 eg. labelpairs[host]=k8s-master&labelpairs[pod]=pod1" @Param start query string false "开始时间" @Param end query string false "结束时间" @Param status query string false "状态(firing, resolved)" @Param page query int false "page" @Param size query int false "size" @Success 200 {object} handlers.ResponseStruct{Data=pagination.PageData{List=[]AlertMessageGroup}} "resp" @Router /v1/observability/tenant/{tenant_id}/alerts/search [get] @Security JWT

func (*ObservabilityHandler) SearchTpl added in v1.22.0

func (h *ObservabilityHandler) SearchTpl(c *gin.Context)

SearchTpl 由scope,resource,rule name获取tpl @Tags Observability @Summary 由scope,resource,rule name获取tpl @Description 由scope,resource,rule name获取tpl @Accept json @Produce json @Param tenant_id path string true "租户ID" @Param scope query string true "scope" @Param resource query string true "scope" @Param rule query string true "scope" @Success 200 {object} handlers.ResponseStruct{Data=object} "resp" @Router /v1/observability/tenant/{tenant_id}/template/search [get] @Security JWT

func (*ObservabilityHandler) TestChannel added in v1.22.0

func (h *ObservabilityHandler) TestChannel(c *gin.Context)

TestChannel 测试告警渠道 @Tags Observability @Summary 测试告警渠道 @Description 测试告警渠道 @Accept json @Produce json @Param tenant_id path string true "租户id, 所有租户为_all" @Param channel_id path string true "告警渠道id" @Success 200 {object} handlers.ResponseStruct{Data=string} "resp" @Router /v1/observability/tenant/{tenant_id}/channels/{channel_id}/test [post] @Security JWT

func (*ObservabilityHandler) UpdateChannel added in v1.22.0

func (h *ObservabilityHandler) UpdateChannel(c *gin.Context)

UpdateChannel 更新告警渠道 @Tags Observability @Summary 更新告警渠道 @Description 更新告警渠道 @Accept json @Produce json @Param tenant_id path string true "租户id, 所有租户为_all" @Param channel_id path string true "告警渠道id" @Param form body models.AlertChannel true "body" @Success 200 {object} handlers.ResponseStruct{Data=string} "resp" @Router /v1/observability/tenant/{tenant_id}/channels/{channel_id} [put] @Security JWT

func (*ObservabilityHandler) UpdateDashboard

func (h *ObservabilityHandler) UpdateDashboard(c *gin.Context)

UpdateDashboard 更新监控dashboad @Tags Observability @Summary 更新监控dashboad @Description 更新监控dashboad @Accept json @Produce json @Param environment_id path string true "环境ID" @Param dashboard_id path uint true "dashboard id" @Param from body models.MonitorDashboard true "dashboad配置" @Success 200 {object} handlers.ResponseStruct{Data=string} "resp" @Router /v1/observability/environment/{environment_id}/monitor/dashboard/{dashboard_id} [put] @Security JWT

func (*ObservabilityHandler) UpdateDashboardTemplates added in v1.22.0

func (h *ObservabilityHandler) UpdateDashboardTemplates(c *gin.Context)

UpdateDashboardTemplates 更新监控面板模板 @Tags Observability @Summary 更新监控面板模板 @Description 更新监控面板模板 @Accept json @Produce json @Param form body models.MonitorDashboardTpl true "模板内容" @Success 200 {object} handlers.ResponseStruct{Data=string} "resp" @Router /v1/observability/template/dashboard/{name} [put] @Security JWT

func (*ObservabilityHandler) UpdateLoggingAlertRule

func (h *ObservabilityHandler) UpdateLoggingAlertRule(c *gin.Context)

CreateLoggingAlertRule 更新日志告警规则 @Tags Observability @Summary 更新日志告警规则 @Description 更新日志告警规则 @Accept json @Produce json @Param cluster path string true "cluster" @Param namespace path string true "namespace" @Param form body observe.LoggingAlertRule true "body" @Success 200 {object} handlers.ResponseStruct{Data=string} "resp" @Router /v1/observability/cluster/{cluster}/namespaces/{namespace}/logging/alerts/{name} [put] @Security JWT

func (*ObservabilityHandler) UpdateMonitorAlertRule

func (h *ObservabilityHandler) UpdateMonitorAlertRule(c *gin.Context)

UpdateMonitorAlertRule 修改监控告警规则 @Tags Observability @Summary 修改监控告警规则 @Description 修改监控告警规则 @Accept json @Produce json @Param cluster path string true "cluster" @Param namespace path string true "namespace" @Param name path string true "name" @Param form body observe.MonitorAlertRule true "body" @Success 200 {object} handlers.ResponseStruct{Data=string} "resp" @Router /v1/observability/cluster/{cluster}/namespaces/{namespace}/monitor/alerts/{name} [put] @Security JWT

func (*ObservabilityHandler) UpdateRules added in v1.22.0

func (h *ObservabilityHandler) UpdateRules(c *gin.Context)

UpdateRules 更新promql模板三级目录rule @Tags Observability @Summary 更新promql模板三级目录rule @Description 更新promql模板三级目录rule @Accept json @Produce json @Param tenant_id path string true "租户ID" @Param rule_id path string true "rule ID" @Param param body models.PromqlTplRule true "rule" @Success 200 {object} handlers.ResponseStruct{Data=[]models.PromqlTplScope} "resp" @Router /v1/observability/tenant/{tenant_id}/template/rules/{rule_id} [put] @Security JWT

type OtelOverViewResp added in v1.23.0

type OtelOverViewResp struct {
	P90ServiceDurationSeconds   []KV `json:"p90ServiceDurationSeconds"`   // p90最耗时服务
	P90OperationDurationSeconds []KV `json:"p90OperationDurationSeconds"` // p90最耗时操作
	ServiceErrorCount           []KV `json:"serviceErrorCount"`           // 服务错误数
	DBOperationCount            []KV `json:"dbOperationCount"`            // 数据库操作数
}

type OtelView added in v1.23.0

type OtelView struct {
	LabelName  string                           `json:"labelname"`
	LabelValue string                           `json:"labelvalue"`
	ValueMap   map[string]prommodel.SampleValue `json:"valueMap"`
}

type OtelViews added in v1.23.0

type OtelViews map[string]*OtelView

type PluginConfig

type PluginConfig struct {
	Throttle        int      `json:"throttle"`        // 日志条目限速, 条/10s
	GeoIPLookupKeys []string `json:"geoIPLookupKeys"` // GeoIP keys
}

type TableRet

type TableRet struct {
	GroupValue string `json:"groupValue,omitempty"`
	Count      int    `json:"count,omitempty"`
}

Jump to

Keyboard shortcuts

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