22 Commits

Author SHA1 Message Date
Tonis Tiigi
a8b83196f3 ci: update golangci to v2.8.0
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-01-13 22:09:20 -08:00
CrazyMax
d31230ea96 lint: gopls fixes
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2025-09-09 14:13:04 +02:00
Tonis Tiigi
69d3d44145 lint: add unconvert
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2025-05-02 12:44:01 -07:00
Marat Radchenko
0a5a80cfec Remove pre-Go 1.17 build tags
Signed-off-by: Marat Radchenko <marat@slonopotamus.org>
2024-11-21 10:58:27 +03:00
Tonis Tiigi
df0d9d791d ci: update golangci-lint to v1.60.1
Previous version runs out of memory on go1.23

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2024-08-14 16:29:22 +03:00
Tonis Tiigi
fc936ae3d7 lint: more testifylint fixes
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2024-06-10 21:16:51 -07:00
Tonis Tiigi
03c7a6d769 lint: fix some testifylint warnings
This does not cover all warning yet but split
into chunks to ease review.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2024-05-30 11:32:55 -07:00
Tonis Tiigi
265d18f2e6 lint: enable gocritic
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2024-05-15 16:44:38 -07:00
CrazyMax
c50447e340 move network sample to resources types
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-02-29 09:15:20 +01:00
CrazyMax
94e2370023 provenance: move types to a dedicated package
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-02-25 20:39:50 +01:00
CrazyMax
0074631e0e chore: use bklog instead of logrus
Co-authored-by: Justin Chadwell <me@jedevc.com>
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-09-05 12:01:22 +01:00
Erik Sipsma
fa11bf9e57 executor: fix resource sampler goroutine leak
Before this, the runc executor did not close the cgroupRecord when the
container exited non-zero, which resulted in goroutines leaking.

Signed-off-by: Erik Sipsma <erik@sipsma.dev>
2023-07-31 07:52:54 -07:00
Sebastiaan van Stijn
ce332e1952 executor/resource: stub out NewSysSampler on Windows
Commit 509cfa3916 introduced the SysSampler,
which measures resource consumption. However, for this it depends on
prometheus' procfs. That package does not have build-tags but is a Linux-only
implementation, which (by default) attempts to access `/proc`;
https://github.com/prometheus/procfs/blob/v0.9.0/fs.go#L26-L33
https://github.com/prometheus/procfs/blob/v0.9.0/internal/fs/fs.go#L23-L24

This patch splits the implementation of "resource" into platform-specific
files, and stubs out the NewSysSampler() on non-Linux platforms.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-20 14:28:53 +02:00
Alex Couture-Beil
86a740ff8c use sampler lock instead
Signed-off-by: Alex Couture-Beil <alex@earthly.dev>
2023-07-10 10:57:32 -07:00
Alex Couture-Beil
4f0a1f88e3 sampler data race fix
Protect against data race occuring while both sampler.Run and sub.Close
accesses the same data from multiple threads.

Signed-off-by: Alex Couture-Beil <alex@earthly.dev>
2023-07-10 09:14:49 -07:00
Tonis Tiigi
fca346fff8 allow ENOTSUP for PSI cgroup files
If kernel is configured with CONFIG_PSI_DEFAULT_DISABLED then PSI
files exist but are unreadable.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2023-07-06 22:49:39 -07:00
Tonis Tiigi
262b70801e resources: make maxsamples configurable
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2023-06-08 15:52:03 -07:00
Tonis Tiigi
509cfa3916 llbsolver: add systemusage samples to provenance attestation
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2023-06-08 15:52:02 -07:00
Tonis Tiigi
32dcdff1a0 resources: store sys cpu usage per step
This can be used to convert step usage to relative units.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2023-06-08 15:51:35 -07:00
Tonis Tiigi
6a2f92d08f resources: add sampler for periodic stat reads
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2023-06-08 15:51:35 -07:00
Tonis Tiigi
963f16179f resources: CNI network usage sampling support
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2023-06-08 15:51:35 -07:00
Tonis Tiigi
6e87e4b455 resources: add build step resource tracking via cgroups
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2023-06-08 15:51:31 -07:00