request、proxy监控指标完成

This commit is contained in:
Liujian
2022-12-21 13:11:15 +08:00
parent 088fc79f8a
commit c7b564ec91
15 changed files with 71 additions and 38 deletions

View File

@@ -3,6 +3,8 @@ package http_router
import (
"net/http"
"github.com/eolinker/eosc/utils"
http_service "github.com/eolinker/apinto/node/http-context"
http_complete "github.com/eolinker/apinto/drivers/router/http-router/http-complete"
@@ -49,10 +51,15 @@ func (h *httpHandler) ServeHTTP(ctx eocontext.EoContext) {
}
ctx = wsCtx
}
globalLabels := utils.GlobalLabelGet()
for key, value := range globalLabels {
ctx.SetLabel(key, value)
}
//Set Label
ctx.SetLabel("api", h.routerName)
ctx.SetLabel("api_id", h.routerId)
ctx.SetLabel("service", h.serviceName)
ctx.SetLabel("service_id", h.service.Id())
ctx.SetLabel("ip", httpContext.Request().ReadIP())
ctx.SetFinish(h.finisher)
ctx.SetCompleteHandler(h.completeHandler)