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

Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
This commit is contained in:
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" "google.golang.org/grpc"
) )
const serviceNameControl = "control"
type treeSynchronizer struct { type treeSynchronizer struct {
treeSvc *tree.Service treeSvc *tree.Service
} }
@ -66,7 +68,10 @@ func initControlService(c *cfg) {
control.RegisterControlServiceServer(c.cfgControlService.server, ctlSvc) control.RegisterControlServiceServer(c.cfgControlService.server, ctlSvc)
c.workers = append(c.workers, newWorkerFromFunc(func(ctx context.Context) { 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)) fatalOnErr(c.cfgControlService.server.Serve(lis))
}) })
})) }))

View file

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

View file

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

View file

@ -167,5 +167,7 @@ func connectNats(ctx context.Context, c *cfg) {
err := c.cfgNotifications.nw.w.Connect(ctx, endpoint) err := c.cfgNotifications.nw.w.Connect(ctx, endpoint)
if err != nil { if err != nil {
panic(fmt.Sprintf("could not connect to a nats endpoint %s: %v", endpoint, err)) 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" NatsNatsConnectionWasLost = "nats: connection was lost"
NatsNatsReconnectedToTheServer = "nats: reconnected to the server" NatsNatsReconnectedToTheServer = "nats: reconnected to the server"
NatsNatsClosingConnectionAsTheContextIsDone = "nats: closing connection as the context is done" NatsNatsClosingConnectionAsTheContextIsDone = "nats: closing connection as the context is done"
NatsConnectedToEndpoint = "nats: successfully connected to endpoint"
ControllerStartingToAnnounceTheValuesOfTheMetrics = "starting to announce the values of the metrics" ControllerStartingToAnnounceTheValuesOfTheMetrics = "starting to announce the values of the metrics"
ControllerCouldNotInitializeIteratorOverLocallyCollectedMetrics = "could not initialize iterator over locally collected metrics" ControllerCouldNotInitializeIteratorOverLocallyCollectedMetrics = "could not initialize iterator over locally collected metrics"
ControllerCouldNotInitializeAnnouncementAccumulator = "could not initialize announcement accumulator" ControllerCouldNotInitializeAnnouncementAccumulator = "could not initialize announcement accumulator"
@ -413,10 +414,10 @@ const (
FrostFSIRCouldntCreateRPCClientForEndpoint = "could not create RPC client for endpoint" FrostFSIRCouldntCreateRPCClientForEndpoint = "could not create RPC client for endpoint"
FrostFSIRCreatedRPCClientForEndpoint = "created RPC client for endpoint" FrostFSIRCreatedRPCClientForEndpoint = "created RPC client for endpoint"
FrostFSIRReloadExtraWallets = "reload extra wallets" FrostFSIRReloadExtraWallets = "reload extra wallets"
FrostFSNodeStartListeningEndpoint = "start listening endpoint"
FrostFSNodeCouldNotReadCertificateFromFile = "could not read certificate from file" FrostFSNodeCouldNotReadCertificateFromFile = "could not read certificate from file"
FrostFSNodeCantListenGRPCEndpoint = "can't listen gRPC endpoint" FrostFSNodeCantListenGRPCEndpoint = "can't listen gRPC endpoint"
FrostFSNodeStopListeningGRPCEndpoint = "stop listening gRPC endpoint" FrostFSNodeStopListeningGRPCEndpoint = "stop listening gRPC endpoint"
FrostFSNodeStartListeningGRPCEndpoint = "start listening gRPC endpoint"
FrostFSNodeStoppingGRPCServer = "stopping gRPC server..." FrostFSNodeStoppingGRPCServer = "stopping gRPC server..."
FrostFSNodeGRPCCannotShutdownGracefullyForcingStop = "gRPC cannot shutdown gracefully, forcing stop" FrostFSNodeGRPCCannotShutdownGracefullyForcingStop = "gRPC cannot shutdown gracefully, forcing stop"
FrostFSNodeGRPCServerStoppedSuccessfully = "gRPC server stopped successfully" FrostFSNodeGRPCServerStoppedSuccessfully = "gRPC server stopped successfully"