Skip to content

Commit

Permalink
chore: add process startup time
Browse files Browse the repository at this point in the history
  • Loading branch information
mishraomp committed Dec 25, 2024
1 parent 6a6e03f commit 099ceae
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 7 additions & 0 deletions backend-go/main.go
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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{})
}
Expand All @@ -22,4 +27,6 @@ func main() {
logrus.Fatalf("Error: %v", err)
return
}

logrus.Infof("Process startup took %s", time.Since(startTime))
}
4 changes: 3 additions & 1 deletion backend-py/src/main.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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}")

0 comments on commit 099ceae

Please sign in to comment.