forked from TrueCloudLab/frostfs-node
Evgenii Stratonikov
0e31c12e63
Drop duplicate entities. Format entities. Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com> Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
32 lines
840 B
Go
32 lines
840 B
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/pkg/tracing"
|
|
tracingconfig "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-node/config/tracing"
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs"
|
|
"go.uber.org/zap"
|
|
)
|
|
|
|
func initTracing(ctx context.Context, c *cfg) {
|
|
conf := tracingconfig.ToTracingConfig(c.appCfg)
|
|
|
|
_, err := tracing.Setup(ctx, *conf)
|
|
if err != nil {
|
|
c.log.Error(logs.FrostFSNodeFailedInitTracing, zap.Error(err))
|
|
}
|
|
|
|
c.closers = append(c.closers, closer{
|
|
name: "tracing",
|
|
fn: func() {
|
|
ctx, cancel := context.WithTimeout(context.Background(), time.Second*5)
|
|
defer cancel()
|
|
err := tracing.Shutdown(ctx) //cfg context cancels before close
|
|
if err != nil {
|
|
c.log.Error(logs.FrostFSNodeFailedShutdownTracing, zap.Error(err))
|
|
}
|
|
},
|
|
})
|
|
}
|