forked from mtusi2026/mtusi2026lab3
Реализовать lab3 в общем Helm-релизе с Traefik, TLS и HPA
This commit is contained in:
@@ -16,12 +16,18 @@ import (
|
||||
// request assigns a request identifier, handles errors and logs the completed request.
|
||||
func (ctrl *Controller) request(ctx *fiber.Ctx) error {
|
||||
ctx.Set(headerRequestID, uuid.NewString())
|
||||
ctx.Set("X-Instance-Id", ctrl.instanceID)
|
||||
started := time.Now()
|
||||
ctrl.metrics.active.Inc()
|
||||
defer ctrl.metrics.active.Dec()
|
||||
err := ctx.Next()
|
||||
if err != nil {
|
||||
err = ctrl.handleErr(ctx, err)
|
||||
}
|
||||
ctrl.logRequest(ctx, time.Since(started))
|
||||
if ctx.Path() != "/metrics" {
|
||||
ctrl.metrics.observe(ctx, time.Since(started))
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user