From 894a5e86981799e073eddf8011c5f835992d1105 Mon Sep 17 00:00:00 2001 From: PrometheusBot Date: Tue, 3 Oct 2023 09:40:46 +0200 Subject: [PATCH 01/32] Update common Prometheus files (#578) Signed-off-by: prombot --- .github/workflows/golangci-lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 8ace97bd..15cf547b 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -18,7 +18,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 + uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - name: install Go uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0 with: From 18260ef234b3950c90ae54779c0d415f2749e495 Mon Sep 17 00:00:00 2001 From: TJ Hoplock Date: Wed, 13 Sep 2023 13:35:24 -0400 Subject: [PATCH 02/32] fix(meminfo): account for optional unit field so values are accurate Addresses: #565 Previously, this function was ignoring the optional unit field, leading to incorrect results on systems that do report the field. This uses the humanize lib used elsewhere within the Prometheus ecosystem to normalize the value to bytes, including when a unit is provided. To try and maintain existing behavior, the fixed/unit-scaled values are stored as new struct fields. Signed-off-by: TJ Hoplock --- meminfo.go | 221 ++++++++++++++++++++++++++++++++++++------------ meminfo_test.go | 43 ++++++++++ 2 files changed, 212 insertions(+), 52 deletions(-) diff --git a/meminfo.go b/meminfo.go index eaf00e22..cccdfcd0 100644 --- a/meminfo.go +++ b/meminfo.go @@ -140,6 +140,58 @@ type Meminfo struct { DirectMap4k *uint64 DirectMap2M *uint64 DirectMap1G *uint64 + + // The struct fields below are the byte-normalized counterparts to the + // existing struct fields. Values are normalized using the optional + // unit field in the meminfo line. + MemTotalBytes *uint64 + MemFreeBytes *uint64 + MemAvailableBytes *uint64 + BuffersBytes *uint64 + CachedBytes *uint64 + SwapCachedBytes *uint64 + ActiveBytes *uint64 + InactiveBytes *uint64 + ActiveAnonBytes *uint64 + InactiveAnonBytes *uint64 + ActiveFileBytes *uint64 + InactiveFileBytes *uint64 + UnevictableBytes *uint64 + MlockedBytes *uint64 + SwapTotalBytes *uint64 + SwapFreeBytes *uint64 + DirtyBytes *uint64 + WritebackBytes *uint64 + AnonPagesBytes *uint64 + MappedBytes *uint64 + ShmemBytes *uint64 + SlabBytes *uint64 + SReclaimableBytes *uint64 + SUnreclaimBytes *uint64 + KernelStackBytes *uint64 + PageTablesBytes *uint64 + NFSUnstableBytes *uint64 + BounceBytes *uint64 + WritebackTmpBytes *uint64 + CommitLimitBytes *uint64 + CommittedASBytes *uint64 + VmallocTotalBytes *uint64 + VmallocUsedBytes *uint64 + VmallocChunkBytes *uint64 + HardwareCorruptedBytes *uint64 + AnonHugePagesBytes *uint64 + ShmemHugePagesBytes *uint64 + ShmemPmdMappedBytes *uint64 + CmaTotalBytes *uint64 + CmaFreeBytes *uint64 + HugePagesTotalBytes *uint64 + HugePagesFreeBytes *uint64 + HugePagesRsvdBytes *uint64 + HugePagesSurpBytes *uint64 + HugepagesizeBytes *uint64 + DirectMap4kBytes *uint64 + DirectMap2MBytes *uint64 + DirectMap1GBytes *uint64 } // Meminfo returns an information about current kernel/system memory statistics. @@ -162,114 +214,179 @@ func parseMemInfo(r io.Reader) (*Meminfo, error) { var m Meminfo s := bufio.NewScanner(r) for s.Scan() { - // Each line has at least a name and value; we ignore the unit. fields := strings.Fields(s.Text()) - if len(fields) < 2 { - return nil, fmt.Errorf("%w: Malformed line %q", ErrFileParse, s.Text()) - } + var val, valBytes uint64 v, err := strconv.ParseUint(fields[1], 0, 64) if err != nil { return nil, err } + val = v + + switch len(fields) { + case 2: + // No unit present, use the parsed the value as bytes directly. + valBytes = val + case 3: + // Unit present in optional 3rd field, convert it to + // bytes. The only unit supported within the Linux + // kernel is `kB`. + if fields[2] != "kB" { + return nil, fmt.Errorf("%w: Unsupported unit in optional 3rd field %q", ErrFileParse, fields[2]) + } + + valBytes = 1024 * val + + default: + return nil, fmt.Errorf("%w: Malformed line %q", ErrFileParse, s.Text()) + } + switch fields[0] { case "MemTotal:": - m.MemTotal = &v + m.MemTotal = &val + m.MemTotalBytes = &valBytes case "MemFree:": - m.MemFree = &v + m.MemFree = &val + m.MemFreeBytes = &valBytes case "MemAvailable:": - m.MemAvailable = &v + m.MemAvailable = &val + m.MemAvailableBytes = &valBytes case "Buffers:": - m.Buffers = &v + m.Buffers = &val + m.BuffersBytes = &valBytes case "Cached:": - m.Cached = &v + m.Cached = &val + m.CachedBytes = &valBytes case "SwapCached:": - m.SwapCached = &v + m.SwapCached = &val + m.SwapCachedBytes = &valBytes case "Active:": - m.Active = &v + m.Active = &val + m.ActiveBytes = &valBytes case "Inactive:": - m.Inactive = &v + m.Inactive = &val + m.InactiveBytes = &valBytes case "Active(anon):": - m.ActiveAnon = &v + m.ActiveAnon = &val + m.ActiveAnonBytes = &valBytes case "Inactive(anon):": - m.InactiveAnon = &v + m.InactiveAnon = &val + m.InactiveAnonBytes = &valBytes case "Active(file):": - m.ActiveFile = &v + m.ActiveFile = &val + m.ActiveFileBytes = &valBytes case "Inactive(file):": - m.InactiveFile = &v + m.InactiveFile = &val + m.InactiveFileBytes = &valBytes case "Unevictable:": - m.Unevictable = &v + m.Unevictable = &val + m.UnevictableBytes = &valBytes case "Mlocked:": - m.Mlocked = &v + m.Mlocked = &val + m.MlockedBytes = &valBytes case "SwapTotal:": - m.SwapTotal = &v + m.SwapTotal = &val + m.SwapTotalBytes = &valBytes case "SwapFree:": - m.SwapFree = &v + m.SwapFree = &val + m.SwapFreeBytes = &valBytes case "Dirty:": - m.Dirty = &v + m.Dirty = &val + m.DirtyBytes = &valBytes case "Writeback:": - m.Writeback = &v + m.Writeback = &val + m.WritebackBytes = &valBytes case "AnonPages:": - m.AnonPages = &v + m.AnonPages = &val + m.AnonPagesBytes = &valBytes case "Mapped:": - m.Mapped = &v + m.Mapped = &val + m.MappedBytes = &valBytes case "Shmem:": - m.Shmem = &v + m.Shmem = &val + m.ShmemBytes = &valBytes case "Slab:": - m.Slab = &v + m.Slab = &val + m.SlabBytes = &valBytes case "SReclaimable:": - m.SReclaimable = &v + m.SReclaimable = &val + m.SReclaimableBytes = &valBytes case "SUnreclaim:": - m.SUnreclaim = &v + m.SUnreclaim = &val + m.SUnreclaimBytes = &valBytes case "KernelStack:": - m.KernelStack = &v + m.KernelStack = &val + m.KernelStackBytes = &valBytes case "PageTables:": - m.PageTables = &v + m.PageTables = &val + m.PageTablesBytes = &valBytes case "NFS_Unstable:": - m.NFSUnstable = &v + m.NFSUnstable = &val + m.NFSUnstableBytes = &valBytes case "Bounce:": - m.Bounce = &v + m.Bounce = &val + m.BounceBytes = &valBytes case "WritebackTmp:": - m.WritebackTmp = &v + m.WritebackTmp = &val + m.WritebackTmpBytes = &valBytes case "CommitLimit:": - m.CommitLimit = &v + m.CommitLimit = &val + m.CommitLimitBytes = &valBytes case "Committed_AS:": - m.CommittedAS = &v + m.CommittedAS = &val + m.CommittedASBytes = &valBytes case "VmallocTotal:": - m.VmallocTotal = &v + m.VmallocTotal = &val + m.VmallocTotalBytes = &valBytes case "VmallocUsed:": - m.VmallocUsed = &v + m.VmallocUsed = &val + m.VmallocUsedBytes = &valBytes case "VmallocChunk:": - m.VmallocChunk = &v + m.VmallocChunk = &val + m.VmallocChunkBytes = &valBytes case "HardwareCorrupted:": - m.HardwareCorrupted = &v + m.HardwareCorrupted = &val + m.HardwareCorruptedBytes = &valBytes case "AnonHugePages:": - m.AnonHugePages = &v + m.AnonHugePages = &val + m.AnonHugePagesBytes = &valBytes case "ShmemHugePages:": - m.ShmemHugePages = &v + m.ShmemHugePages = &val + m.ShmemHugePagesBytes = &valBytes case "ShmemPmdMapped:": - m.ShmemPmdMapped = &v + m.ShmemPmdMapped = &val + m.ShmemPmdMappedBytes = &valBytes case "CmaTotal:": - m.CmaTotal = &v + m.CmaTotal = &val + m.CmaTotalBytes = &valBytes case "CmaFree:": - m.CmaFree = &v + m.CmaFree = &val + m.CmaFreeBytes = &valBytes case "HugePages_Total:": - m.HugePagesTotal = &v + m.HugePagesTotal = &val + m.HugePagesTotalBytes = &valBytes case "HugePages_Free:": - m.HugePagesFree = &v + m.HugePagesFree = &val + m.HugePagesFreeBytes = &valBytes case "HugePages_Rsvd:": - m.HugePagesRsvd = &v + m.HugePagesRsvd = &val + m.HugePagesRsvdBytes = &valBytes case "HugePages_Surp:": - m.HugePagesSurp = &v + m.HugePagesSurp = &val + m.HugePagesSurpBytes = &valBytes case "Hugepagesize:": - m.Hugepagesize = &v + m.Hugepagesize = &val + m.HugepagesizeBytes = &valBytes case "DirectMap4k:": - m.DirectMap4k = &v + m.DirectMap4k = &val + m.DirectMap4kBytes = &valBytes case "DirectMap2M:": - m.DirectMap2M = &v + m.DirectMap2M = &val + m.DirectMap2MBytes = &valBytes case "DirectMap1G:": - m.DirectMap1G = &v + m.DirectMap1G = &val + m.DirectMap1GBytes = &valBytes } } diff --git a/meminfo_test.go b/meminfo_test.go index 860f1773..5a4b761f 100644 --- a/meminfo_test.go +++ b/meminfo_test.go @@ -62,6 +62,49 @@ func TestMeminfo(t *testing.T) { Hugepagesize: newuint64(2048), DirectMap4k: newuint64(91136), DirectMap2M: newuint64(16039936), + + MemTotalBytes: newuint64(16042172416), + MemFreeBytes: newuint64(450891776), + BuffersBytes: newuint64(1044611072), + CachedBytes: newuint64(12295823360), + SwapCachedBytes: newuint64(0), + ActiveBytes: newuint64(6923546624), + InactiveBytes: newuint64(6689492992), + ActiveAnonBytes: newuint64(273670144), + InactiveAnonBytes: newuint64(274432), + ActiveFileBytes: newuint64(6649876480), + InactiveFileBytes: newuint64(6689218560), + UnevictableBytes: newuint64(0), + MlockedBytes: newuint64(0), + SwapTotalBytes: newuint64(0), + SwapFreeBytes: newuint64(0), + DirtyBytes: newuint64(786432), + WritebackBytes: newuint64(0), + AnonPagesBytes: newuint64(272605184), + MappedBytes: newuint64(45264896), + ShmemBytes: newuint64(1339392), + SlabBytes: newuint64(1850638336), + SReclaimableBytes: newuint64(1779838976), + SUnreclaimBytes: newuint64(70799360), + KernelStackBytes: newuint64(1654784), + PageTablesBytes: newuint64(5414912), + NFSUnstableBytes: newuint64(0), + BounceBytes: newuint64(0), + WritebackTmpBytes: newuint64(0), + CommitLimitBytes: newuint64(8021086208), + CommittedASBytes: newuint64(543584256), + VmallocTotalBytes: newuint64(35184372087808), + VmallocUsedBytes: newuint64(37474304), + VmallocChunkBytes: newuint64(35184269148160), + HardwareCorruptedBytes: newuint64(0), + AnonHugePagesBytes: newuint64(12582912), + HugePagesTotalBytes: newuint64(0), + HugePagesFreeBytes: newuint64(0), + HugePagesRsvdBytes: newuint64(0), + HugePagesSurpBytes: newuint64(0), + HugepagesizeBytes: newuint64(2097152), + DirectMap4kBytes: newuint64(93323264), + DirectMap2MBytes: newuint64(16424894464), } have, err := getProcFixtures(t).Meminfo() From f75eb9ffe92d8022b54662ca164cd79e6462c39f Mon Sep 17 00:00:00 2001 From: TJ Hoplock Date: Mon, 25 Sep 2023 23:54:42 -0400 Subject: [PATCH 03/32] ref(meminfo): simplify variable assignment Addresses PR feedback https://github.com/prometheus/procfs/pull/569#discussion_r1336227047 Signed-off-by: TJ Hoplock --- meminfo.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/meminfo.go b/meminfo.go index cccdfcd0..ec00a624 100644 --- a/meminfo.go +++ b/meminfo.go @@ -217,13 +217,11 @@ func parseMemInfo(r io.Reader) (*Meminfo, error) { fields := strings.Fields(s.Text()) var val, valBytes uint64 - v, err := strconv.ParseUint(fields[1], 0, 64) + val, err := strconv.ParseUint(fields[1], 0, 64) if err != nil { return nil, err } - val = v - switch len(fields) { case 2: // No unit present, use the parsed the value as bytes directly. From 2cfca8d2424debda0823d73bbd3542ac78f889af Mon Sep 17 00:00:00 2001 From: TJ Hoplock Date: Tue, 26 Sep 2023 09:11:56 -0400 Subject: [PATCH 04/32] fix(meminfo): remove `bytes` versions of fields that aren't bytes Signed-off-by: TJ Hoplock --- meminfo.go | 8 -------- meminfo_test.go | 4 ---- 2 files changed, 12 deletions(-) diff --git a/meminfo.go b/meminfo.go index ec00a624..db1daea5 100644 --- a/meminfo.go +++ b/meminfo.go @@ -184,10 +184,6 @@ type Meminfo struct { ShmemPmdMappedBytes *uint64 CmaTotalBytes *uint64 CmaFreeBytes *uint64 - HugePagesTotalBytes *uint64 - HugePagesFreeBytes *uint64 - HugePagesRsvdBytes *uint64 - HugePagesSurpBytes *uint64 HugepagesizeBytes *uint64 DirectMap4kBytes *uint64 DirectMap2MBytes *uint64 @@ -363,16 +359,12 @@ func parseMemInfo(r io.Reader) (*Meminfo, error) { m.CmaFreeBytes = &valBytes case "HugePages_Total:": m.HugePagesTotal = &val - m.HugePagesTotalBytes = &valBytes case "HugePages_Free:": m.HugePagesFree = &val - m.HugePagesFreeBytes = &valBytes case "HugePages_Rsvd:": m.HugePagesRsvd = &val - m.HugePagesRsvdBytes = &valBytes case "HugePages_Surp:": m.HugePagesSurp = &val - m.HugePagesSurpBytes = &valBytes case "Hugepagesize:": m.Hugepagesize = &val m.HugepagesizeBytes = &valBytes diff --git a/meminfo_test.go b/meminfo_test.go index 5a4b761f..2d2b238e 100644 --- a/meminfo_test.go +++ b/meminfo_test.go @@ -98,10 +98,6 @@ func TestMeminfo(t *testing.T) { VmallocChunkBytes: newuint64(35184269148160), HardwareCorruptedBytes: newuint64(0), AnonHugePagesBytes: newuint64(12582912), - HugePagesTotalBytes: newuint64(0), - HugePagesFreeBytes: newuint64(0), - HugePagesRsvdBytes: newuint64(0), - HugePagesSurpBytes: newuint64(0), HugepagesizeBytes: newuint64(2097152), DirectMap4kBytes: newuint64(93323264), DirectMap2MBytes: newuint64(16424894464), From f78f9198438b6c9e4a1ae86c035ef8a99fc3ce49 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 1 Nov 2023 20:35:57 +0000 Subject: [PATCH 05/32] Bump github.com/google/go-cmp from 0.5.9 to 0.6.0 Bumps [github.com/google/go-cmp](https://github.com/google/go-cmp) from 0.5.9 to 0.6.0. - [Release notes](https://github.com/google/go-cmp/releases) - [Commits](https://github.com/google/go-cmp/compare/v0.5.9...v0.6.0) --- updated-dependencies: - dependency-name: github.com/google/go-cmp dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 18971c88..85e7be31 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/prometheus/procfs go 1.19 require ( - github.com/google/go-cmp v0.5.9 + github.com/google/go-cmp v0.6.0 golang.org/x/sync v0.3.0 golang.org/x/sys v0.12.0 ) diff --git a/go.sum b/go.sum index 1b5b75af..a296c70d 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= From 43bf3230cf5834c4eaf551a3a4e3a03c7e35a559 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 1 Nov 2023 20:35:54 +0000 Subject: [PATCH 06/32] Bump golang.org/x/sys from 0.12.0 to 0.13.0 Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.12.0 to 0.13.0. - [Commits](https://github.com/golang/sys/compare/v0.12.0...v0.13.0) --- updated-dependencies: - dependency-name: golang.org/x/sys dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 85e7be31..203336b4 100644 --- a/go.mod +++ b/go.mod @@ -5,5 +5,5 @@ go 1.19 require ( github.com/google/go-cmp v0.6.0 golang.org/x/sync v0.3.0 - golang.org/x/sys v0.12.0 + golang.org/x/sys v0.13.0 ) diff --git a/go.sum b/go.sum index a296c70d..37ee1c70 100644 --- a/go.sum +++ b/go.sum @@ -2,5 +2,5 @@ github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= -golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= From e9c69c6c273defc8113437b8298b0b69f870495a Mon Sep 17 00:00:00 2001 From: prombot Date: Fri, 3 Nov 2023 17:49:19 +0000 Subject: [PATCH 07/32] Update common Prometheus files Signed-off-by: prombot --- .github/workflows/golangci-lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 15cf547b..babd8a0c 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -18,7 +18,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - name: install Go uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0 with: From 6990574fdeb9e100ce4a7f54a71a11a7e79150a5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 12 Nov 2023 23:18:26 +0000 Subject: [PATCH 08/32] Bump golang.org/x/sync from 0.3.0 to 0.5.0 Bumps [golang.org/x/sync](https://github.com/golang/sync) from 0.3.0 to 0.5.0. - [Commits](https://github.com/golang/sync/compare/v0.3.0...v0.5.0) --- updated-dependencies: - dependency-name: golang.org/x/sync dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 203336b4..56ba14c0 100644 --- a/go.mod +++ b/go.mod @@ -4,6 +4,6 @@ go 1.19 require ( github.com/google/go-cmp v0.6.0 - golang.org/x/sync v0.3.0 + golang.org/x/sync v0.5.0 golang.org/x/sys v0.13.0 ) diff --git a/go.sum b/go.sum index 37ee1c70..cabf2978 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,6 @@ github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= -golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= +golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= From f11f6e4f993aa4af60951afe4d5ec47f8cc9e28d Mon Sep 17 00:00:00 2001 From: linuxgcc Date: Wed, 22 Nov 2023 15:46:47 +0800 Subject: [PATCH 09/32] Update crypto.go, fix incorrect spelling (#591) Signed-off-by: linuxgcc --- crypto.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto.go b/crypto.go index 9a73e263..13ee66f1 100644 --- a/crypto.go +++ b/crypto.go @@ -84,7 +84,7 @@ func parseCrypto(r io.Reader) ([]Crypto, error) { kv := strings.Split(text, ":") if len(kv) != 2 { - return nil, fmt.Errorf("%w: Cannot parae line: %q", ErrFileParse, text) + return nil, fmt.Errorf("%w: Cannot parse line: %q", ErrFileParse, text) } k := strings.TrimSpace(kv[0]) From 9fdfbe8443465c0da56ca44ff5b1d16250e6a396 Mon Sep 17 00:00:00 2001 From: Aleksandr Lebedev <49903054+alebsys@users.noreply.github.com> Date: Tue, 28 Nov 2023 19:17:12 +0300 Subject: [PATCH 10/32] Add udp drops (#538) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add drops field in /proc/net/udp{,6} files for parsing Signed-off-by: Aleksandr Lebedev Signed-off-by: Александр Лебедев * Add count of UDP dropped packets Signed-off-by: Aleksandr Lebedev Signed-off-by: Александр Лебедев * Change the type of variable isUDP to local Signed-off-by: Александр Лебедев * Update net_ip_socket.go Co-authored-by: Ben Kochie Signed-off-by: Aleksandr Lebedev <49903054+alebsys@users.noreply.github.com> * Update net_ip_socket.go Co-authored-by: Ben Kochie Signed-off-by: Aleksandr Lebedev <49903054+alebsys@users.noreply.github.com> --------- Signed-off-by: Aleksandr Lebedev Signed-off-by: Александр Лебедев Signed-off-by: Aleksandr Lebedev <49903054+alebsys@users.noreply.github.com> Co-authored-by: Ben Kochie --- net_ip_socket.go | 26 +++++++++++++++++++++++--- net_ip_socket_test.go | 10 +++++++++- net_udp_test.go | 15 +++++++++++++-- 3 files changed, 45 insertions(+), 6 deletions(-) diff --git a/net_ip_socket.go b/net_ip_socket.go index 4da81ea5..ba7d9caa 100644 --- a/net_ip_socket.go +++ b/net_ip_socket.go @@ -50,10 +50,13 @@ type ( // UsedSockets shows the total number of parsed lines representing the // number of used sockets. UsedSockets uint64 + // Drops shows the total number of dropped packets of all UPD sockets. + Drops *uint64 } // netIPSocketLine represents the fields parsed from a single line // in /proc/net/{t,u}dp{,6}. Fields which are not used by IPSocket are skipped. + // Drops is non-nil for udp{,6}, but nil for tcp{,6}. // For the proc file format details, see https://linux.die.net/man/5/proc. netIPSocketLine struct { Sl uint64 @@ -66,6 +69,7 @@ type ( RxQueue uint64 UID uint64 Inode uint64 + Drops *uint64 } ) @@ -77,13 +81,14 @@ func newNetIPSocket(file string) (NetIPSocket, error) { defer f.Close() var netIPSocket NetIPSocket + isUDP := strings.Contains(file, "udp") lr := io.LimitReader(f, readLimit) s := bufio.NewScanner(lr) s.Scan() // skip first line with headers for s.Scan() { fields := strings.Fields(s.Text()) - line, err := parseNetIPSocketLine(fields) + line, err := parseNetIPSocketLine(fields, isUDP) if err != nil { return nil, err } @@ -104,19 +109,25 @@ func newNetIPSocketSummary(file string) (*NetIPSocketSummary, error) { defer f.Close() var netIPSocketSummary NetIPSocketSummary + var udpPacketDrops uint64 + isUDP := strings.Contains(file, "udp") lr := io.LimitReader(f, readLimit) s := bufio.NewScanner(lr) s.Scan() // skip first line with headers for s.Scan() { fields := strings.Fields(s.Text()) - line, err := parseNetIPSocketLine(fields) + line, err := parseNetIPSocketLine(fields, isUDP) if err != nil { return nil, err } netIPSocketSummary.TxQueueLength += line.TxQueue netIPSocketSummary.RxQueueLength += line.RxQueue netIPSocketSummary.UsedSockets++ + if isUDP { + udpPacketDrops += *line.Drops + netIPSocketSummary.Drops = &udpPacketDrops + } } if err := s.Err(); err != nil { return nil, err @@ -149,7 +160,7 @@ func parseIP(hexIP string) (net.IP, error) { } // parseNetIPSocketLine parses a single line, represented by a list of fields. -func parseNetIPSocketLine(fields []string) (*netIPSocketLine, error) { +func parseNetIPSocketLine(fields []string, isUDP bool) (*netIPSocketLine, error) { line := &netIPSocketLine{} if len(fields) < 10 { return nil, fmt.Errorf( @@ -224,5 +235,14 @@ func parseNetIPSocketLine(fields []string) (*netIPSocketLine, error) { return nil, fmt.Errorf("%s: Cannot parse inode value in %q: %w", ErrFileParse, line.Inode, err) } + // drops + if isUDP { + drops, err := strconv.ParseUint(fields[12], 0, 64) + if err != nil { + return nil, fmt.Errorf("%s: Cannot parse drops value in %q: %w", ErrFileParse, drops, err) + } + line.Drops = &drops + } + return line, nil } diff --git a/net_ip_socket_test.go b/net_ip_socket_test.go index 9bbad87f..3c057fbe 100644 --- a/net_ip_socket_test.go +++ b/net_ip_socket_test.go @@ -25,6 +25,7 @@ func Test_parseNetIPSocketLine(t *testing.T) { name string want *netIPSocketLine wantErr bool + isUDP bool }{ { name: "reading valid lines, no issue should happened", @@ -96,10 +97,17 @@ func Test_parseNetIPSocketLine(t *testing.T) { want: nil, wantErr: true, }, + { + name: "error case - parse Drops - not a valid uint", + fields: []string{"1:", "00000000:0000", "00000000:0000", "07", "00000000:00000001", "0:0", "0", "10", "0", "39309", "2", "000000009bd60d72", "-5"}, + want: nil, + wantErr: true, + isUDP: true, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - got, err := parseNetIPSocketLine(tt.fields) + got, err := parseNetIPSocketLine(tt.fields, tt.isUDP) if (err != nil) != tt.wantErr { t.Errorf("parseNetIPSocketLine() error = %v, wantErr %v", err, tt.wantErr) return diff --git a/net_udp_test.go b/net_udp_test.go index 9abb64d5..65761610 100644 --- a/net_udp_test.go +++ b/net_udp_test.go @@ -41,6 +41,7 @@ func Test_newNetUDP(t *testing.T) { RxQueue: 1, UID: 0, Inode: 2740, + Drops: intToU64(100), }, &netIPSocketLine{ Sl: 1, @@ -53,6 +54,7 @@ func Test_newNetUDP(t *testing.T) { RxQueue: 0, UID: 0, Inode: 2740, + Drops: intToU64(100), }, &netIPSocketLine{ Sl: 2, @@ -65,6 +67,7 @@ func Test_newNetUDP(t *testing.T) { RxQueue: 1, UID: 0, Inode: 2740, + Drops: intToU64(100), }, }, wantErr: false, @@ -84,6 +87,7 @@ func Test_newNetUDP(t *testing.T) { RxQueue: 0, UID: 981, Inode: 21040, + Drops: intToU64(0), }, &netIPSocketLine{ Sl: 6073, @@ -96,6 +100,7 @@ func Test_newNetUDP(t *testing.T) { RxQueue: 0, UID: 1000, Inode: 11337031, + Drops: intToU64(0), }, }, wantErr: false, @@ -137,13 +142,13 @@ func Test_newNetUDPSummary(t *testing.T) { { name: "udp file found, no error should come up", file: "testdata/fixtures/proc/net/udp", - want: &NetUDPSummary{TxQueueLength: 2, RxQueueLength: 2, UsedSockets: 3}, + want: &NetUDPSummary{TxQueueLength: 2, RxQueueLength: 2, UsedSockets: 3, Drops: intToU64(300)}, wantErr: false, }, { name: "udp6 file found, no error should come up", file: "testdata/fixtures/proc/net/udp6", - want: &NetUDPSummary{TxQueueLength: 0, RxQueueLength: 0, UsedSockets: 2}, + want: &NetUDPSummary{TxQueueLength: 0, RxQueueLength: 0, UsedSockets: 2, Drops: intToU64(0)}, wantErr: false, }, { @@ -172,3 +177,9 @@ func Test_newNetUDPSummary(t *testing.T) { }) } } + +// intToU64 convert int to uint64 and return it pointer. +func intToU64(i int) *uint64 { + cast := uint64(i) + return &cast +} From feff2895e5752d30f5e175452f555fc06a7f9fbb Mon Sep 17 00:00:00 2001 From: PrometheusBot Date: Tue, 28 Nov 2023 17:17:47 +0100 Subject: [PATCH 11/32] Update common Prometheus files (#590) Signed-off-by: prombot --- .github/workflows/golangci-lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index babd8a0c..ffa6b309 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -22,7 +22,7 @@ jobs: - name: install Go uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0 with: - go-version: 1.20.x + go-version: 1.21.x - name: Install snmp_exporter/generator dependencies run: sudo apt-get update && sudo apt-get -y install libsnmp-dev if: github.repository == 'prometheus/snmp_exporter' From 732ca0f7c4351613d998dcda0c226b7905cd89d8 Mon Sep 17 00:00:00 2001 From: PrometheusBot Date: Sun, 10 Dec 2023 15:17:27 +0100 Subject: [PATCH 12/32] Update common Prometheus files (#595) Signed-off-by: prombot --- Makefile.common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.common b/Makefile.common index 062a2818..bc2a07d7 100644 --- a/Makefile.common +++ b/Makefile.common @@ -61,7 +61,7 @@ PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_ SKIP_GOLANGCI_LINT := GOLANGCI_LINT := GOLANGCI_LINT_OPTS ?= -GOLANGCI_LINT_VERSION ?= v1.54.2 +GOLANGCI_LINT_VERSION ?= v1.55.2 # golangci-lint only supports linux, darwin and windows platforms on i386/amd64. # windows isn't included here because of the path separator being different. ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux darwin)) From 8f660d11d0994d396401ab04ff601c545eb6ee98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=8D=BF?= Date: Thu, 14 Dec 2023 19:36:14 +0800 Subject: [PATCH 13/32] meminfo: add Percpu field (#588) Signed-off-by: wangqing Co-authored-by: wangqing --- meminfo.go | 5 +++++ meminfo_test.go | 2 ++ testdata/fixtures.ttar | 3 ++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/meminfo.go b/meminfo.go index db1daea5..73a03e8a 100644 --- a/meminfo.go +++ b/meminfo.go @@ -126,6 +126,7 @@ type Meminfo struct { VmallocUsed *uint64 // largest contiguous block of vmalloc area which is free VmallocChunk *uint64 + Percpu *uint64 HardwareCorrupted *uint64 AnonHugePages *uint64 ShmemHugePages *uint64 @@ -178,6 +179,7 @@ type Meminfo struct { VmallocTotalBytes *uint64 VmallocUsedBytes *uint64 VmallocChunkBytes *uint64 + PercpuBytes *uint64 HardwareCorruptedBytes *uint64 AnonHugePagesBytes *uint64 ShmemHugePagesBytes *uint64 @@ -339,6 +341,9 @@ func parseMemInfo(r io.Reader) (*Meminfo, error) { case "VmallocChunk:": m.VmallocChunk = &val m.VmallocChunkBytes = &valBytes + case "Percpu:": + m.Percpu = &val + m.PercpuBytes = &valBytes case "HardwareCorrupted:": m.HardwareCorrupted = &val m.HardwareCorruptedBytes = &valBytes diff --git a/meminfo_test.go b/meminfo_test.go index 2d2b238e..3d3b4093 100644 --- a/meminfo_test.go +++ b/meminfo_test.go @@ -53,6 +53,7 @@ func TestMeminfo(t *testing.T) { VmallocTotal: newuint64(34359738367), VmallocUsed: newuint64(36596), VmallocChunk: newuint64(34359637840), + Percpu: newuint64(26176), HardwareCorrupted: newuint64(0), AnonHugePages: newuint64(12288), HugePagesTotal: newuint64(0), @@ -96,6 +97,7 @@ func TestMeminfo(t *testing.T) { VmallocTotalBytes: newuint64(35184372087808), VmallocUsedBytes: newuint64(37474304), VmallocChunkBytes: newuint64(35184269148160), + PercpuBytes: newuint64(26804224), HardwareCorruptedBytes: newuint64(0), AnonHugePagesBytes: newuint64(12582912), HugepagesizeBytes: newuint64(2097152), diff --git a/testdata/fixtures.ttar b/testdata/fixtures.ttar index 92f72fa2..67065168 100644 --- a/testdata/fixtures.ttar +++ b/testdata/fixtures.ttar @@ -2317,7 +2317,7 @@ unused devices: Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/proc/meminfo -Lines: 42 +Lines: 43 MemTotal: 15666184 kB MemFree: 440324 kB Buffers: 1020128 kB @@ -2351,6 +2351,7 @@ Committed_AS: 530844 kB VmallocTotal: 34359738367 kB VmallocUsed: 36596 kB VmallocChunk: 34359637840 kB +Percpu: 26176 kB HardwareCorrupted: 0 kB AnonHugePages: 12288 kB HugePages_Total: 0 From 534069ed45f2a7298e443826f25c7d1d76de19c0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 14 Dec 2023 12:36:26 +0100 Subject: [PATCH 14/32] Bump golang.org/x/sys from 0.13.0 to 0.15.0 (#593) Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.13.0 to 0.15.0. - [Commits](https://github.com/golang/sys/compare/v0.13.0...v0.15.0) --- updated-dependencies: - dependency-name: golang.org/x/sys dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 56ba14c0..1a75fa44 100644 --- a/go.mod +++ b/go.mod @@ -5,5 +5,5 @@ go 1.19 require ( github.com/google/go-cmp v0.6.0 golang.org/x/sync v0.5.0 - golang.org/x/sys v0.13.0 + golang.org/x/sys v0.15.0 ) diff --git a/go.sum b/go.sum index cabf2978..1d329dc2 100644 --- a/go.sum +++ b/go.sum @@ -2,5 +2,5 @@ github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= From a45c08c3e4548044d60f5edd0579726885d6288f Mon Sep 17 00:00:00 2001 From: PrometheusBot Date: Thu, 14 Dec 2023 12:36:43 +0100 Subject: [PATCH 15/32] Update common Prometheus files (#596) Signed-off-by: prombot --- .github/workflows/golangci-lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index ffa6b309..805c59fb 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -29,4 +29,4 @@ jobs: - name: Lint uses: golangci/golangci-lint-action@3a919529898de77ec3da873e3063ca4b10e7f5cc # v3.7.0 with: - version: v1.54.2 + version: v1.55.2 From 8a3ea466574f5c262aa061d11a5d9ac122705fb6 Mon Sep 17 00:00:00 2001 From: PrometheusBot Date: Mon, 18 Dec 2023 23:51:24 +0100 Subject: [PATCH 16/32] Update common Prometheus files (#598) Signed-off-by: prombot --- .github/workflows/golangci-lint.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 805c59fb..4b292229 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -12,8 +12,14 @@ on: - ".golangci.yml" pull_request: +permissions: # added using https://github.com/step-security/secure-repo + contents: read + jobs: golangci: + permissions: + contents: read # for actions/checkout to fetch code + pull-requests: read # for golangci/golangci-lint-action to fetch pull requests name: lint runs-on: ubuntu-latest steps: From 495e4837a993806d41b3f1e918ee56271976c27b Mon Sep 17 00:00:00 2001 From: prombot Date: Mon, 8 Jan 2024 17:48:01 +0000 Subject: [PATCH 17/32] Update common Prometheus files Signed-off-by: prombot --- .github/workflows/golangci-lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 4b292229..8f252791 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -26,7 +26,7 @@ jobs: - name: Checkout repository uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - name: install Go - uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0 + uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 with: go-version: 1.21.x - name: Install snmp_exporter/generator dependencies From f06ab8fb0ea97b38ba0fcdbb1cc9b1cdbddb3829 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 2 Feb 2024 09:10:34 +0100 Subject: [PATCH 18/32] Bump golang.org/x/sync from 0.5.0 to 0.6.0 (#602) Bumps [golang.org/x/sync](https://github.com/golang/sync) from 0.5.0 to 0.6.0. - [Commits](https://github.com/golang/sync/compare/v0.5.0...v0.6.0) --- updated-dependencies: - dependency-name: golang.org/x/sync dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 1a75fa44..29e9b291 100644 --- a/go.mod +++ b/go.mod @@ -4,6 +4,6 @@ go 1.19 require ( github.com/google/go-cmp v0.6.0 - golang.org/x/sync v0.5.0 + golang.org/x/sync v0.6.0 golang.org/x/sys v0.15.0 ) diff --git a/go.sum b/go.sum index 1d329dc2..197844b1 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,6 @@ github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= -golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= +golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= From dd493f45ddad658c99c4e58989222082cc0a0a96 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 2 Feb 2024 09:35:38 +0100 Subject: [PATCH 19/32] Bump golang.org/x/sys from 0.15.0 to 0.16.0 (#603) Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.15.0 to 0.16.0. - [Commits](https://github.com/golang/sys/compare/v0.15.0...v0.16.0) --- updated-dependencies: - dependency-name: golang.org/x/sys dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 29e9b291..1e58b3a1 100644 --- a/go.mod +++ b/go.mod @@ -5,5 +5,5 @@ go 1.19 require ( github.com/google/go-cmp v0.6.0 golang.org/x/sync v0.6.0 - golang.org/x/sys v0.15.0 + golang.org/x/sys v0.16.0 ) diff --git a/go.sum b/go.sum index 197844b1..caa1dc90 100644 --- a/go.sum +++ b/go.sum @@ -2,5 +2,5 @@ github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= -golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= From 868112d62466a723be5986bfb288f40670ff98eb Mon Sep 17 00:00:00 2001 From: Daniel Swarbrick Date: Thu, 15 Feb 2024 11:32:47 +0100 Subject: [PATCH 20/32] infiniband: support Intel irdma devices (#605) This skips parsing /sys/class/infiniband//ports//counters for irdma devices, which do not expose it, and would previously cause parseInfiniBandPort() to return an error. Instead, irdma devices expose /sys/class/infiniband//ports//hw_counters. Fixes: #589 Signed-off-by: Daniel Swarbrick --- sysfs/class_infiniband.go | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/sysfs/class_infiniband.go b/sysfs/class_infiniband.go index 90dc0d02..7892c69a 100644 --- a/sysfs/class_infiniband.go +++ b/sysfs/class_infiniband.go @@ -279,13 +279,16 @@ func (fs FS) parseInfiniBandPort(name string, port string) (*InfiniBandPort, err return nil, fmt.Errorf("could not parse rate file in %q: %w", portPath, err) } - counters, err := parseInfiniBandCounters(portPath) - if err != nil { - return nil, err + // Intel irdma module does not expose /sys/class/infiniband//ports//counters + if !strings.HasPrefix(ibp.Name, "irdma") { + counters, err := parseInfiniBandCounters(portPath) + if err != nil { + return nil, err + } + ibp.Counters = *counters } - ibp.Counters = *counters - if strings.Contains(ibp.Name, "mlx5") { + if strings.HasPrefix(ibp.Name, "irdma") || strings.HasPrefix(ibp.Name, "mlx5_") { hwCounters, err := parseInfiniBandHwCounters(portPath) if err != nil { return nil, err @@ -296,6 +299,9 @@ func (fs FS) parseInfiniBandPort(name string, port string) (*InfiniBandPort, err return &ibp, nil } +// parseInfiniBandCounters parses the counters exposed under +// /sys/class/infiniband//ports//counters, which first appeared in kernel v2.6.12. +// Prior to kernel v4.5, 64-bit counters were exposed separately under the "counters_ext" directory. func parseInfiniBandCounters(portPath string) (*InfiniBandCounters, error) { var counters InfiniBandCounters @@ -393,7 +399,7 @@ func parseInfiniBandCounters(portPath string) (*InfiniBandCounters, error) { } } - // Parse legacy counters + // Parse pre-kernel-v4.5 64-bit counters. path = filepath.Join(portPath, "counters_ext") files, err = os.ReadDir(path) if err != nil && !os.IsNotExist(err) { @@ -457,6 +463,8 @@ func parseInfiniBandCounters(portPath string) (*InfiniBandCounters, error) { return &counters, nil } +// parseInfiniBandHwCounters parses the optional counters exposed under +// /sys/class/infiniband//ports//hw_counters, which first appeared in kernel v4.6. func parseInfiniBandHwCounters(portPath string) (*InfiniBandHwCounters, error) { var hwCounters InfiniBandHwCounters From d735b08f15fc72120e8f2d5cffb9bf6bfe82e05c Mon Sep 17 00:00:00 2001 From: PrometheusBot Date: Thu, 15 Feb 2024 11:32:57 +0100 Subject: [PATCH 21/32] Update common Prometheus files (#604) Signed-off-by: prombot --- Makefile.common | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.common b/Makefile.common index bc2a07d7..5fd17823 100644 --- a/Makefile.common +++ b/Makefile.common @@ -62,10 +62,10 @@ SKIP_GOLANGCI_LINT := GOLANGCI_LINT := GOLANGCI_LINT_OPTS ?= GOLANGCI_LINT_VERSION ?= v1.55.2 -# golangci-lint only supports linux, darwin and windows platforms on i386/amd64. +# golangci-lint only supports linux, darwin and windows platforms on i386/amd64/arm64. # windows isn't included here because of the path separator being different. ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux darwin)) - ifeq ($(GOHOSTARCH),$(filter $(GOHOSTARCH),amd64 i386)) + ifeq ($(GOHOSTARCH),$(filter $(GOHOSTARCH),amd64 i386 arm64)) # If we're in CI and there is an Actions file, that means the linter # is being run in Actions, so we don't need to run it here. ifneq (,$(SKIP_GOLANGCI_LINT)) From 51a293e4e78765bd0075c9280e7546a3823a7952 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=8D=BF?= Date: Thu, 15 Feb 2024 18:33:22 +0800 Subject: [PATCH 22/32] golint: redundant type from array, slice, or map composite literal (#601) Signed-off-by: wangqing Co-authored-by: wangqing --- net_tcp_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/net_tcp_test.go b/net_tcp_test.go index a32e2fbf..5ff33ef3 100644 --- a/net_tcp_test.go +++ b/net_tcp_test.go @@ -30,7 +30,7 @@ func Test_newNetTCP(t *testing.T) { name: "tcp file found, no error should come up", file: "testdata/fixtures/proc/net/tcp", want: []*netIPSocketLine{ - &netIPSocketLine{ + { Sl: 0, LocalAddr: net.IP{10, 0, 0, 5}, LocalPort: 22, @@ -42,7 +42,7 @@ func Test_newNetTCP(t *testing.T) { UID: 0, Inode: 2740, }, - &netIPSocketLine{ + { Sl: 1, LocalAddr: net.IP{0, 0, 0, 0}, LocalPort: 22, @@ -54,7 +54,7 @@ func Test_newNetTCP(t *testing.T) { UID: 0, Inode: 2740, }, - &netIPSocketLine{ + { Sl: 2, LocalAddr: net.IP{0, 0, 0, 0}, LocalPort: 22, @@ -73,7 +73,7 @@ func Test_newNetTCP(t *testing.T) { name: "tcp6 file found, no error should come up", file: "testdata/fixtures/proc/net/tcp6", want: []*netIPSocketLine{ - &netIPSocketLine{ + { Sl: 1315, LocalAddr: net.IP{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, LocalPort: 5355, @@ -85,7 +85,7 @@ func Test_newNetTCP(t *testing.T) { UID: 981, Inode: 21040, }, - &netIPSocketLine{ + { Sl: 6073, LocalAddr: net.IP{254, 128, 0, 0, 0, 0, 0, 0, 86, 225, 173, 255, 254, 124, 102, 9}, LocalPort: 51073, From f5f033b6361defb959f5405d652856de29bdba04 Mon Sep 17 00:00:00 2001 From: dongjiang Date: Thu, 15 Feb 2024 18:35:45 +0800 Subject: [PATCH 23/32] feat: Add `/sys/fs/btrfs//commit_stats` statistics (#580) * Add commit_stats statistics --------- Signed-off-by: dongjiang1989 Co-authored-by: Ben Kochie --- btrfs/btrfs.go | 10 ++++++++ btrfs/get.go | 58 ++++++++++++++++++++++++++++++++++++++++++ btrfs/get_test.go | 54 +++++++++++++++++++++++++++++---------- testdata/fixtures.ttar | 8 ++++++ 4 files changed, 116 insertions(+), 14 deletions(-) diff --git a/btrfs/btrfs.go b/btrfs/btrfs.go index 094c898a..5b4ff350 100644 --- a/btrfs/btrfs.go +++ b/btrfs/btrfs.go @@ -25,6 +25,7 @@ type Stats struct { NodeSize uint64 QuotaOverride uint64 SectorSize uint64 + CommitStats CommitStats } // Allocation contains allocation statistics for data, metadata and system data. @@ -65,3 +66,12 @@ type LayoutUsage struct { type Device struct { Size uint64 } + +// Number of commits and various time related statistics. +// See Linux fs/btrfs/sysfs.c with 6.x version. +type CommitStats struct { + Commits uint64 + LastCommitMs uint64 + MaxCommitMs uint64 + TotalCommitMs uint64 +} diff --git a/btrfs/get.go b/btrfs/get.go index 77c72e12..db0046b6 100644 --- a/btrfs/get.go +++ b/btrfs/get.go @@ -14,6 +14,8 @@ package btrfs import ( + "bufio" + "fmt" "os" "path" "path/filepath" @@ -245,6 +247,62 @@ func (r *reader) readFilesystemStats() (s *Stats) { Metadata: r.readAllocationStats("allocation/metadata"), System: r.readAllocationStats("allocation/system"), }, + + // Read commit stats data + CommitStats: r.readCommitStats("commit_stats"), } return } + +// readCommitStats returns the commit_stats information for commit stats metrics. +func (r *reader) readCommitStats(p string) CommitStats { + stats := CommitStats{} + + f, err := os.Open(path.Join(r.path, p)) + if err != nil { + // if commit_stats not found. maybe btrfs version < 6.0 + if !os.IsNotExist(err) { + r.err = err + } + return stats + } + defer f.Close() + + scanner := bufio.NewScanner(f) + + for scanner.Scan() { + line := scanner.Text() + parts := strings.Fields(scanner.Text()) + // require + if len(parts) != 2 { + r.err = fmt.Errorf("invalid commit_stats line %q", line) + return stats + } + + value, err := strconv.ParseUint(parts[1], 10, 64) + if err != nil { + r.err = fmt.Errorf("error parsing commit_stats line: %w", err) + return stats + } + + switch metricName := parts[0]; metricName { + case "commits": + stats.Commits = value + case "last_commit_ms": + stats.LastCommitMs = value + case "max_commit_ms": + stats.MaxCommitMs = value + case "total_commit_ms": + stats.TotalCommitMs = value + default: + continue + } + } + + if err := scanner.Err(); err != nil { + r.err = fmt.Errorf("error scanning commit_stats file: %w", err) + return stats + } + + return stats +} diff --git a/btrfs/get_test.go b/btrfs/get_test.go index 23059c62..e2d09e1b 100644 --- a/btrfs/get_test.go +++ b/btrfs/get_test.go @@ -19,6 +19,7 @@ type testVector struct { uuid, label string devices, features int data, meta, system alloc + commitstats commit } type alloc struct { @@ -27,6 +28,13 @@ type alloc struct { ratio float64 } +type commit struct { + commits uint64 + lastCommitMs uint64 + maxCommitMs uint64 + totalCommitMs uint64 +} + func TestFSBtrfsStats(t *testing.T) { btrfs, err := NewFS("testdata/fixtures/sys") if err != nil { @@ -39,22 +47,24 @@ func TestFSBtrfsStats(t *testing.T) { tests := []testVector{ { - uuid: "0abb23a9-579b-43e6-ad30-227ef47fcb9d", - label: "fixture", - devices: 2, - features: 4, - data: alloc{"raid0", 2147483648, 1}, - meta: alloc{"raid1", 1073741824, 2}, - system: alloc{"raid1", 8388608, 2}, + uuid: "0abb23a9-579b-43e6-ad30-227ef47fcb9d", + label: "fixture", + devices: 2, + features: 4, + data: alloc{"raid0", 2147483648, 1}, + meta: alloc{"raid1", 1073741824, 2}, + system: alloc{"raid1", 8388608, 2}, + commitstats: commit{258051, 1000, 51462, 47836090}, }, { - uuid: "7f07c59f-6136-449c-ab87-e1cf2328731b", - label: "", - devices: 4, - features: 5, - data: alloc{"raid5", 644087808, 4. / 3.}, - meta: alloc{"raid6", 429391872, 4. / 2.}, - system: alloc{"raid6", 16777216, 4. / 2.}, + uuid: "7f07c59f-6136-449c-ab87-e1cf2328731b", + label: "", + devices: 4, + features: 5, + data: alloc{"raid5", 644087808, 4. / 3.}, + meta: alloc{"raid6", 429391872, 4. / 2.}, + system: alloc{"raid6", 16777216, 4. / 2.}, + commitstats: commit{0, 0, 0, 0}, }, } @@ -98,5 +108,21 @@ func TestFSBtrfsStats(t *testing.T) { if want, got := tt.system.ratio, stats[i].Allocation.System.Layouts[tt.system.layout].Ratio; want != got { t.Errorf("fs %q unexpected system ratio:\nwant: %f\nhave: %f", tt.uuid, want, got) } + + if want, got := tt.commitstats.commits, stats[i].CommitStats.Commits; want != got { + t.Errorf("fs %q unexpected commit stats commits:\nwant: %d\nhave: %d", tt.uuid, want, got) + } + + if want, got := tt.commitstats.lastCommitMs, stats[i].CommitStats.LastCommitMs; want != got { + t.Errorf("fs %q unexpected commit stats last_commit_ms:\nwant: %d\nhave: %d", tt.uuid, want, got) + } + + if want, got := tt.commitstats.maxCommitMs, stats[i].CommitStats.MaxCommitMs; want != got { + t.Errorf("fs %q unexpected commit stats max_commit_ms:\nwant: %d\nhave: %d", tt.uuid, want, got) + } + + if want, got := tt.commitstats.totalCommitMs, stats[i].CommitStats.TotalCommitMs; want != got { + t.Errorf("fs %q unexpected commit stats total_commit_ms:\nwant: %d\nhave: %d", tt.uuid, want, got) + } } } diff --git a/testdata/fixtures.ttar b/testdata/fixtures.ttar index 67065168..b22807ac 100644 --- a/testdata/fixtures.ttar +++ b/testdata/fixtures.ttar @@ -14230,6 +14230,14 @@ Lines: 1 4096 Mode: 444 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/commit_stats +Lines: 4 +commits 258051 +last_commit_ms 1000 +max_commit_ms 51462 +total_commit_ms 47836090EOF +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/devices Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From d254b01acd8fc100224b6a3a2326794cf4ae8a3a Mon Sep 17 00:00:00 2001 From: Thomas Barrett Date: Thu, 15 Feb 2024 02:46:45 -0800 Subject: [PATCH 24/32] Add support for gtime and cgtime stats. (#597) Signed-off-by: Thomas Barrett Co-authored-by: Thomas Barrett --- proc_stat.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/proc_stat.go b/proc_stat.go index 923e5500..06a8d931 100644 --- a/proc_stat.go +++ b/proc_stat.go @@ -110,6 +110,11 @@ type ProcStat struct { Policy uint // Aggregated block I/O delays, measured in clock ticks (centiseconds). DelayAcctBlkIOTicks uint64 + // Guest time of the process (time spent running a virtual CPU for a guest + // operating system), measured in clock ticks. + GuestTime int + // Guest time of the process's children, measured in clock ticks. + CGuestTime int proc FS } @@ -189,6 +194,8 @@ func (p Proc) Stat() (ProcStat, error) { &s.RTPriority, &s.Policy, &s.DelayAcctBlkIOTicks, + &s.GuestTime, + &s.CGuestTime, ) if err != nil { return ProcStat{}, err From 0f527e6c5ec041fc9b72ff4b8b1560206bbe0cbd Mon Sep 17 00:00:00 2001 From: Gavin Lam Date: Thu, 15 Feb 2024 05:50:29 -0500 Subject: [PATCH 25/32] Add `/sys/class/watchdog` statistics (#594) Signed-off-by: Gavin Lam --- sysfs/class_watchdog.go | 123 +++++++++++++++++++++++++++++++++++ sysfs/class_watchdog_test.go | 76 ++++++++++++++++++++++ testdata/fixtures.ttar | 69 ++++++++++++++++++++ 3 files changed, 268 insertions(+) create mode 100644 sysfs/class_watchdog.go create mode 100644 sysfs/class_watchdog_test.go diff --git a/sysfs/class_watchdog.go b/sysfs/class_watchdog.go new file mode 100644 index 00000000..bcc2a67f --- /dev/null +++ b/sysfs/class_watchdog.go @@ -0,0 +1,123 @@ +// Copyright 2023 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build linux +// +build linux + +package sysfs + +import ( + "fmt" + "os" + "path/filepath" + + "github.com/prometheus/procfs/internal/util" +) + +const watchdogClassPath = "class/watchdog" + +// WatchdogStats contains info from files in /sys/class/watchdog for a single watchdog device. +// https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-class-watchdog +type WatchdogStats struct { + Name string + Bootstatus *int64 // /sys/class/watchdog//bootstatus + Options *string // /sys/class/watchdog//options + FwVersion *int64 // /sys/class/watchdog//fw_version + Identity *string // /sys/class/watchdog//identity + Nowayout *int64 // /sys/class/watchdog//nowayout + State *string // /sys/class/watchdog//state + Status *string // /sys/class/watchdog//status + Timeleft *int64 // /sys/class/watchdog//timeleft + Timeout *int64 // /sys/class/watchdog//timeout + Pretimeout *int64 // /sys/class/watchdog//pretimeout + PretimeoutGovernor *string // /sys/class/watchdog//pretimeout_governor + AccessCs0 *int64 // /sys/class/watchdog//access_cs0 +} + +// WatchdogClass is a collection of statistics for every watchdog device in /sys/class/watchdog. +// +// The map keys are the names of the watchdog devices. +type WatchdogClass map[string]WatchdogStats + +// WatchdogClass returns info for all watchdog devices read from /sys/class/watchdog. +func (fs FS) WatchdogClass() (WatchdogClass, error) { + path := fs.sys.Path(watchdogClassPath) + + dirs, err := os.ReadDir(path) + if err != nil { + return nil, fmt.Errorf("failed to list watchdog devices at %q: %w", path, err) + } + + wds := make(WatchdogClass, len(dirs)) + for _, d := range dirs { + stats, err := fs.parseWatchdog(d.Name()) + if err != nil { + return nil, err + } + + wds[stats.Name] = *stats + } + + return wds, nil +} + +func (fs FS) parseWatchdog(wdName string) (*WatchdogStats, error) { + path := fs.sys.Path(watchdogClassPath, wdName) + wd := WatchdogStats{Name: wdName} + + for _, f := range [...]string{"bootstatus", "options", "fw_version", "identity", "nowayout", "state", "status", "timeleft", "timeout", "pretimeout", "pretimeout_governor", "access_cs0"} { + name := filepath.Join(path, f) + value, err := util.SysReadFile(name) + if err != nil { + if os.IsNotExist(err) { + continue + } + return nil, fmt.Errorf("failed to read file %q: %w", name, err) + } + + vp := util.NewValueParser(value) + + switch f { + case "bootstatus": + wd.Bootstatus = vp.PInt64() + case "options": + wd.Options = &value + case "fw_version": + wd.FwVersion = vp.PInt64() + case "identity": + wd.Identity = &value + case "nowayout": + wd.Nowayout = vp.PInt64() + case "state": + wd.State = &value + case "status": + wd.Status = &value + case "timeleft": + wd.Timeleft = vp.PInt64() + case "timeout": + wd.Timeout = vp.PInt64() + case "pretimeout": + wd.Pretimeout = vp.PInt64() + case "pretimeout_governor": + wd.PretimeoutGovernor = &value + case "access_cs0": + wd.AccessCs0 = vp.PInt64() + } + + if err := vp.Err(); err != nil { + return nil, err + } + } + + return &wd, nil +} diff --git a/sysfs/class_watchdog_test.go b/sysfs/class_watchdog_test.go new file mode 100644 index 00000000..ad9d63a8 --- /dev/null +++ b/sysfs/class_watchdog_test.go @@ -0,0 +1,76 @@ +// Copyright 2023 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build linux +// +build linux + +package sysfs + +import ( + "testing" + + "github.com/google/go-cmp/cmp" +) + +func TestWatchdogClass(t *testing.T) { + fs, err := NewFS(sysTestFixtures) + if err != nil { + t.Fatal(err) + } + + got, err := fs.WatchdogClass() + if err != nil { + t.Fatal(err) + } + + var ( + bootstatus int64 = 1 + fwVersion int64 = 2 + nowayout int64 + timeleft int64 = 300 + timeout int64 = 60 + pretimeout int64 = 120 + accessCs0 int64 + + options = "0x8380" + identity = "Software Watchdog" + state = "active" + status = "0x8000" + pretimeoutGovernor = "noop" + ) + + want := WatchdogClass{ + "watchdog0": { + Name: "watchdog0", + Bootstatus: &bootstatus, + Options: &options, + FwVersion: &fwVersion, + Identity: &identity, + Nowayout: &nowayout, + State: &state, + Status: &status, + Timeleft: &timeleft, + Timeout: &timeout, + Pretimeout: &pretimeout, + PretimeoutGovernor: &pretimeoutGovernor, + AccessCs0: &accessCs0, + }, + "watchdog1": { + Name: "watchdog1", + }, + } + + if diff := cmp.Diff(want, got); diff != "" { + t.Fatalf("unexpected watchdog class (-want +got):\n%s", diff) + } +} diff --git a/testdata/fixtures.ttar b/testdata/fixtures.ttar index b22807ac..ca2bac0c 100644 --- a/testdata/fixtures.ttar +++ b/testdata/fixtures.ttar @@ -6270,6 +6270,75 @@ Lines: 1 acpitz Mode: 664 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/class/watchdog +Mode: 775 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/class/watchdog/watchdog0 +Mode: 775 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/watchdog/watchdog0/access_cs0 +Lines: 1 +0EOF +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/watchdog/watchdog0/bootstatus +Lines: 1 +1EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/watchdog/watchdog0/fw_version +Lines: 1 +2EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/watchdog/watchdog0/identity +Lines: 1 +Software WatchdogEOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/watchdog/watchdog0/nowayout +Lines: 1 +0EOF +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/watchdog/watchdog0/options +Lines: 1 +0x8380EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/watchdog/watchdog0/pretimeout +Lines: 1 +120EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/watchdog/watchdog0/pretimeout_governor +Lines: 1 +noopEOF +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/watchdog/watchdog0/state +Lines: 1 +activeEOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/watchdog/watchdog0/status +Lines: 1 +0x8000EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/watchdog/watchdog0/timeleft +Lines: 1 +300EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/watchdog/watchdog0/timeout +Lines: 1 +60EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/class/watchdog/watchdog1 +Mode: 775 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/devices Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From 6d8714c62d4165d2352f73816b44cb325eaf4296 Mon Sep 17 00:00:00 2001 From: Felix Aronsson Date: Thu, 15 Feb 2024 11:52:50 +0100 Subject: [PATCH 26/32] Add support for for /proc/net/tls_stat kTLS stats (#579) Signed-off-by: Felix Aronsson --- net_tls_stat.go | 119 +++++++++++++++++++++++++++++++++++++++++ net_tls_stat_test.go | 48 +++++++++++++++++ testdata/fixtures.ttar | 16 ++++++ 3 files changed, 183 insertions(+) create mode 100644 net_tls_stat.go create mode 100644 net_tls_stat_test.go diff --git a/net_tls_stat.go b/net_tls_stat.go new file mode 100644 index 00000000..13994c17 --- /dev/null +++ b/net_tls_stat.go @@ -0,0 +1,119 @@ +// Copyright 2023 Prometheus Team +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package procfs + +import ( + "bufio" + "fmt" + "os" + "strconv" + "strings" +) + +// TLSStat struct represents data in /proc/net/tls_stat. +// See https://docs.kernel.org/networking/tls.html#statistics +type TLSStat struct { + // number of TX sessions currently installed where host handles cryptography + TLSCurrTxSw int + // number of RX sessions currently installed where host handles cryptography + TLSCurrRxSw int + // number of TX sessions currently installed where NIC handles cryptography + TLSCurrTxDevice int + // number of RX sessions currently installed where NIC handles cryptography + TLSCurrRxDevice int + //number of TX sessions opened with host cryptography + TLSTxSw int + //number of RX sessions opened with host cryptography + TLSRxSw int + // number of TX sessions opened with NIC cryptography + TLSTxDevice int + // number of RX sessions opened with NIC cryptography + TLSRxDevice int + // record decryption failed (e.g. due to incorrect authentication tag) + TLSDecryptError int + // number of RX resyncs sent to NICs handling cryptography + TLSRxDeviceResync int + // number of RX records which had to be re-decrypted due to TLS_RX_EXPECT_NO_PAD mis-prediction. Note that this counter will also increment for non-data records. + TLSDecryptRetry int + // number of data RX records which had to be re-decrypted due to TLS_RX_EXPECT_NO_PAD mis-prediction. + TLSRxNoPadViolation int +} + +// NewTLSStat reads the tls_stat statistics. +func NewTLSStat() (TLSStat, error) { + fs, err := NewFS(DefaultMountPoint) + if err != nil { + return TLSStat{}, err + } + + return fs.NewTLSStat() +} + +// NewTLSStat reads the tls_stat statistics. +func (fs FS) NewTLSStat() (TLSStat, error) { + file, err := os.Open(fs.proc.Path("net/tls_stat")) + if err != nil { + return TLSStat{}, err + } + defer file.Close() + + var ( + tlsstat = TLSStat{} + s = bufio.NewScanner(file) + ) + + for s.Scan() { + fields := strings.Fields(s.Text()) + + if len(fields) != 2 { + return TLSStat{}, fmt.Errorf("%w: %q line %q", ErrFileParse, file.Name(), s.Text()) + } + + name := fields[0] + value, err := strconv.Atoi(fields[1]) + if err != nil { + return TLSStat{}, err + } + + switch name { + case "TlsCurrTxSw": + tlsstat.TLSCurrTxSw = value + case "TlsCurrRxSw": + tlsstat.TLSCurrRxSw = value + case "TlsCurrTxDevice": + tlsstat.TLSCurrTxDevice = value + case "TlsCurrRxDevice": + tlsstat.TLSCurrRxDevice = value + case "TlsTxSw": + tlsstat.TLSTxSw = value + case "TlsRxSw": + tlsstat.TLSRxSw = value + case "TlsTxDevice": + tlsstat.TLSTxDevice = value + case "TlsRxDevice": + tlsstat.TLSRxDevice = value + case "TlsDecryptError": + tlsstat.TLSDecryptError = value + case "TlsRxDeviceResync": + tlsstat.TLSRxDeviceResync = value + case "TlsDecryptRetry": + tlsstat.TLSDecryptRetry = value + case "TlsRxNoPadViolation": + tlsstat.TLSRxNoPadViolation = value + } + + } + + return tlsstat, s.Err() +} diff --git a/net_tls_stat_test.go b/net_tls_stat_test.go new file mode 100644 index 00000000..8bc10e4d --- /dev/null +++ b/net_tls_stat_test.go @@ -0,0 +1,48 @@ +// Copyright 2023 Prometheus Team +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package procfs + +import ( + "testing" +) + +func TestTLSStat(t *testing.T) { + tlsStats, err := getProcFixtures(t).NewTLSStat() + if err != nil { + t.Fatal(err) + } + + for _, test := range []struct { + name string + want int + got int + }{ + {name: "TLSCurrTxSw", want: 5, got: tlsStats.TLSCurrTxSw}, + {name: "TLSCurrRxSw", want: 5, got: tlsStats.TLSCurrRxSw}, + {name: "TLSCurrTxDevice", want: 0, got: tlsStats.TLSCurrTxDevice}, + {name: "TLSCurrRxDevice", want: 0, got: tlsStats.TLSCurrRxDevice}, + {name: "TLSTxSw", want: 8711, got: tlsStats.TLSTxSw}, + {name: "TLSTxSw", want: 8711, got: tlsStats.TLSRxSw}, + {name: "TLSTxDevice", want: 0, got: tlsStats.TLSTxDevice}, + {name: "TLSRxDevice", want: 0, got: tlsStats.TLSRxDevice}, + {name: "TLSDecryptError", want: 13, got: tlsStats.TLSDecryptError}, + {name: "TLSRxDeviceResync", want: 0, got: tlsStats.TLSRxDeviceResync}, + {name: "TLSDecryptRetry", want: 0, got: tlsStats.TLSDecryptRetry}, + {name: "TLSRxNoPadViolation", want: 0, got: tlsStats.TLSRxNoPadViolation}, + } { + if test.want != test.got { + t.Errorf("Want %s %d, have %d", test.name, test.want, test.got) + } + } +} diff --git a/testdata/fixtures.ttar b/testdata/fixtures.ttar index ca2bac0c..3fdfc5b4 100644 --- a/testdata/fixtures.ttar +++ b/testdata/fixtures.ttar @@ -2528,6 +2528,22 @@ Lines: 3 6073: 000080FE00000000FFADE15609667CFE:C781 00000000000000000000000000000000:0000 07 00000000:00000000 00:00000000 00000000 1000 0 11337031 2 00000000b9256fdd 0 Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/proc/net/tls_stat +Lines: 12 +TlsCurrTxSw 5 +TlsCurrRxSw 5 +TlsCurrTxDevice 0 +TlsCurrRxDevice 0 +TlsTxSw 8711 +TlsRxSw 8711 +TlsTxDevice 0 +TlsRxDevice 0 +TlsDecryptError 13 +TlsRxDeviceResync 0 +TlsDecryptRetry 0 +TlsRxNoPadViolation 0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/proc/net/udp Lines: 4 sl local_address rem_address st tx_queue rx_queue tr tm->when retrnsmt uid timeout inode From 4b77c689c3fadb3fe84b6002066b1f17b3912a7c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 15 Feb 2024 11:56:49 +0100 Subject: [PATCH 27/32] Bump golang.org/x/sys from 0.16.0 to 0.17.0 (#606) Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.16.0 to 0.17.0. - [Commits](https://github.com/golang/sys/compare/v0.16.0...v0.17.0) --- updated-dependencies: - dependency-name: golang.org/x/sys dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 1e58b3a1..42402e75 100644 --- a/go.mod +++ b/go.mod @@ -5,5 +5,5 @@ go 1.19 require ( github.com/google/go-cmp v0.6.0 golang.org/x/sync v0.6.0 - golang.org/x/sys v0.16.0 + golang.org/x/sys v0.17.0 ) diff --git a/go.sum b/go.sum index caa1dc90..ef2a8705 100644 --- a/go.sum +++ b/go.sum @@ -2,5 +2,5 @@ github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= -golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= From da53333dbb0ff12c14bd457a3c4fd37dd15a3e38 Mon Sep 17 00:00:00 2001 From: PrometheusBot Date: Mon, 26 Feb 2024 19:30:52 +0100 Subject: [PATCH 28/32] Update common Prometheus files (#608) Signed-off-by: prombot --- .github/workflows/golangci-lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 8f252791..0e851572 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -28,7 +28,7 @@ jobs: - name: install Go uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 with: - go-version: 1.21.x + go-version: 1.22.x - name: Install snmp_exporter/generator dependencies run: sudo apt-get update && sudo apt-get -y install libsnmp-dev if: github.repository == 'prometheus/snmp_exporter' From 7b6ecccf385f16a7e139faad522566300e972def Mon Sep 17 00:00:00 2001 From: Ayoub Mrini Date: Tue, 5 Mar 2024 14:45:50 +0100 Subject: [PATCH 29/32] chore: class_fibrechannel: support optional attributes (#607) Signed-off-by: machine424 --- sysfs/class_fibrechannel.go | 5 ++ sysfs/class_fibrechannel_test.go | 20 ++++++++ testdata/fixtures.ttar | 81 ++++++++++++++++++++++++++++++++ 3 files changed, 106 insertions(+) diff --git a/sysfs/class_fibrechannel.go b/sysfs/class_fibrechannel.go index d7e62784..ded07a88 100644 --- a/sysfs/class_fibrechannel.go +++ b/sysfs/class_fibrechannel.go @@ -93,6 +93,11 @@ func (fs FS) parseFibreChannelHost(name string) (*FibreChannelHost, error) { name := filepath.Join(path, f) value, err := util.SysReadFile(name) if err != nil { + // drivers can choose not to expose some attributes to sysfs. + // See: https://github.com/prometheus/node_exporter/issues/2919. + if os.IsNotExist(err) { + continue + } return nil, fmt.Errorf("failed to read file %q: %w", name, err) } diff --git a/sysfs/class_fibrechannel_test.go b/sysfs/class_fibrechannel_test.go index 7181795c..55f728c2 100644 --- a/sysfs/class_fibrechannel_test.go +++ b/sysfs/class_fibrechannel_test.go @@ -64,6 +64,26 @@ func TestFibreChannelClass(t *testing.T) { FCPPacketAborts: 0x13, }, }, + "host1": FibreChannelHost{ + Name: "host1", + PortState: "Online", + Counters: FibreChannelCounters{ + DumpedFrames: 0, + ErrorFrames: ^uint64(0), + InvalidCRCCount: 0x20, + RXFrames: 0x30, + RXWords: 0x40, + TXFrames: 0x50, + TXWords: 0x60, + SecondsSinceLastReset: 0x70, + InvalidTXWordCount: 0x80, + LinkFailureCount: 0x90, + LossOfSyncCount: 0x100, + LossOfSignalCount: 0x110, + NosCount: 0x120, + FCPPacketAborts: 0x130, + }, + }, } if diff := cmp.Diff(want, got); diff != "" { diff --git a/testdata/fixtures.ttar b/testdata/fixtures.ttar index 3fdfc5b4..c5d9a6dc 100644 --- a/testdata/fixtures.ttar +++ b/testdata/fixtures.ttar @@ -5068,6 +5068,87 @@ Lines: 1 Emulex SN1100E2P FV12.4.270.3 DV12.4.0.0. HN:gotest. OS:Linux Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/class/fc_host/host1 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/fc_host/host1/port_state +Lines: 1 +Online +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/class/fc_host/host1/statistics +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/fc_host/host1/statistics/dumped_frames +Lines: 1 +0x0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/fc_host/host1/statistics/error_frames +Lines: 1 +0xffffffffffffffff +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/fc_host/host1/statistics/fcp_packet_aborts +Lines: 1 +0x130 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/fc_host/host1/statistics/invalid_crc_count +Lines: 1 +0x20 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/fc_host/host1/statistics/invalid_tx_word_count +Lines: 1 +0x80 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/fc_host/host1/statistics/link_failure_count +Lines: 1 +0x90 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/fc_host/host1/statistics/loss_of_signal_count +Lines: 1 +0x110 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/fc_host/host1/statistics/loss_of_sync_count +Lines: 1 +0x100 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/fc_host/host1/statistics/nos_count +Lines: 1 +0x120 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/fc_host/host1/statistics/rx_frames +Lines: 1 +0x30 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/fc_host/host1/statistics/rx_words +Lines: 1 +0x40 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/fc_host/host1/statistics/seconds_since_last_reset +Lines: 1 +0x70 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/fc_host/host1/statistics/tx_frames +Lines: 1 +0x50 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/fc_host/host1/statistics/tx_words +Lines: 1 +0x60 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/class/infiniband Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From 6ae6f9830249cd383a7427633cfa3bc22fed606f Mon Sep 17 00:00:00 2001 From: PrometheusBot Date: Tue, 5 Mar 2024 14:46:03 +0100 Subject: [PATCH 30/32] Update common Prometheus files (#609) Signed-off-by: prombot --- .github/workflows/golangci-lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 0e851572..4dc7b830 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -33,6 +33,6 @@ jobs: run: sudo apt-get update && sudo apt-get -y install libsnmp-dev if: github.repository == 'prometheus/snmp_exporter' - name: Lint - uses: golangci/golangci-lint-action@3a919529898de77ec3da873e3063ca4b10e7f5cc # v3.7.0 + uses: golangci/golangci-lint-action@3cfe3a4abbb849e10058ce4af15d205b6da42804 # v4.0.0 with: version: v1.55.2 From b5cb3d2bdedf0a9cd14a25c98230c327e1ca5a02 Mon Sep 17 00:00:00 2001 From: PrometheusBot Date: Thu, 7 Mar 2024 14:07:45 +0100 Subject: [PATCH 31/32] Update common Prometheus files (#610) Signed-off-by: prombot --- Makefile.common | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Makefile.common b/Makefile.common index 5fd17823..92558151 100644 --- a/Makefile.common +++ b/Makefile.common @@ -169,12 +169,16 @@ common-vet: common-lint: $(GOLANGCI_LINT) ifdef GOLANGCI_LINT @echo ">> running golangci-lint" -# 'go list' needs to be executed before staticcheck to prepopulate the modules cache. -# Otherwise staticcheck might fail randomly for some reason not yet explained. - $(GO) list -e -compiled -test=true -export=false -deps=true -find=false -tags= -- ./... > /dev/null $(GOLANGCI_LINT) run $(GOLANGCI_LINT_OPTS) $(pkgs) endif +.PHONY: common-lint-fix +common-lint-fix: $(GOLANGCI_LINT) +ifdef GOLANGCI_LINT + @echo ">> running golangci-lint fix" + $(GOLANGCI_LINT) run --fix $(GOLANGCI_LINT_OPTS) $(pkgs) +endif + .PHONY: common-yamllint common-yamllint: @echo ">> running yamllint on all YAML files in the repository" From 72170b511d6bb322d39a8437f3485a964605b7d1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 7 Mar 2024 14:18:08 +0100 Subject: [PATCH 32/32] Bump golang.org/x/sys from 0.17.0 to 0.18.0 (#611) Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.17.0 to 0.18.0. - [Commits](https://github.com/golang/sys/compare/v0.17.0...v0.18.0) --- updated-dependencies: - dependency-name: golang.org/x/sys dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 42402e75..02a379eb 100644 --- a/go.mod +++ b/go.mod @@ -5,5 +5,5 @@ go 1.19 require ( github.com/google/go-cmp v0.6.0 golang.org/x/sync v0.6.0 - golang.org/x/sys v0.17.0 + golang.org/x/sys v0.18.0 ) diff --git a/go.sum b/go.sum index ef2a8705..037f53a6 100644 --- a/go.sum +++ b/go.sum @@ -2,5 +2,5 @@ github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= -golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=