2023-03-13 11:01:43 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
tracingconfig "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-node/config/tracing"
|
2023-04-12 14:35:10 +00:00
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs"
|
2023-05-31 09:24:04 +00:00
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-observability/tracing"
|
2023-03-13 11:01:43 +00:00
|
|
|
"go.uber.org/zap"
|
|
|
|
)
|
|
|
|
|
|
|
|
func initTracing(ctx context.Context, c *cfg) {
|
|
|
|
conf := tracingconfig.ToTracingConfig(c.appCfg)
|
|
|
|
|
|
|
|
_, err := tracing.Setup(ctx, *conf)
|
|
|
|
if err != nil {
|
2023-04-12 14:35:10 +00:00
|
|
|
c.log.Error(logs.FrostFSNodeFailedInitTracing, zap.Error(err))
|
2023-03-13 11:01:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
c.closers = append(c.closers, closer{
|
|
|
|
name: "tracing",
|
|
|
|
fn: func() {
|
|
|
|
ctx, cancel := context.WithTimeout(context.Background(), time.Second*5)
|
|
|
|
defer cancel()
|
2023-10-31 11:56:55 +00:00
|
|
|
err := tracing.Shutdown(ctx) // cfg context cancels before close
|
2023-03-13 11:01:43 +00:00
|
|
|
if err != nil {
|
2023-04-12 14:35:10 +00:00
|
|
|
c.log.Error(logs.FrostFSNodeFailedShutdownTracing, zap.Error(err))
|
2023-03-13 11:01:43 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
})
|
|
|
|
}
|