From: naman.gupta Date: Tue, 16 May 2023 10:53:59 +0000 (+0530) Subject: Adding database health to healthcheck. X-Git-Tag: 3.1.1~3 X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=b17b136303aae9a45e9794a7655cec1e09b18c88;p=ric-plt%2Fa1.git Adding database health to healthcheck. Adding database health to healthcheck. Signed-off-by: naman.gupta Change-Id: I18901dd232f35fdf81441dc415b5b714ced9fb98 --- diff --git a/pkg/resthooks/resthooks.go b/pkg/resthooks/resthooks.go index 79e52fa..733726f 100644 --- a/pkg/resthooks/resthooks.go +++ b/pkg/resthooks/resthooks.go @@ -102,7 +102,11 @@ func createResthook(sdlInst iSdl, rmrSenderInst rmr.IRmrSender) *Resthook { } func (rh *Resthook) GetA1Health() bool { - //TODO : Add database healthcheck + _, err := rh.db.GetAll("A1m_ns") + if err != nil { + a1.Logger.Error("error in connecting to the database. err: %v", err) + return false + } a1.Logger.Debug("A1 is healthy") return true }