mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2026-05-17 08:36:55 +03:00
Compare commits
3 Commits
v1.143.0
...
issue-1056
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
782693b6be | ||
|
|
186db07c5d | ||
|
|
d93a62afd0 |
@@ -275,6 +275,9 @@ func initRemoteWriteCtxs(urls []string) {
|
||||
rwctxs[i] = newRemoteWriteCtx(i, remoteWriteURL, sanitizedURL)
|
||||
rwctxIdx[i] = i
|
||||
}
|
||||
_ = metrics.GetOrCreateGauge(fmt.Sprintf(`vmagent_fs_type{path=%q, type=%q}`, *tmpDataPath, fs.GetFsName(*tmpDataPath)), func() float64 {
|
||||
return 1
|
||||
})
|
||||
|
||||
if *shardByURL {
|
||||
consistentHashNodes := make([]string, 0, len(urls))
|
||||
|
||||
@@ -514,6 +514,7 @@ func writeStorageMetrics(w io.Writer, strg *storage.Storage) {
|
||||
strg.UpdateMetrics(&m)
|
||||
tm := &m.TableMetrics
|
||||
idbm := &m.TableMetrics.IndexDBMetrics
|
||||
metrics.WriteGaugeUint64(w, fmt.Sprintf(`vm_fs_type{path=%q, type=%s}`, *DataPath, fs.GetFsName(*DataPath)), 1)
|
||||
|
||||
metrics.WriteGaugeUint64(w, fmt.Sprintf(`vm_free_disk_space_bytes{path=%q}`, *DataPath), fs.MustGetFreeSpace(*DataPath))
|
||||
metrics.WriteGaugeUint64(w, fmt.Sprintf(`vm_free_disk_space_limit_bytes{path=%q}`, *DataPath), uint64(minFreeDiskSpaceBytes.N))
|
||||
|
||||
@@ -32,6 +32,7 @@ See also [LTS releases](https://docs.victoriametrics.com/victoriametrics/lts-rel
|
||||
* BUGFIX: [dashboards/vmauth](https://grafana.com/grafana/dashboards/21394): fix `requested from system` and `heap inuse` expressions in the memory usage panel. See [#10574](https://github.com/VictoriaMetrics/VictoriaMetrics/pull/10574).
|
||||
* BUGFIX: [vmbackup](https://docs.victoriametrics.com/vmbackup/), [vmbackupmanager](https://docs.victoriametrics.com/victoriametrics/vmbackupmanager/): do not enable ACL when uploading backups to S3-compatible endpoints by default. ACL is not always supported by S3-compatible endpoints and it is not recommended to use ACLs to limit access to objects. See [#10539](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/10539) for more details.
|
||||
* BUGFIX: [vmagent](https://docs.victoriametrics.com/victoriametrics/vmagent/), [vmsingle](https://docs.victoriametrics.com/victoriametrics/single-server-victoriametrics/), `vminsert` and `vmstorage` in [VictoriaMetrics cluster](https://docs.victoriametrics.com/victoriametrics/cluster-victoriametrics/): properly attach `host` label to the time series ingested via [/datadog/api/beta/sketches](https://docs.victoriametrics.com/victoriametrics/integrations/datadog/#) API. See [#10557](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/10557).
|
||||
* BUGFIX: `vmstorage` in [VictoriaMetrics cluster](https://docs.victoriametrics.com/victoriametrics/cluster-victoriametrics/): fix inaccurate `vm_filestream_write_duration_seconds_total` due to duplicate counting . After the fix, `vm_filestream_write_duration_seconds_total` will track the duration spent on calling the `write(2)` system call properly. See [#10564](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/10564).
|
||||
|
||||
## [v1.137.0](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.137.0)
|
||||
|
||||
|
||||
@@ -292,11 +292,6 @@ func (w *Writer) Write(p []byte) (int, error) {
|
||||
//
|
||||
// if isSync is true, then the flushed data is fsynced to the underlying storage.
|
||||
func (w *Writer) MustFlush(isSync bool) {
|
||||
startTime := time.Now()
|
||||
defer func() {
|
||||
d := time.Since(startTime).Seconds()
|
||||
writeDuration.Add(d)
|
||||
}()
|
||||
if err := w.bw.Flush(); err != nil {
|
||||
logger.Panicf("FATAL: cannot flush buffered data to file %q: %s", w.f.Name(), err)
|
||||
}
|
||||
|
||||
@@ -352,3 +352,7 @@ type diskSpaceEntry struct {
|
||||
func IsDirOrSymlink(de os.DirEntry) bool {
|
||||
return de.IsDir() || (de.Type()&os.ModeSymlink == os.ModeSymlink)
|
||||
}
|
||||
|
||||
func GetFsName(path string) string {
|
||||
return getFsName(path)
|
||||
}
|
||||
|
||||
@@ -18,3 +18,7 @@ func totalSpace(stat statfs_t) uint64 {
|
||||
func statfs(path string, buf *statfs_t) (err error) {
|
||||
return unix.Statvfs(path, buf)
|
||||
}
|
||||
|
||||
func getFsName(path string) string {
|
||||
return ""
|
||||
}
|
||||
|
||||
@@ -18,3 +18,7 @@ func totalSpace(stat statfs_t) uint64 {
|
||||
func statfs(path string, stat *statfs_t) (err error) {
|
||||
return unix.Statfs(path, stat)
|
||||
}
|
||||
|
||||
func getFsName(path string) string {
|
||||
return ""
|
||||
}
|
||||
|
||||
@@ -5,11 +5,35 @@ package fs
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"sync"
|
||||
|
||||
"github.com/VictoriaMetrics/VictoriaMetrics/lib/logger"
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
// https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/magic.h
|
||||
var fsMagicNumberToName = map[int64]string{
|
||||
0xEF53: "ext2/ext3/ext4",
|
||||
0xabba1974: "xenfs",
|
||||
0x9123683E: "btrfs",
|
||||
0x3434: "nilfs",
|
||||
0xF2F52010: "f2fs",
|
||||
0xf995e849: "hpfs",
|
||||
0x9660: "isofs",
|
||||
0x72b6: "jffs2",
|
||||
0x58465342: "xfs",
|
||||
0x6165676C: "pstorefs",
|
||||
0xde5e81e4: "efivarfs",
|
||||
0x00c0ffee: "hostfs",
|
||||
0x794c7630: "overlayfs",
|
||||
0x65735546: "fuse",
|
||||
0xca451a4e: "bcachefs",
|
||||
}
|
||||
|
||||
// Path -> Fs Type
|
||||
var lock sync.Mutex
|
||||
var fsNameCache = map[string]string{}
|
||||
|
||||
func mmap(fd int, length int) (data []byte, err error) {
|
||||
return unix.Mmap(fd, 0, length, unix.PROT_READ, unix.MAP_SHARED)
|
||||
|
||||
@@ -53,3 +77,30 @@ func mustGetDiskSpace(path string) (total, free uint64) {
|
||||
free = freeSpace(stat)
|
||||
return
|
||||
}
|
||||
|
||||
func getFsName(path string) string {
|
||||
// fast path: get fs name from cache
|
||||
lock.Lock()
|
||||
if fsName, ok := fsNameCache[path]; ok {
|
||||
lock.Unlock()
|
||||
return fsName
|
||||
}
|
||||
lock.Unlock()
|
||||
|
||||
// slow path: get fs name by statfs syscall
|
||||
var stat unix.Statfs_t
|
||||
fsName := "unknown"
|
||||
err := unix.Statfs(path, &stat)
|
||||
if err != nil {
|
||||
return fsName
|
||||
}
|
||||
if fsn, ok := fsMagicNumberToName[int64(stat.Type)]; ok {
|
||||
fsName = fsn
|
||||
}
|
||||
|
||||
lock.Lock()
|
||||
fsNameCache[path] = fsName
|
||||
lock.Unlock()
|
||||
|
||||
return fsName
|
||||
}
|
||||
|
||||
@@ -124,3 +124,7 @@ func newOverlapped() (*windows.Overlapped, error) {
|
||||
}
|
||||
return &windows.Overlapped{HEvent: event}, nil
|
||||
}
|
||||
|
||||
func getFsName(path string) string {
|
||||
return ""
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user