feat(tvix/store): add grpc healthcheck service to daemon

Change-Id: Ib95fc9352a45d54f9a16c8841c7e8f7cbeeaee8c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12019
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
Autosubmit: yuka <yuka@yuka.dev>
This commit is contained in:
Yureka 2024-07-22 15:41:32 +02:00 committed by clbot
parent 39c8b6dece
commit 2547ff2cf6
4 changed files with 71 additions and 0 deletions

14
tvix/Cargo.lock generated
View file

@ -4526,6 +4526,19 @@ dependencies = [
"syn 2.0.48",
]
[[package]]
name = "tonic-health"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1e10e6a96ee08b6ce443487d4368442d328d0e746f3681f81127f7dc41b4955"
dependencies = [
"async-stream",
"prost 0.13.1",
"tokio",
"tokio-stream",
"tonic 0.12.1",
]
[[package]]
name = "tonic-reflection"
version = "0.12.1"
@ -5001,6 +5014,7 @@ dependencies = [
"toml 0.8.15",
"tonic 0.12.1",
"tonic-build 0.12.1",
"tonic-health",
"tonic-reflection",
"tower",
"tower-http",

View file

@ -14489,6 +14489,54 @@ rec {
};
resolvedDefaultFeatures = [ "default" "prost" "prost-build" "transport" ];
};
"tonic-health" = rec {
crateName = "tonic-health";
version = "0.12.1";
edition = "2021";
sha256 = "0ma93g27szqjh4gniws6wz82ils2hhvd91rl8k7bc27fjrm0xqg1";
authors = [
"James Nugent <james@jen20.com>"
];
dependencies = [
{
name = "async-stream";
packageId = "async-stream";
}
{
name = "prost";
packageId = "prost 0.13.1";
}
{
name = "tokio";
packageId = "tokio";
features = [ "sync" ];
}
{
name = "tokio-stream";
packageId = "tokio-stream";
}
{
name = "tonic";
packageId = "tonic 0.12.1";
usesDefaultFeatures = false;
features = [ "codegen" "prost" ];
}
];
devDependencies = [
{
name = "tokio";
packageId = "tokio";
features = [ "rt-multi-thread" "macros" ];
}
{
name = "tokio-stream";
packageId = "tokio-stream";
}
];
features = {
"default" = [ "transport" ];
};
};
"tonic-reflection" = rec {
crateName = "tonic-reflection";
version = "0.12.1";
@ -16427,6 +16475,11 @@ rec {
packageId = "tonic 0.12.1";
features = [ "tls" "tls-roots" ];
}
{
name = "tonic-health";
packageId = "tonic-health";
usesDefaultFeatures = false;
}
{
name = "tonic-reflection";
packageId = "tonic-reflection";

View file

@ -44,6 +44,7 @@ tracing = "0.1.40"
tracing-indicatif = "0.3.6"
hyper-util = "0.1.6"
toml = { version = "0.8.15", optional = true }
tonic-health = { version = "0.12.1", default-features = false }
[dependencies.tonic-reflection]
optional = true

View file

@ -178,8 +178,11 @@ async fn run_cli(cli: Cli) -> Result<(), Box<dyn std::error::Error + Send + Sync
.map_request(tvix_tracing::propagate::tonic::accept_trace),
);
let (_health_reporter, health_service) = tonic_health::server::health_reporter();
#[allow(unused_mut)]
let mut router = server
.add_service(health_service)
.add_service(BlobServiceServer::new(GRPCBlobServiceWrapper::new(
blob_service,
)))