From 099ceaeeaf0256b035c13896bd2cab20a34760cc Mon Sep 17 00:00:00 2001 From: OMPRAKASH MISHRA Date: Tue, 24 Dec 2024 19:13:49 -0800 Subject: [PATCH 1/2] chore: add process startup time --- backend-go/main.go | 7 +++++++ backend-py/src/main.py | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/backend-go/main.go b/backend-go/main.go index 9d42ffc4..d1a551c7 100644 --- a/backend-go/main.go +++ b/backend-go/main.go @@ -1,6 +1,8 @@ package main import ( + "time" + _ "github.com/bcgov/quickstart-openshift-backends/backend-go/docs" "github.com/bcgov/quickstart-openshift-backends/backend-go/src" "github.com/bcgov/quickstart-openshift-backends/backend-go/src/v1/structs" @@ -10,7 +12,10 @@ import ( "github.com/sirupsen/logrus" ) +var startTime time.Time + func init() { + startTime = time.Now() _ = mapper.Register(&structs.User{}) _ = mapper.Register(&structs.UserAddress{}) } @@ -22,4 +27,6 @@ func main() { logrus.Fatalf("Error: %v", err) return } + + logrus.Infof("Process startup took %s", time.Since(startTime)) } diff --git a/backend-py/src/main.py b/backend-py/src/main.py index 1885cd14..31a8a0a8 100644 --- a/backend-py/src/main.py +++ b/backend-py/src/main.py @@ -1,5 +1,5 @@ import logging - +import os from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware from .v1.routes.user_routes import router as user_router @@ -55,3 +55,5 @@ def filter(self, record: logging.LogRecord) -> bool: # Add filter to the logger logging.getLogger("uvicorn.access").addFilter(EndpointFilter()) +t = os.popen('uptime -p').read()[:-1] +logging.info(f"process start up took {t}") \ No newline at end of file From 61395dd02c3bd1ecb5fc172e831c5bc0fbefec54 Mon Sep 17 00:00:00 2001 From: OMPRAKASH MISHRA Date: Tue, 24 Dec 2024 19:23:54 -0800 Subject: [PATCH 2/2] chore: add flyway retry --- backend-java/src/main/resources/application.properties | 1 + 1 file changed, 1 insertion(+) diff --git a/backend-java/src/main/resources/application.properties b/backend-java/src/main/resources/application.properties index fe7a391a..ea9069a8 100644 --- a/backend-java/src/main/resources/application.properties +++ b/backend-java/src/main/resources/application.properties @@ -19,6 +19,7 @@ quarkus.flyway.enabled=true quarkus.flyway.baseline-on-migrate=true quarkus.flyway.baseline-version=1 quarkus.flyway.clean-on-validation-error=true +quarkus.flyway.connect-retries=10 quarkus.swagger-ui.always-include=true # this should fix the compatibility issue quarkus.native.additional-build-args=-march=compatibility