Skip to content

Commit

Permalink
misc(http): Adding a simple http endpoint for liveness checks (#1760)
Browse files Browse the repository at this point in the history
* misc(http): Adding a simple http endpoint for liveness checks
  • Loading branch information
sandeep6189 committed Apr 17, 2024
1 parent 614af10 commit bf698ae
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions http/src/main/scala/filodb/http/HealthRoute.scala
Expand Up @@ -48,6 +48,12 @@ class HealthRoute(coordinatorActor: ActorRef, v2ClusterEnabled: Boolean, setting
}
}
}
} ~
// Adding a simple liveness endpoint to check if the FiloDB instance is reachable or not
path ("__liveness") {
get {
complete(httpLiveness("UP"))
}
}
}
}
8 changes: 8 additions & 0 deletions http/src/main/scala/filodb/http/apiv1/HttpSchema.scala
Expand Up @@ -2,6 +2,12 @@ package filodb.http.apiv1

// Prometheus API compatible response envelopes
sealed trait HttpSuccess

/**
* Schema for http liveness checks
* @param Status
*/
final case class HttpLiveness(Status: String) extends HttpSuccess
final case class HttpList[A](status: String, data: Seq[A]) extends HttpSuccess
final case class HttpError(errorType: String,
error: String,
Expand All @@ -14,6 +20,8 @@ object HttpSchema {
def httpErr(exception: Exception): HttpError =
HttpError(exception.getClass.getName, exception.getMessage,
stackTrace = exception.getStackTrace.toSeq.map(_.toString))

def httpLiveness(status: String): HttpLiveness = HttpLiveness(status)
}

final case class HttpShardState(shard: Int, status: String, address: String)
Expand Down

0 comments on commit bf698ae

Please sign in to comment.