meter/handler: fix func signature

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2021-03-25 12:34:34 +03:00
parent d2a30a5da1
commit eb2a450a7b
4 changed files with 5 additions and 7 deletions

View File

@ -24,7 +24,7 @@ func NewHandler(meter meter.Meter, opts ...meter.Option) *handler {
return &handler{meter: meter, opts: opts} return &handler{meter: meter, opts: opts}
} }
func (h *handler) Metrics(ctx context.Context, req *Empty, rsp *codec.Frame) error { func (h *handler) Metrics(ctx context.Context, req *codec.Frame, rsp *codec.Frame) error {
buf := bytes.NewBuffer(nil) buf := bytes.NewBuffer(nil)
if err := h.meter.Write(buf, h.opts...); err != nil { if err := h.meter.Write(buf, h.opts...); err != nil {
return err return err

View File

@ -8,7 +8,7 @@ import "openapiv2/annotations.proto";
import "codec/frame.proto"; import "codec/frame.proto";
service Meter { service Meter {
rpc Metrics(Empty) returns (micro.codec.Frame) { rpc Metrics(micro.codec.Frame) returns (micro.codec.Frame) {
option (micro.openapiv2.openapiv2_operation) = { option (micro.openapiv2.openapiv2_operation) = {
operation_id: "Metrics"; operation_id: "Metrics";
responses: { responses: {
@ -26,5 +26,3 @@ service Meter {
option (micro.api.http) = { get: "/metrics"; }; option (micro.api.http) = { get: "/metrics"; };
}; };
}; };
message Empty{};

View File

@ -20,5 +20,5 @@ func NewMeterEndpoints() []*api.Endpoint {
} }
type MeterServer interface { type MeterServer interface {
Metrics(ctx context.Context, req *Empty, rsp *codec.Frame) error Metrics(ctx context.Context, req *codec.Frame, rsp *codec.Frame) error
} }

View File

@ -13,13 +13,13 @@ type meterServer struct {
MeterServer MeterServer
} }
func (h *meterServer) Metrics(ctx context.Context, req *Empty, rsp *codec.Frame) error { func (h *meterServer) Metrics(ctx context.Context, req *codec.Frame, rsp *codec.Frame) error {
return h.MeterServer.Metrics(ctx, req, rsp) return h.MeterServer.Metrics(ctx, req, rsp)
} }
func RegisterMeterServer(s server.Server, sh MeterServer, opts ...server.HandlerOption) error { func RegisterMeterServer(s server.Server, sh MeterServer, opts ...server.HandlerOption) error {
type meter interface { type meter interface {
Metrics(ctx context.Context, req *Empty, rsp *codec.Frame) error Metrics(ctx context.Context, req *codec.Frame, rsp *codec.Frame) error
} }
type Meter struct { type Meter struct {
meter meter