feat(tvix/store): add logging with tracing
This uses [tracing](https://github.com/tokio-rs/tracing) for logs/ tracing. Annotate all method handlers with an instrument macro, and warn! a message for them being unimplemented. Co-Authored-By: Márton Boros <martonboros@gmail.com> Change-Id: Id42a41db33782d82abfb8dc0e49a8915000e5d89 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7665 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
This commit is contained in:
parent
0bf2b0ef11
commit
319c03f634
7 changed files with 327 additions and 10 deletions
|
|
@ -7,6 +7,9 @@ use crate::proto::PutBlobResponse;
|
|||
use crate::proto::ReadBlobRequest;
|
||||
use crate::proto::StatBlobRequest;
|
||||
use tonic::{Request, Response, Result, Status, Streaming};
|
||||
use tracing::{instrument, warn};
|
||||
|
||||
const NOT_IMPLEMENTED_MSG: &str = "not implemented";
|
||||
|
||||
pub struct DummyBlobService {}
|
||||
|
||||
|
|
@ -14,21 +17,27 @@ pub struct DummyBlobService {}
|
|||
impl BlobService for DummyBlobService {
|
||||
type ReadStream = ReceiverStream<Result<BlobChunk>>;
|
||||
|
||||
#[instrument(skip(self))]
|
||||
async fn stat(&self, _request: Request<StatBlobRequest>) -> Result<Response<BlobMeta>> {
|
||||
Err(Status::unimplemented("not implemented"))
|
||||
warn!(NOT_IMPLEMENTED_MSG);
|
||||
Err(Status::unimplemented(NOT_IMPLEMENTED_MSG))
|
||||
}
|
||||
|
||||
#[instrument(skip(self))]
|
||||
async fn read(
|
||||
&self,
|
||||
_request: Request<ReadBlobRequest>,
|
||||
) -> Result<Response<Self::ReadStream>, Status> {
|
||||
Err(Status::unimplemented("not implemented"))
|
||||
warn!(NOT_IMPLEMENTED_MSG);
|
||||
Err(Status::unimplemented(NOT_IMPLEMENTED_MSG))
|
||||
}
|
||||
|
||||
#[instrument(skip(self, _request))]
|
||||
async fn put(
|
||||
&self,
|
||||
_request: Request<Streaming<BlobChunk>>,
|
||||
) -> Result<Response<PutBlobResponse>> {
|
||||
Err(Status::unimplemented("not implemented"))
|
||||
warn!(NOT_IMPLEMENTED_MSG);
|
||||
Err(Status::unimplemented(NOT_IMPLEMENTED_MSG))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue