observability

package
v1.21.2 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2022 License: Apache-2.0 Imports: 40 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 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 // 不传则自动生成,目前不支持前端传

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

	SeriesSelector string // 用于查标签值: ref. https://prometheus.io/docs/prometheus/latest/querying/basics/#time-series-selectors

	Label string // 要查询的标签值
}

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) AddOrUpdateMetricTemplate

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

AddOrUpdateMetricTemplate 添加/更新prometheu查询模板 @Tags Observability @Summary 添加prometheu查询模板 @Description 添加prometheu查询模板 @Accept json @Produce json @Param resource_name path string true "resource" @Param rule_name path string true "rule" @Param from body prometheus.RuleDetail true "查询模板配置" @Success 200 {object} handlers.ResponseStruct{Data=string} "resp" @Router /v1/observability/template/resources/{resource_name}/rules/{rule_name} [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) 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) 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 prometheus.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 prometheus.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) CreateReceiver

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

CreateReceiver 创建(日志/监控)告警接收器 @Tags Observability @Summary 创建(日志/监控)告警接收器 @Description 创建(日志/监控)告警接收器 @Accept json @Produce json @Param cluster path string true "cluster" @Param namespace path string true "namespace" @Param form body prometheus.ReceiverConfig true "body" @Success 200 {object} handlers.ResponseStruct{Data=string} "resp" @Router /v1/observability/cluster/{cluster}/namespaces/{namespace}/receivers [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) 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) 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) DeleteMetricTemplate

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

DeleteMetricTemplate 删除prometheu查询模板 @Tags Observability @Summary 删除prometheu查询模板 @Description 删除prometheu查询模板 @Accept json @Produce json @Param resource_name path string true "resource" @Param rule_name path string true "rule" @Success 200 {object} handlers.ResponseStruct{Data=string} "resp" @Router /v1/observability/template/resources/{resource_name}/rules/{rule_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) DeleteReceiver

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

DeleteReceiver 删除(日志/监控)告警接收器 @Tags Observability @Summary 删除(日志/监控)告警接收器 @Description 删除(日志/监控)告警接收器 @Accept json @Produce json @Param cluster path string true "cluster" @Param namespace path string true "namespace" @Param source query string true "source" @Param name path string true "name" @Success 200 {object} handlers.ResponseStruct{Data=string} "resp" @Router /v1/observability/cluster/{cluster}/namespaces/{namespace}/receivers/{name} [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) 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=prometheus.LoggingAlertRule} "resp" @Router /v1/observability/cluster/{cluster}/namespaces/{namespace}/logging/alerts/{name} [get] @Security JWT

func (*ObservabilityHandler) GetMetricTemplate

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

GetMetricTemplate 获取prometheu查询模板 @Tags Observability @Summary 获取prometheu查询模板 @Description 获取prometheu查询模板 @Accept json @Produce json @Param resource_name path string true "resource" @Param rule_name path string true "rule" @Success 200 {object} handlers.ResponseStruct{Data=prometheus.RuleDetail} "resp" @Router /v1/observability/template/resources/{resource_name}/rules/{rule_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=prometheus.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) 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 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) 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 @Success 200 {object} handlers.ResponseStruct{Data=[]models.MonitorDashboard} "resp" @Router /v1/observability/template/dashboard [delete] @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=[]prometheus.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=[]prometheus.MonitorAlertRule} "resp" @Router /v1/observability/cluster/{cluster}/namespaces/{namespace}/monitor/alerts [get] @Security JWT

func (*ObservabilityHandler) ListReceiver

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

ListReceiver (日志/监控)告警接收器列表 @Tags Observability @Summary (日志/监控)告警接收器列表 @Description (日志/监控)告警接收器列表 @Accept json @Produce json @Param cluster path string true "cluster" @Param namespace path string true "namespace" @Param scope query string true "接收器类型(monitor/logging)" @Param search query string true "search" @Success 200 {object} handlers.ResponseStruct{Data=[]prometheus.ReceiverConfig} "resp" @Router /v1/observability/cluster/{cluster}/namespaces/{namespace}/receivers [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) 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 resource query string false "告警资源,默认所有" @Param rule query string false "告警指标,默认所有" @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) TestEmail

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

TestEmail 发送测试邮件 @Tags Observability @Summary 发送测试邮件 @Description 发送测试邮件 @Accept json @Produce json @Param cluster path string true "cluster" @Param namespace path string true "namespace" @Param form body prometheus.EmailConfig true "body" @Success 200 {object} handlers.ResponseStruct{Data=string} "resp" @Router /v1/observability/cluster/{cluster}/namespaces/{namespace}/receivers/_/actions/test [post] @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) 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 prometheus.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 prometheus.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) UpdateReceiver

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

UpdateReceiver 更新(日志/监控)告警接收器 @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 prometheus.ReceiverConfig true "body" @Success 200 {object} handlers.ResponseStruct{Data=string} "resp" @Router /v1/observability/cluster/{cluster}/namespaces/{namespace}/receivers/{name} [put] @Security JWT

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