fixup handlers
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
b89d9fdc5b
commit
b3e58d2cb6
@ -9,7 +9,6 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
codecpb "go.unistack.org/micro-proto/v3/codec"
|
codecpb "go.unistack.org/micro-proto/v3/codec"
|
||||||
"go.unistack.org/micro/v3/errors"
|
|
||||||
"go.unistack.org/micro/v3/logger"
|
"go.unistack.org/micro/v3/logger"
|
||||||
"go.unistack.org/micro/v3/metadata"
|
"go.unistack.org/micro/v3/metadata"
|
||||||
"go.unistack.org/micro/v3/meter"
|
"go.unistack.org/micro/v3/meter"
|
||||||
@ -81,7 +80,7 @@ func NewHandler(opts ...Option) *Handler {
|
|||||||
func (h *Handler) Metrics(ctx context.Context, req *codecpb.Frame, rsp *codecpb.Frame) error {
|
func (h *Handler) Metrics(ctx context.Context, req *codecpb.Frame, rsp *codecpb.Frame) error {
|
||||||
log, ok := logger.FromContext(ctx)
|
log, ok := logger.FromContext(ctx)
|
||||||
if !ok {
|
if !ok {
|
||||||
log = logger.DefaultLogger()
|
log = logger.DefaultLogger
|
||||||
}
|
}
|
||||||
|
|
||||||
buf := bufPool.Get().(*bytes.Buffer)
|
buf := bufPool.Get().(*bytes.Buffer)
|
||||||
@ -102,7 +101,7 @@ func (h *Handler) Metrics(ctx context.Context, req *codecpb.Frame, rsp *codecpb.
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err := h.opts.Meter.Write(w, h.opts.MeterOptions...); err != nil {
|
if err := h.opts.Meter.Write(w, h.opts.MeterOptions...); err != nil {
|
||||||
log.Error(ctx, errors.InternalServerError(h.opts.Name, "%v", err))
|
log.Error(ctx, "http/meter write failed", err)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user