cmd;pkg/server: init tracing collector in all processes

Add tracing handler in drpc server.
Initializing tracing collector in admin, satellite api, garbage
collection, satellite core, repaier, storagenode.
Change-Id: Ie98420e35dfc6913836ebd82b517d9d12877aefc

Change-Id: I91057b6265a4ac8bde033dfde692b8a28acca99f
This commit is contained in:
Yingrong Zhao 2020-03-30 11:22:32 -04:00
parent 43cf036113
commit 96e58d21b4
10 changed files with 60 additions and 24 deletions

View File

@ -64,7 +64,11 @@ func cmdAdminRun(cmd *cobra.Command, args []string) (err error) {
}
if err := process.InitMetricsWithCertPath(ctx, log, nil, runCfg.Identity.CertPath); err != nil {
zap.S().Warn("Failed to initialize telemetry batcher on satellite api: ", err)
zap.S().Warn("Failed to initialize telemetry batcher on satellite admin: ", err)
}
if err := process.InitTracingWithCertPath(ctx, log, nil, runCfg.Identity.CertPath); err != nil {
zap.S().Warn("Failed to initialize tracing collector on satellite admin: ", err)
}
err = db.CheckVersion(ctx)

View File

@ -82,6 +82,9 @@ func cmdAPIRun(cmd *cobra.Command, args []string) (err error) {
if err := process.InitMetricsWithHostname(ctx, log, nil); err != nil {
zap.S().Warn("Failed to initialize telemetry batcher on satellite api: ", err)
}
if err := process.InitTracingWithHostname(ctx, log, nil, runCfg.Identity.CertPath); err != nil {
zap.S().Warn("Failed to initialize tracing collector on satellite api: ", err)
}
err = db.CheckVersion(ctx)
if err != nil {

View File

@ -65,6 +65,10 @@ func cmdGCRun(cmd *cobra.Command, args []string) (err error) {
zap.S().Warn("Failed to initialize telemetry batcher on satellite GC: ", err)
}
if err := process.InitTracingWithCertPath(ctx, log, nil, runCfg.Identity.CertPath); err != nil {
zap.S().Warn("Failed to initialize tracing collector on satellite GC: ", err)
}
err = db.CheckVersion(ctx)
if err != nil {
zap.S().Fatal("failed satellite database version check for GC: ", err)

View File

@ -314,6 +314,9 @@ func cmdRun(cmd *cobra.Command, args []string) (err error) {
zap.S().Warn("Failed to initialize telemetry batcher: ", err)
}
if err := process.InitTracingWithCertPath(ctx, log, nil, runCfg.Identity.CertPath); err != nil {
zap.S().Warn("Failed to initialize tracing collector: ", err)
}
err = db.CheckVersion(ctx)
if err != nil {
zap.S().Fatal("failed satellite database version check: ", err)

View File

@ -84,6 +84,10 @@ func cmdRepairerRun(cmd *cobra.Command, args []string) (err error) {
zap.S().Warn("Failed to initialize telemetry batcher on repairer: ", err)
}
if err := process.InitTracingWithHostname(ctx, log, nil, runCfg.Identity.CertPath); err != nil {
zap.S().Warn("Failed to initialize tracing collector on repairer: ", err)
}
err = db.CheckVersion(ctx)
if err != nil {
zap.S().Fatal("failed satellite database version check: ", err)

View File

@ -186,6 +186,9 @@ func cmdRun(cmd *cobra.Command, args []string) (err error) {
zap.S().Warn("Failed to initialize telemetry batcher: ", err)
}
if err := process.InitTracingWithCertPath(ctx, log, nil, runCfg.Identity.CertPath); err != nil {
zap.S().Warn("Failed to initialize tracing collector: ", err)
}
err = db.CreateTables(ctx)
if err != nil {
return errs.New("Error creating tables for master database on storagenode: %+v", err)

7
go.mod
View File

@ -27,7 +27,7 @@ require (
github.com/nsf/termbox-go v0.0.0-20190121233118-02980233997d
github.com/shopspring/decimal v0.0.0-20200105231215-408a2507e114
github.com/sirupsen/logrus v1.4.2 // indirect
github.com/spacemonkeygo/monkit/v3 v3.0.5
github.com/spacemonkeygo/monkit/v3 v3.0.6-0.20200327233048-76480079049a
github.com/spf13/cast v1.3.0
github.com/spf13/cobra v0.0.6
github.com/spf13/pflag v1.0.5
@ -43,9 +43,10 @@ require (
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5
golang.org/x/time v0.0.0-20191024005414-555d28b269f0
google.golang.org/grpc v1.28.0
storj.io/common v0.0.0-20200406083704-0c6466fbde8b
storj.io/common v0.0.0-20200407070412-ce42115bd3d1
storj.io/drpc v0.0.11
storj.io/private v0.0.0-20200327035409-e9d82e7e0c6b
storj.io/monkit-jaeger v0.0.0-20200403204040-f5a746eeacca
storj.io/private v0.0.0-20200403212157-26f222c154f0
storj.io/uplink v1.0.4-0.20200406100056-baa89e6fe434
// storj/gatway for storj-sim is installed via makefile `install-sim` target

28
go.sum
View File

@ -296,6 +296,8 @@ github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
@ -330,8 +332,6 @@ github.com/sirupsen/logrus v1.4.1 h1:GL2rEmy6nsikmW0r8opw9JIRScdMF5hA8cOYLH7In1k
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/skyrings/skyring-common v0.0.0-20160929130248-d1c0bb1cbd5e h1:jrZSSgPUDtBeJbGXqgGUeupQH8I+ZvGXfhpIahye2Bc=
github.com/skyrings/skyring-common v0.0.0-20160929130248-d1c0bb1cbd5e/go.mod h1:d8hQseuYt4rJoOo21lFzYJdhMjmDqLY++ayArbgYjWI=
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
github.com/spacemonkeygo/errors v0.0.0-20171212215202-9064522e9fd1 h1:xHQewZjohU9/wUsyC99navCjQDNHtTgUOM/J1jAbzfw=
github.com/spacemonkeygo/errors v0.0.0-20171212215202-9064522e9fd1/go.mod h1:7NL9UAYQnRM5iKHUCld3tf02fKb5Dft+41+VckASUy0=
@ -340,6 +340,8 @@ github.com/spacemonkeygo/monkit/v3 v3.0.4 h1:Ay+PZirv+qfd4sqcT+X/U3BnC7AcIaqp/IX
github.com/spacemonkeygo/monkit/v3 v3.0.4/go.mod h1:JcK1pCbReQsOsMKF/POFSZCq7drXFybgGmbc27tuwes=
github.com/spacemonkeygo/monkit/v3 v3.0.5 h1:vMW8Ne6WAUU/OMYaSv7KGW9h/sRNgeh6TyBapOSuMhM=
github.com/spacemonkeygo/monkit/v3 v3.0.5/go.mod h1:JcK1pCbReQsOsMKF/POFSZCq7drXFybgGmbc27tuwes=
github.com/spacemonkeygo/monkit/v3 v3.0.6-0.20200327233048-76480079049a h1:KjuRkb+1Gjt8p0nsqaYwnScor4CiaflqbOa6unUgz7U=
github.com/spacemonkeygo/monkit/v3 v3.0.6-0.20200327233048-76480079049a/go.mod h1:JcK1pCbReQsOsMKF/POFSZCq7drXFybgGmbc27tuwes=
github.com/spacemonkeygo/monotime v0.0.0-20180824235756-e3f48a95f98a h1:8+cCjxhToanKmxLIbuyBNe2EnpgwhiivsIaRJstDRFA=
github.com/spacemonkeygo/monotime v0.0.0-20180824235756-e3f48a95f98a/go.mod h1:ul4bvvnCOPZgq8w0nTkSmWVg/hauVpFS97Am1YM1XXo=
github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 h1:RC6RW7j+1+HkWaX/Yh71Ee5ZHaHYt7ZP4sQgUrm6cDU=
@ -386,7 +388,6 @@ github.com/zeebo/admission/v2 v2.0.0/go.mod h1:gSeHGelDHW7Vq6UyJo2boeSt/6Dsnqpis
github.com/zeebo/admission/v3 v3.0.1 h1:/IWg2jLhfjBOUhhdKcbweSzcY3QlbbE57sqvU72EpqA=
github.com/zeebo/admission/v3 v3.0.1/go.mod h1:BP3isIv9qa2A7ugEratNq1dnl2oZRXaQUGdU7WXKtbw=
github.com/zeebo/assert v0.0.0-20181109011804-10f827ce2ed6/go.mod h1:yssERNPivllc1yU3BvpjYI5BUW+zglcz6QWqeVRL5t0=
github.com/zeebo/assert v1.0.0/go.mod h1:yssERNPivllc1yU3BvpjYI5BUW+zglcz6QWqeVRL5t0=
github.com/zeebo/assert v1.1.0 h1:hU1L1vLTHsnO8x8c9KAR5GmM5QscxHg5RNU5z5qbUWY=
github.com/zeebo/assert v1.1.0/go.mod h1:Pq9JiuJQpG8JLJdtkwrJESF0Foym2/D9XMU5ciN/wJ0=
github.com/zeebo/errs v1.1.1/go.mod h1:Yj8dHrUQwls1bF3dr/vcSIu+qf4mI7idnTcHfoACc6I=
@ -476,6 +477,8 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL
golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa h1:F+8P+gmewFQYRk6JoLQLwjBCTu3mcIURZfNkVweuRKA=
golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b h1:0mm1VjtFUOIlE1SbDlwjYaDxZVDP2S5ou6y0gSgXHu8=
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@ -618,22 +621,11 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh
honnef.co/go/tools v0.0.1-2019.2.3 h1:3JgtbtFHMiCmsznwGVTUWbgGov+pVqnlf1dEJTNAXeM=
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
storj.io/common v0.0.0-20200323134045-2bd4d6e2dd7d h1:R4qel+wubcKJP8HvWromOGOplbAlpVNwfIkDkFD4RY0=
storj.io/common v0.0.0-20200323134045-2bd4d6e2dd7d/go.mod h1:I0QTs7z1rI+ZEN95GGY2LKMzP5OZqu0Udga3WhyQfO0=
storj.io/common v0.0.0-20200331124657-a4f8265946f2 h1:Fctei5lPPAfbvtpijLQZTjQeeuh+MCkacLYau7nyxKA=
storj.io/common v0.0.0-20200331124657-a4f8265946f2/go.mod h1:RBaNRmk/lqyZ7h1MAH4N9zld0z+tO4M9sLOFT30K+cE=
storj.io/common v0.0.0-20200402141439-ea355ebf34e9 h1:f/QpTOgCXhoZ4es+Pm0l2TKnvC6FbwuUtD62sVBAhag=
storj.io/common v0.0.0-20200402141439-ea355ebf34e9/go.mod h1:pZyXiIE7bGETIRXtfs0nICqMwp7PM8HqnDuyUeldNA0=
storj.io/common v0.0.0-20200402141523-7780ee0cca0d h1:/QsP2I8m7/nJuXZr3nZhoCUz1LobDldeCZeiOBAo190=
storj.io/common v0.0.0-20200402141523-7780ee0cca0d/go.mod h1:pZyXiIE7bGETIRXtfs0nICqMwp7PM8HqnDuyUeldNA0=
storj.io/common v0.0.0-20200406083704-0c6466fbde8b h1:SoER1i5yjTjL/TB5tkhh/tOephtf4TqCJW+OQDrSvpI=
storj.io/common v0.0.0-20200406083704-0c6466fbde8b/go.mod h1:pZyXiIE7bGETIRXtfs0nICqMwp7PM8HqnDuyUeldNA0=
storj.io/drpc v0.0.7-0.20191115031725-2171c57838d2/go.mod h1:/ascUDbzNAv0A3Jj7wUIKFBH2JdJ2uJIBO/b9+2yHgQ=
storj.io/drpc v0.0.11 h1:6vLxfpSbwCLtqzAoXzXx/SxBqBtbzbmquXPqfcWKqfw=
storj.io/common v0.0.0-20200407070412-ce42115bd3d1 h1:GBUmaoHagdido+jX/VFuA/XRHqY010oRHqkldtp4GM8=
storj.io/common v0.0.0-20200407070412-ce42115bd3d1/go.mod h1:pZyXiIE7bGETIRXtfs0nICqMwp7PM8HqnDuyUeldNA0=
storj.io/drpc v0.0.11/go.mod h1:TiFc2obNjL9/3isMW1Rpxjy8V9uE0B2HMeMFGiiI7Iw=
storj.io/private v0.0.0-20200327035409-e9d82e7e0c6b h1:loru+Vg+FdSxGIajoLUl2JRo4rDk6kPwU4PXN89nHvM=
storj.io/private v0.0.0-20200327035409-e9d82e7e0c6b/go.mod h1:I09FR2ZU1Dy1vaQ2SkUbfGpwVtJrwafjYWGw8W808WE=
storj.io/uplink v1.0.4-0.20200402121754-b505de28b00e h1:6q1z5uBzKttqLR6s8ObQT4Ok6n5xASDZzjTiVf/6FfQ=
storj.io/uplink v1.0.4-0.20200402121754-b505de28b00e/go.mod h1:emdQZ1n7/YUPRhuk8XznZaQeV5fVkBTJTOImq4af76c=
storj.io/uplink v1.0.4-0.20200406100056-baa89e6fe434 h1:GfuoaAq9VLdC19+T8H//WPQjzOhyU1otpBme/O6R5JM=
storj.io/monkit-jaeger v0.0.0-20200403204040-f5a746eeacca/go.mod h1:DDyAU2mcmu8EAh2vSfvPwrKBOo5a1UBnoTG0dba0KTs=
storj.io/private v0.0.0-20200403212157-26f222c154f0/go.mod h1:s0T6C5sBLRubb5uT+FbE4ZGaLBUs6jZ/qzGp/OvVpCI=
storj.io/uplink v1.0.4-0.20200406100056-baa89e6fe434/go.mod h1:bGqCqd9cuAw3WCXznwN6iwmJhhJE5omGx1C28XevHGQ=

View File

@ -17,8 +17,10 @@ import (
"storj.io/common/identity"
"storj.io/common/peertls/tlsopts"
"storj.io/common/rpc"
"storj.io/common/rpc/rpctracing"
"storj.io/drpc/drpcmux"
"storj.io/drpc/drpcserver"
jaeger "storj.io/monkit-jaeger"
"storj.io/storj/pkg/listenmux"
"storj.io/storj/private/grpctlsopts"
)
@ -89,9 +91,10 @@ func New(log *zap.Logger, tlsOptions *tlsopts.Options, publicAddr, privateAddr s
}
publicMux := drpcmux.New()
publicTracingHandler := rpctracing.NewHandler(publicMux, jaeger.RemoteTraceHandler)
server.public = public{
listener: wrapListener(publicListener),
drpc: drpcserver.NewWithOptions(publicMux, serverOptions),
drpc: drpcserver.NewWithOptions(publicTracingHandler, serverOptions),
grpc: grpc.NewServer(
grpc.ChainStreamInterceptor(
server.logOnErrorStreamInterceptor,
@ -108,9 +111,10 @@ func New(log *zap.Logger, tlsOptions *tlsopts.Options, publicAddr, privateAddr s
return nil, errs.Combine(err, publicListener.Close())
}
privateMux := drpcmux.New()
privateTracingHandler := rpctracing.NewHandler(privateMux, jaeger.RemoteTraceHandler)
server.private = private{
listener: wrapListener(privateListener),
drpc: drpcserver.NewWithOptions(privateMux, serverOptions),
drpc: drpcserver.NewWithOptions(privateTracingHandler, serverOptions),
grpc: grpc.NewServer(),
mux: privateMux,
}

View File

@ -555,6 +555,24 @@ server.private-address: 127.0.0.1:7778
# how frequently the tally service should run
# tally.interval: 1h0m0s
# address for jaeger agent
# tracing.agent-addr: ""
# application name for tracing identification
# tracing.app: satellite
# application suffix
# tracing.app-suffix: -release
# buffer size for collector batch packet size
# tracing.buffer-size: 0
# buffer size for collector queue size
# tracing.queue-size: 0
# how frequently to send up telemetry
# tracing.sample: 0
# Interval to check the version
# version.check-interval: 15m0s