@@ -161,6 +161,10 @@ func (s *AdminServer) registerURL() {
161161 })
162162}
163163
164+ // @Summary 获取proxy prometheus指标信息
165+ // @Description 获取gaea proxy prometheus指标信息
166+ // @Security BasicAuth
167+ // @Router /api/metric/metrics [get]
164168func (s * AdminServer ) registerMetric () {
165169 metricGroup := s .engine .Group ("/api/metric" , gin .BasicAuth (gin.Accounts {s .adminUser : s .adminPassword }))
166170 for path , handler := range s .proxy .manager .GetStatisticManager ().GetHandlers () {
@@ -254,10 +258,22 @@ func (s *AdminServer) unregisterProxy() error {
254258 return nil
255259}
256260
261+ // @Summary 获取proxy admin接口状态
262+ // @Description 获取proxy admin接口状态
263+ // @Success 200 {string} string "OK"
264+ // @Security BasicAuth
265+ // @Router /api/proxy/ping [get]
257266func (s * AdminServer ) ping (c * gin.Context ) {
258267 c .JSON (http .StatusOK , "OK" )
259268}
260269
270+ // @Summary prepare namespace配置
271+ // @Description 通过管理接口, 二阶段提交, prepare namespace配置
272+ // @Produce json
273+ // @Param name path string true "namespace name"
274+ // @Success 200 {string} string "OK"
275+ // @Security BasicAuth
276+ // @Router /api/proxy/config/prepare/{name} [put]
261277func (s * AdminServer ) prepareConfig (c * gin.Context ) {
262278 name := strings .TrimSpace (c .Param ("name" ))
263279 if name == "" {
@@ -275,6 +291,13 @@ func (s *AdminServer) prepareConfig(c *gin.Context) {
275291 c .JSON (http .StatusOK , "OK" )
276292}
277293
294+ // @Summary commit namespace配置
295+ // @Description 通过管理接口, 二阶段提交, commit namespace配置, 使etcd配置生效
296+ // @Produce json
297+ // @Param name path string true "namespace name"
298+ // @Success 200 {string} string "OK"
299+ // @Security BasicAuth
300+ // @Router /api/proxy/config/commit/{name} [put]
278301func (s * AdminServer ) commitConfig (c * gin.Context ) {
279302 name := strings .TrimSpace (c .Param ("name" ))
280303 if name == "" {
@@ -289,6 +312,13 @@ func (s *AdminServer) commitConfig(c *gin.Context) {
289312 c .JSON (http .StatusOK , "OK" )
290313}
291314
315+ // @Summary 删除namespace配置
316+ // @Description 通过管理接口删除指定namespace配置
317+ // @Produce json
318+ // @Param name path string true "namespace name"
319+ // @Success 200 {string} string "OK"
320+ // @Security BasicAuth
321+ // @Router /api/proxy/config/delete/{name} [put]
292322func (s * AdminServer ) deleteNamespace (c * gin.Context ) {
293323 name := strings .TrimSpace (c .Param ("name" ))
294324 if name == "" {
@@ -304,11 +334,23 @@ func (s *AdminServer) deleteNamespace(c *gin.Context) {
304334 c .JSON (http .StatusOK , "OK" )
305335}
306336
337+ // @Summary 返回配置指纹
338+ // @Description 返回配置指纹, 指纹随配置变化而变化
339+ // @Produce json
340+ // @Success 200 {string} string "Config Fingerprint"
341+ // @Security BasicAuth
342+ // @Router /api/proxy/config/fingerprint [get]
307343func (s * AdminServer ) configFingerprint (c * gin.Context ) {
308344 c .JSON (http .StatusOK , s .proxy .manager .ConfigFingerprint ())
309345}
310346
311- // getNamespaceSessionSQLFingerprint return namespace sql fingerprint information
347+ // @Summary 获取Porxy 慢SQL、错误SQL信息
348+ // @Description 通过管理接口获取Porxy 慢SQL、错误SQL信息
349+ // @Produce json
350+ // @Param namespace path string true "namespace name"
351+ // @Success 200 {object} SQLFingerprint
352+ // @Security BasicAuth
353+ // @Router /api/proxy/stats/sessionsqlfingerprint/{namespace} [get]
312354func (s * AdminServer ) getNamespaceSessionSQLFingerprint (c * gin.Context ) {
313355 ns := strings .TrimSpace (c .Param ("namespace" ))
314356 namespace := s .proxy .manager .GetNamespace (ns )
@@ -324,6 +366,13 @@ func (s *AdminServer) getNamespaceSessionSQLFingerprint(c *gin.Context) {
324366 c .JSON (http .StatusOK , ret )
325367}
326368
369+ // @Summary 获取后端节点慢SQL、错误SQL信息
370+ // @Description 通过管理接口获取后端节点慢SQL、错误SQL信息
371+ // @Produce json
372+ // @Param namespace path string true "namespace name"
373+ // @Success 200 {object} SQLFingerprint
374+ // @Security BasicAuth
375+ // @Router /api/proxy/stats/backendsqlfingerprint/{namespace} [get]
327376func (s * AdminServer ) getNamespaceBackendSQLFingerprint (c * gin.Context ) {
328377 ns := strings .TrimSpace (c .Param ("namespace" ))
329378 namespace := s .proxy .manager .GetNamespace (ns )
@@ -339,6 +388,13 @@ func (s *AdminServer) getNamespaceBackendSQLFingerprint(c *gin.Context) {
339388 c .JSON (http .StatusOK , ret )
340389}
341390
391+ // @Summary 清空Porxy节点慢SQL、错误SQL信息
392+ // @Description 通过管理接口清空Porxy慢SQL、错误SQL信息
393+ // @Produce json
394+ // @Param namespace path string true "namespace name"
395+ // @Success 200 {object} SQLFingerprint
396+ // @Security BasicAuth
397+ // @Router /api/proxy/stats/sessionsqlfingerprint/{namespace} [delete]
342398func (s * AdminServer ) clearNamespaceSessionSQLFingerprint (c * gin.Context ) {
343399 ns := strings .TrimSpace (c .Param ("namespace" ))
344400 namespace := s .proxy .manager .GetNamespace (ns )
@@ -353,6 +409,13 @@ func (s *AdminServer) clearNamespaceSessionSQLFingerprint(c *gin.Context) {
353409 c .JSON (http .StatusOK , "OK" )
354410}
355411
412+ // @Summary 清空后端节点慢SQL、错误SQL信息
413+ // @Description 通过管理接口清空后端节点慢SQL、错误SQL信息
414+ // @Produce json
415+ // @Param namespace path string true "namespace name"
416+ // @Success 200 {object} SQLFingerprint
417+ // @Security BasicAuth
418+ // @Router /api/proxy/stats/backendsqlfingerprint/{namespace} [delete]
356419func (s * AdminServer ) clearNamespaceBackendSQLFingerprint (c * gin.Context ) {
357420 ns := strings .TrimSpace (c .Param ("namespace" ))
358421 namespace := s .proxy .manager .GetNamespace (ns )
0 commit comments