Skip to content

Commit

Permalink
Adding HttpLiveness response schema
Browse files Browse the repository at this point in the history
  • Loading branch information
sandeep6189 committed Apr 17, 2024
1 parent 760c473 commit c6441a7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion http/src/main/scala/filodb/http/HealthRoute.scala
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ 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(StatusCodes.Success)
complete(httpLiveness("UP"))
}
}
}
Expand Down
8 changes: 8 additions & 0 deletions http/src/main/scala/filodb/http/apiv1/HttpSchema.scala
Original file line number Diff line number Diff line change
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 c6441a7

Please sign in to comment.