fix(logging): enforce single-writer sinks and bound tracing (#4765)

* fix(obs): prevent rolling log stdout aliasing

* fix(ecstore): bound hot-path tracing payloads

* test(logging): guard service and disk log invariants

* fix(obs): silence useless_conversion on st_dev for Linux clippy

rustix's Stat.st_dev is u64 on Linux/glibc, making u64::try_from a no-op
that trips clippy::useless_conversion under -D warnings. The conversion is
still needed on macOS/BSD where st_dev is a signed dev_t, so suppress the
lint on that line rather than dropping the portable fallible conversion.

* fix(logging): keep stdout sink validation portable (#4769)

* fix(obs): keep stdout device conversion portable

* docs(logging): update single-writer plan status

---------

Co-authored-by: overtrue <anzhengchao@gmail.com>
Co-authored-by: houseme <housemecn@gmail.com>
This commit is contained in:
cxymds
2026-07-12 16:03:01 +08:00
committed by GitHub
parent 2ddafb4ed9
commit d8e69a3adf
14 changed files with 539 additions and 153 deletions
+29 -29
View File
@@ -155,7 +155,7 @@ impl DiskAPI for Disk {
}
}
#[tracing::instrument(skip(self))]
#[tracing::instrument(level = "trace", skip_all)]
async fn make_volume(&self, volume: &str) -> Result<()> {
match self {
Disk::Local(local_disk) => local_disk.make_volume(volume).await,
@@ -163,7 +163,7 @@ impl DiskAPI for Disk {
}
}
#[tracing::instrument(skip(self))]
#[tracing::instrument(level = "trace", skip_all)]
async fn make_volumes(&self, volumes: Vec<&str>) -> Result<()> {
match self {
Disk::Local(local_disk) => local_disk.make_volumes(volumes).await,
@@ -171,7 +171,7 @@ impl DiskAPI for Disk {
}
}
#[tracing::instrument(skip(self))]
#[tracing::instrument(level = "trace", skip_all)]
async fn list_volumes(&self) -> Result<Vec<VolumeInfo>> {
match self {
Disk::Local(local_disk) => local_disk.list_volumes().await,
@@ -186,7 +186,7 @@ impl DiskAPI for Disk {
}
}
#[tracing::instrument(skip(self))]
#[tracing::instrument(level = "trace", skip_all)]
async fn delete_volume(&self, volume: &str, force_delete: bool) -> Result<()> {
match self {
Disk::Local(local_disk) => local_disk.delete_volume(volume, force_delete).await,
@@ -194,7 +194,7 @@ impl DiskAPI for Disk {
}
}
#[tracing::instrument(skip(self, wr))]
#[tracing::instrument(level = "trace", skip_all)]
async fn walk_dir<W: AsyncWrite + Unpin + Send>(&self, opts: WalkDirOptions, wr: &mut W) -> Result<()> {
match self {
Disk::Local(local_disk) => local_disk.walk_dir(opts, wr).await,
@@ -202,7 +202,7 @@ impl DiskAPI for Disk {
}
}
#[tracing::instrument(skip(self))]
#[tracing::instrument(level = "trace", skip_all)]
async fn delete_version(
&self,
volume: &str,
@@ -217,7 +217,7 @@ impl DiskAPI for Disk {
}
}
#[tracing::instrument(skip(self))]
#[tracing::instrument(level = "trace", skip_all)]
async fn delete_versions(&self, volume: &str, versions: Vec<FileInfoVersions>, opts: DeleteOptions) -> Vec<Option<Error>> {
match self {
Disk::Local(local_disk) => local_disk.delete_versions(volume, versions, opts).await,
@@ -225,7 +225,7 @@ impl DiskAPI for Disk {
}
}
#[tracing::instrument(skip(self))]
#[tracing::instrument(level = "trace", skip_all)]
async fn delete_paths(&self, volume: &str, paths: &[String]) -> Result<()> {
match self {
Disk::Local(local_disk) => local_disk.delete_paths(volume, paths).await,
@@ -233,7 +233,7 @@ impl DiskAPI for Disk {
}
}
#[tracing::instrument(skip(self))]
#[tracing::instrument(level = "trace", skip_all)]
async fn write_metadata(&self, _org_volume: &str, volume: &str, path: &str, fi: FileInfo) -> Result<()> {
match self {
Disk::Local(local_disk) => local_disk.write_metadata(_org_volume, volume, path, fi).await,
@@ -241,7 +241,7 @@ impl DiskAPI for Disk {
}
}
#[tracing::instrument(skip(self))]
#[tracing::instrument(level = "trace", skip_all)]
async fn update_metadata(&self, volume: &str, path: &str, fi: FileInfo, opts: &UpdateMetadataOpts) -> Result<()> {
match self {
Disk::Local(local_disk) => local_disk.update_metadata(volume, path, fi, opts).await,
@@ -249,7 +249,7 @@ impl DiskAPI for Disk {
}
}
#[tracing::instrument(level = "debug", skip(self))]
#[tracing::instrument(level = "trace", skip_all)]
async fn read_version(
&self,
_org_volume: &str,
@@ -264,7 +264,7 @@ impl DiskAPI for Disk {
}
}
#[tracing::instrument(skip(self))]
#[tracing::instrument(level = "trace", skip_all)]
async fn read_xl(&self, volume: &str, path: &str, read_data: bool) -> Result<RawFileInfo> {
match self {
Disk::Local(local_disk) => local_disk.read_xl(volume, path, read_data).await,
@@ -272,7 +272,7 @@ impl DiskAPI for Disk {
}
}
#[tracing::instrument(skip(self, fi))]
#[tracing::instrument(level = "trace", skip_all)]
async fn rename_data(
&self,
src_volume: &str,
@@ -287,7 +287,7 @@ impl DiskAPI for Disk {
}
}
#[tracing::instrument(skip(self))]
#[tracing::instrument(level = "trace", skip_all)]
async fn list_dir(&self, _origvolume: &str, volume: &str, dir_path: &str, count: i32) -> Result<Vec<String>> {
match self {
Disk::Local(local_disk) => local_disk.list_dir(_origvolume, volume, dir_path, count).await,
@@ -295,7 +295,7 @@ impl DiskAPI for Disk {
}
}
#[tracing::instrument(skip(self))]
#[tracing::instrument(level = "trace", skip_all)]
async fn read_file(&self, volume: &str, path: &str) -> Result<FileReader> {
match self {
Disk::Local(local_disk) => local_disk.read_file(volume, path).await,
@@ -303,7 +303,7 @@ impl DiskAPI for Disk {
}
}
#[tracing::instrument(skip(self))]
#[tracing::instrument(level = "trace", skip_all)]
async fn read_file_stream(&self, volume: &str, path: &str, offset: usize, length: usize) -> Result<FileReader> {
match self {
Disk::Local(local_disk) => local_disk.read_file_stream(volume, path, offset, length).await,
@@ -311,7 +311,7 @@ impl DiskAPI for Disk {
}
}
#[tracing::instrument(skip(self))]
#[tracing::instrument(level = "trace", skip_all)]
async fn read_file_mmap_copy(&self, volume: &str, path: &str, offset: usize, length: usize) -> Result<Bytes> {
match self {
Disk::Local(local_disk) => local_disk.read_file_mmap_copy(volume, path, offset, length).await,
@@ -337,7 +337,7 @@ impl DiskAPI for Disk {
}
}
#[tracing::instrument(skip(self))]
#[tracing::instrument(level = "trace", skip_all)]
async fn append_file(&self, volume: &str, path: &str) -> Result<FileWriter> {
match self {
Disk::Local(local_disk) => local_disk.append_file(volume, path).await,
@@ -345,7 +345,7 @@ impl DiskAPI for Disk {
}
}
#[tracing::instrument(skip(self))]
#[tracing::instrument(level = "trace", skip_all)]
async fn create_file(&self, _origvolume: &str, volume: &str, path: &str, _file_size: i64) -> Result<FileWriter> {
match self {
Disk::Local(local_disk) => local_disk.create_file(_origvolume, volume, path, _file_size).await,
@@ -353,7 +353,7 @@ impl DiskAPI for Disk {
}
}
#[tracing::instrument(skip(self))]
#[tracing::instrument(level = "trace", skip_all)]
async fn rename_file(&self, src_volume: &str, src_path: &str, dst_volume: &str, dst_path: &str) -> Result<()> {
match self {
Disk::Local(local_disk) => local_disk.rename_file(src_volume, src_path, dst_volume, dst_path).await,
@@ -361,7 +361,7 @@ impl DiskAPI for Disk {
}
}
#[tracing::instrument(skip(self))]
#[tracing::instrument(level = "trace", skip_all)]
async fn read_parts(&self, bucket: &str, paths: &[String]) -> Result<Vec<ObjectPartInfo>> {
match self {
Disk::Local(local_disk) => local_disk.read_parts(bucket, paths).await,
@@ -369,7 +369,7 @@ impl DiskAPI for Disk {
}
}
#[tracing::instrument(skip(self))]
#[tracing::instrument(level = "trace", skip_all)]
async fn rename_part(&self, src_volume: &str, src_path: &str, dst_volume: &str, dst_path: &str, meta: Bytes) -> Result<()> {
match self {
Disk::Local(local_disk) => local_disk.rename_part(src_volume, src_path, dst_volume, dst_path, meta).await,
@@ -381,7 +381,7 @@ impl DiskAPI for Disk {
}
}
#[tracing::instrument(skip(self))]
#[tracing::instrument(level = "trace", skip_all)]
async fn delete(&self, volume: &str, path: &str, opt: DeleteOptions) -> Result<()> {
match self {
Disk::Local(local_disk) => local_disk.delete(volume, path, opt).await,
@@ -389,7 +389,7 @@ impl DiskAPI for Disk {
}
}
#[tracing::instrument(skip(self))]
#[tracing::instrument(level = "trace", skip_all)]
async fn verify_file(&self, volume: &str, path: &str, fi: &FileInfo) -> Result<CheckPartsResp> {
match self {
Disk::Local(local_disk) => local_disk.verify_file(volume, path, fi).await,
@@ -397,7 +397,7 @@ impl DiskAPI for Disk {
}
}
#[tracing::instrument(skip(self))]
#[tracing::instrument(level = "trace", skip_all)]
async fn check_parts(&self, volume: &str, path: &str, fi: &FileInfo) -> Result<CheckPartsResp> {
match self {
Disk::Local(local_disk) => local_disk.check_parts(volume, path, fi).await,
@@ -405,7 +405,7 @@ impl DiskAPI for Disk {
}
}
#[tracing::instrument(skip(self))]
#[tracing::instrument(level = "trace", skip_all)]
async fn read_multiple(&self, req: ReadMultipleReq) -> Result<Vec<ReadMultipleResp>> {
match self {
Disk::Local(local_disk) => local_disk.read_multiple(req).await,
@@ -413,7 +413,7 @@ impl DiskAPI for Disk {
}
}
#[tracing::instrument(skip(self))]
#[tracing::instrument(level = "trace", skip_all)]
async fn write_all(&self, volume: &str, path: &str, data: Bytes) -> Result<()> {
match self {
Disk::Local(local_disk) => local_disk.write_all(volume, path, data).await,
@@ -421,7 +421,7 @@ impl DiskAPI for Disk {
}
}
#[tracing::instrument(skip(self))]
#[tracing::instrument(level = "trace", skip_all)]
async fn read_all(&self, volume: &str, path: &str) -> Result<Bytes> {
match self {
Disk::Local(local_disk) => local_disk.read_all(volume, path).await,
@@ -429,7 +429,7 @@ impl DiskAPI for Disk {
}
}
#[tracing::instrument(skip(self))]
#[tracing::instrument(level = "trace", skip_all)]
async fn disk_info(&self, opts: &DiskInfoOptions) -> Result<DiskInfo> {
match self {
Disk::Local(local_disk) => local_disk.disk_info(opts).await,