Skip to content

Commit 51a5dd2

Browse files
authored
init bcachefs support (#750)
Signed-off-by: Ananth Bhaskararaman <antsub@gmail.com>
1 parent c33362d commit 51a5dd2

File tree

5 files changed

+840
-0
lines changed

5 files changed

+840
-0
lines changed

bcachefs/bcachefs.go

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
// Copyright The Prometheus Authors
2+
// Licensed under the Apache License, Version 2.0 (the "License");
3+
// you may not use this file except in compliance with the License.
4+
// You may obtain a copy of the License at
5+
//
6+
// http://www.apache.org/licenses/LICENSE-2.0
7+
//
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
14+
// Package bcachefs provides access to statistics exposed by Bcachefs filesystems.
15+
package bcachefs
16+
17+
// Stats contains statistics for a single Bcachefs filesystem.
18+
type Stats struct {
19+
UUID string
20+
BtreeCacheSizeBytes uint64
21+
22+
Compression map[string]CompressionStats
23+
Errors map[string]ErrorStats
24+
Counters map[string]CounterStats
25+
BtreeWrites map[string]BtreeWriteStats
26+
Devices map[string]*DeviceStats
27+
}
28+
29+
// CompressionStats contains compression statistics for a specific algorithm.
30+
type CompressionStats struct {
31+
CompressedBytes uint64
32+
UncompressedBytes uint64
33+
AverageExtentSizeBytes uint64
34+
}
35+
36+
// ErrorStats contains error count and timestamp for a specific error type.
37+
type ErrorStats struct {
38+
Count uint64
39+
Timestamp uint64
40+
}
41+
42+
// CounterStats contains counter values since mount and since filesystem creation.
43+
type CounterStats struct {
44+
SinceMount uint64
45+
SinceFilesystemCreation uint64
46+
}
47+
48+
// BtreeWriteStats contains btree write statistics for a specific type.
49+
type BtreeWriteStats struct {
50+
Count uint64
51+
SizeBytes uint64
52+
}
53+
54+
// DeviceStats contains statistics for a Bcachefs device.
55+
type DeviceStats struct {
56+
Label string
57+
State string
58+
BucketSizeBytes uint64
59+
Buckets uint64
60+
Durability uint64
61+
IODone map[string]map[string]uint64
62+
IOErrors map[string]uint64
63+
}

0 commit comments

Comments
 (0)