Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

metrics server, init logs #103

Merged
merged 1 commit into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions cmd/ydbcp/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,9 @@ grpc_server:
bind_port: 50051
tls_certificate_path: path/to/tls.crt
tls_key_path: path/to/tls.key

metrics_server:
bind_port: 9090
bind_address: 127.0.0.1
#tls_certificate_path: path/to/tls.crt
#tls_key_path: path/to/tls.key
14 changes: 14 additions & 0 deletions cmd/ydbcp/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,24 +80,29 @@ func main() {
)
}
metrics := metrics.NewMetricsRegistry(ctx, &wg, &configInstance.MetricsServer)
xlog.Info(ctx, "Initialized metrics registry")
server, err := server.NewServer(&configInstance.GRPCServer)
if err != nil {
xlog.Error(ctx, "failed to initialize GRPC server", zap.Error(err))
os.Exit(1)
}
xlog.Info(ctx, "created GRPC server")

dbConnector, err := db.NewYdbConnector(ctx, configInstance.DBConnection)
if err != nil {
xlog.Error(ctx, "Error init DBConnector", zap.Error(err))
os.Exit(1)
}
xlog.Info(ctx, "connected to YDBCP database")

defer dbConnector.Close(ctx)
clientConnector := client.NewClientYdbConnector(configInstance.ClientConnection)
s3Connector, err := s3.NewS3Connector(configInstance.S3)
if err != nil {
xlog.Error(ctx, "Error init S3Connector", zap.Error(err))
os.Exit(1)
}
xlog.Info(ctx, "connected to YDBCP S3 storage")
var authProvider ap.AuthProvider
if len(configInstance.Auth.PluginPath) == 0 {
authProvider, err = auth.NewDummyAuthProvider(ctx)
Expand All @@ -113,6 +118,7 @@ func main() {
xlog.Error(ctx, "Error finish auth provider", zap.Error(err))
}
}()
xlog.Info(ctx, "Initialized AuthProvider")

backup.NewBackupService(
dbConnector,
Expand All @@ -130,6 +136,8 @@ func main() {
os.Exit(1)
}

xlog.Info(ctx, "Registered services and started GRPC server")

handlersRegistry := processor.NewOperationHandlerRegistry()
if err := handlersRegistry.Add(
types.OperationTypeTB,
Expand Down Expand Up @@ -174,12 +182,18 @@ func main() {
}

processor.NewOperationProcessor(ctx, &wg, dbConnector, handlersRegistry, metrics)
xlog.Info(ctx, "Initialized OperationProcessor")
ttl_watcher.NewTtlWatcher(ctx, &wg, dbConnector, queries.NewWriteTableQuery)
xlog.Info(ctx, "Created TtlWatcher")

backupScheduleHandler := handlers.NewBackupScheduleHandler(
queries.NewWriteTableQuery, clockwork.NewRealClock(), metrics,
)

schedule_watcher.NewScheduleWatcher(ctx, &wg, dbConnector, backupScheduleHandler)

xlog.Info(ctx, "Created ScheduleWatcher")

xlog.Info(ctx, "YDBCP started")
wg.Add(1)
go func() {
Expand Down
4 changes: 4 additions & 0 deletions local_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,7 @@ s3:
grpc_server:
bind_port: 50051
log_level: INFO

metrics_server:
bind_address: 127.0.0.1
bind_port: 9090