add requests/errors to stats

This commit is contained in:
Asim Aslam
2019-12-18 18:36:42 +00:00
parent d4bec24eb7
commit d52a111735
8 changed files with 197 additions and 59 deletions

View File

@@ -14,6 +14,7 @@ import (
"github.com/micro/go-micro/debug/profile/http"
"github.com/micro/go-micro/debug/profile/pprof"
"github.com/micro/go-micro/debug/service/handler"
"github.com/micro/go-micro/debug/stats"
"github.com/micro/go-micro/plugin"
"github.com/micro/go-micro/server"
"github.com/micro/go-micro/util/log"
@@ -35,6 +36,9 @@ func newService(opts ...Option) Service {
// wrap client to inject From-Service header on any calls
options.Client = wrapper.FromService(serviceName, options.Client)
// wrap the server to provide handler stats
options.Server.Init(server.WrapHandler(wrapper.HandlerStats(stats.DefaultStats)))
return &service{
opts: options,
}