[#709] node: Put in log info about listening endpoints

Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
feature/121-client/object_put_single
Anton Nikiforov 2023-10-02 10:38:11 +03:00 committed by Evgenii Stratonikov
parent a0a35ffbec
commit 627b302745
5 changed files with 17 additions and 3 deletions

View File

@ -14,6 +14,8 @@ import (
"google.golang.org/grpc"
)
const serviceNameControl = "control"
type treeSynchronizer struct {
treeSvc *tree.Service
}
@ -66,7 +68,10 @@ func initControlService(c *cfg) {
control.RegisterControlServiceServer(c.cfgControlService.server, ctlSvc)
c.workers = append(c.workers, newWorkerFromFunc(func(ctx context.Context) {
runAndLog(ctx, c, "control", false, func(context.Context, *cfg) {
runAndLog(ctx, c, serviceNameControl, false, func(context.Context, *cfg) {
c.log.Info(logs.FrostFSNodeStartListeningEndpoint,
zap.String("service", serviceNameControl),
zap.String("endpoint", endpoint))
fatalOnErr(c.cfgControlService.server.Serve(lis))
})
}))

View File

@ -110,7 +110,8 @@ func serveGRPC(c *cfg) {
c.wg.Done()
}()
c.log.Info(logs.FrostFSNodeStartListeningGRPCEndpoint,
c.log.Info(logs.FrostFSNodeStartListeningEndpoint,
zap.String("service", "gRPC"),
zap.Stringer("endpoint", lis.Addr()),
)

View File

@ -6,7 +6,9 @@ import (
"net/http"
"time"
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs"
httputil "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/http"
"go.uber.org/zap"
)
type httpComponent struct {
@ -42,6 +44,9 @@ func (cmp *httpComponent) init(c *cfg) {
cmp.name,
func(ctx context.Context) {
runAndLog(ctx, c, cmp.name, false, func(context.Context, *cfg) {
c.log.Info(logs.FrostFSNodeStartListeningEndpoint,
zap.String("service", cmp.name),
zap.String("endpoint", cmp.address))
fatalOnErr(srv.Serve())
})
},

View File

@ -167,5 +167,7 @@ func connectNats(ctx context.Context, c *cfg) {
err := c.cfgNotifications.nw.w.Connect(ctx, endpoint)
if err != nil {
panic(fmt.Sprintf("could not connect to a nats endpoint %s: %v", endpoint, err))
} else {
c.log.Info(logs.NatsConnectedToEndpoint, zap.String("endpoint", endpoint))
}
}

View File

@ -123,6 +123,7 @@ const (
NatsNatsConnectionWasLost = "nats: connection was lost"
NatsNatsReconnectedToTheServer = "nats: reconnected to the server"
NatsNatsClosingConnectionAsTheContextIsDone = "nats: closing connection as the context is done"
NatsConnectedToEndpoint = "nats: successfully connected to endpoint"
ControllerStartingToAnnounceTheValuesOfTheMetrics = "starting to announce the values of the metrics"
ControllerCouldNotInitializeIteratorOverLocallyCollectedMetrics = "could not initialize iterator over locally collected metrics"
ControllerCouldNotInitializeAnnouncementAccumulator = "could not initialize announcement accumulator"
@ -413,10 +414,10 @@ const (
FrostFSIRCouldntCreateRPCClientForEndpoint = "could not create RPC client for endpoint"
FrostFSIRCreatedRPCClientForEndpoint = "created RPC client for endpoint"
FrostFSIRReloadExtraWallets = "reload extra wallets"
FrostFSNodeStartListeningEndpoint = "start listening endpoint"
FrostFSNodeCouldNotReadCertificateFromFile = "could not read certificate from file"
FrostFSNodeCantListenGRPCEndpoint = "can't listen gRPC endpoint"
FrostFSNodeStopListeningGRPCEndpoint = "stop listening gRPC endpoint"
FrostFSNodeStartListeningGRPCEndpoint = "start listening gRPC endpoint"
FrostFSNodeStoppingGRPCServer = "stopping gRPC server..."
FrostFSNodeGRPCCannotShutdownGracefullyForcingStop = "gRPC cannot shutdown gracefully, forcing stop"
FrostFSNodeGRPCServerStoppedSuccessfully = "gRPC server stopped successfully"