Repository: DataDog/datadog-agent
Pull request #36882: Fix race condition when running tests in disk check due to global variables
Author: login: jose-manuel-almaza
Labels: name: changelog/no-changelog
description: No changelog entry needed
name: qa/done
description: QA done before merge and regressions are covered by tests
name: long review
description: PR is complex, plan time to review it
name: team/agent-runtimes
Created: 2025-05-12T17:56:01Z | Merged: 2025-05-13T21:27:04Z

<!--
* Contributors are encouraged to read our [CONTRIBUTING](/CONTRIBUTING.md) documentation.
* Both Contributor and Reviewer Checklists are available at https://datadoghq.dev/datadog-agent/guidelines/contributing/#pull-requests.
* The pull request:
  * Should only fix one issue or add one feature at a time.
  * Must update the test suite for the relevant functionality.
  * Should pass all status checks before being reviewed or merged.
* Commit titles should be prefixed with general area of pull request's change.
* Please fill the below sections if possible with relevant information or links.
-->
### What does this PR do?
Eliminate several global variables and use the .WithX() pattern for non-deterministic methods to be mocked in our unit tests.
Dependency injection through the constructor is not possible in this case due to the impossibility of modifying the constructor, which is called in different places in our code, and would entail more changes.
We opted to apply this pattern instead of making the members to be mocked public to maintain the encapsulation of our code.
By default, the values ​​for these methods will be those used in production.
We also adjusted the clock increment to the default timeout (5s), which will trigger the timeout.

### Motivation
Fix a race condition in some tests, due to the use of shared global variables.

### Describe how you validated your changes
<!--
Validate your changes before merge, ensuring that:
* Your PR is tested by static / unit / integrations / e2e tests
* Your PR description details which e2e tests cover your changes, if any
* The PR description contains details of how you validated your changes. If you validated changes manually and not through automated tests, add context on why automated tests did not fit your changes validation.

If you want additional validation by a second person, you can ask reviewers to do it. Describe how to set up an environment for manual tests in the PR description. Manual validation is expected to happen on every commit before merge.

Any manual validation step should then map to an automated test. Manual validation should not substitute automation, minus exceptions not supported by test tooling yet.
-->

### Possible Drawbacks / Trade-offs

### Additional Notes
<!--
* Anything else we should know when reviewing?
* Include benchmarking information here whenever possible.
* Include info about alternatives that were considered and why the proposed
  version was chosen.
-->


Diff:
diff --git a/pkg/collector/corechecks/system/disk/diskv2/disk.go b/pkg/collector/corechecks/system/disk/diskv2/disk.go
index ed7522da6405..6b7cdd7da67d 100644
--- a/pkg/collector/corechecks/system/disk/diskv2/disk.go
+++ b/pkg/collector/corechecks/system/disk/diskv2/disk.go
@@ -34,15 +34,6 @@ const (
 	inodeMetric = "system.fs.inodes.%s"
 )
 
-var (
-	// DiskPartitions returns a list of mounted disk partitions using gopsutil.
-	DiskPartitions = gopsutil_disk.Partitions
-	// DiskUsage returns disk usage statistics for the given path using gopsutil.
-	DiskUsage = gopsutil_disk.Usage
-	// DiskIOCounters returns disk I/O statistics for the specified devices using gopsutil.
-	DiskIOCounters = gopsutil_disk.IOCounters
-)
-
 // diskInstanceConfig represents an instance configuration.
 type diskInitConfig struct {
 	DeviceGlobalExclude       []string `yaml:"device_global_exclude"`
@@ -119,7 +110,11 @@ func compileRegExp(expr string, ignoreCase bool) (*regexp.Regexp, error) {
 // Check represents the Disk check that will be periodically executed via the Run() function
 type Check struct {
 	core.CheckBase
-	clock               clock.Clock
+	clock          clock.Clock
+	diskPartitions func(bool) ([]gopsutil_disk.PartitionStat, error)
+	diskUsage      func(string) (*gopsutil_disk.UsageStat, error)
+	diskIOCounters func(...string) (map[string]gopsutil_disk.IOCountersStat, error)
+
 	initConfig          diskInitConfig
 	instanceConfig      diskInstanceConfig
 	includedDevices     []regexp.Regexp
@@ -384,7 +379,7 @@ func (c *Check) configureIncludeMountPoint() error {
 }
 
 func (c *Check) collectPartitionMetrics(sender sender.Sender) error {
-	partitions, err := DiskPartitions(c.instanceConfig.IncludeAllDevices)
+	partitions, err := c.diskPartitions(c.instanceConfig.IncludeAllDevices)
 	if err != nil {
 		log.Warnf("Unable to get disk partitions: %s", err)
 		return err
@@ -419,7 +414,7 @@ func (c *Check) collectPartitionMetrics(sender sender.Sender) error {
 }
 
 func (c *Check) collectDiskMetrics(sender sender.Sender) error {
-	iomap, err := DiskIOCounters()
+	iomap, err := c.diskIOCounters()
 	if err != nil {
 		log.Warnf("Unable to get disk iocounters: %s", err)
 		return err
@@ -466,13 +461,11 @@ func (c *Check) getDiskUsageWithTimeout(mountpoint string) (*gopsutil_disk.Usage
 	// Start the disk usage call in a separate goroutine.
 	go func() {
 		// UsageWithContext in gopsutil ignores the context for now (PR opened: https://github.com/shirou/gopsutil/pull/1837)
-		usage, err := DiskUsage(mountpoint)
+		usage, err := c.diskUsage(mountpoint)
 		// Use select to avoid writing to resultCh if timeout already occurred.
 		select {
 		case resultCh <- usageResult{usage, err}:
 		case <-timeoutCh:
-			// timeout occurred — avoid writing to resultCh
-			return
 		}
 	}()
 	// Use select to wait for either the disk usage result or a timeout.
@@ -645,21 +638,13 @@ func Factory() option.Option[func() check.Check] {
 	return option.New(newCheck)
 }
 
-// FactoryWithClock creates a new check factory with the clock dependency injection
-func FactoryWithClock(clock clock.Clock) option.Option[func() check.Check] {
-	return option.New(func() check.Check {
-		return newCheckWithClock(clock)
-	})
-}
-
 func newCheck() check.Check {
-	return newCheckWithClock(clock.New())
-}
-
-func newCheckWithClock(clock clock.Clock) check.Check {
 	return &Check{
-		CheckBase: core.NewCheckBase(CheckName),
-		clock:     clock,
+		CheckBase:      core.NewCheckBase(CheckName),
+		clock:          clock.New(),
+		diskPartitions: gopsutil_disk.Partitions,
+		diskUsage:      gopsutil_disk.Usage,
+		diskIOCounters: gopsutil_disk.IOCounters,
 		initConfig: diskInitConfig{
 			DeviceGlobalExclude:       []string{},
 			DeviceGlobalBlacklist:     []string{},
diff --git a/pkg/collector/corechecks/system/disk/diskv2/disk_nix_test.go b/pkg/collector/corechecks/system/disk/diskv2/disk_nix_test.go
index 462b25f0bc89..b2bba96bd336 100644
--- a/pkg/collector/corechecks/system/disk/diskv2/disk_nix_test.go
+++ b/pkg/collector/corechecks/system/disk/diskv2/disk_nix_test.go
@@ -56,7 +56,7 @@ func setupPlatformMocks() {
 
 func TestGivenADiskCheckWithDefaultConfig_WhenCheckRuns_ThenAllUsageMetricsAreReported(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 
@@ -80,16 +80,8 @@ func TestGivenADiskCheckWithDefaultConfig_WhenCheckRuns_ThenAllUsageMetricsAreRe
 
 func TestGivenADiskCheckWithLowercaseDeviceTagConfigured_WhenCheckRuns_ThenLowercaseDevicesAreReported(t *testing.T) {
 	setupDefaultMocks()
-	diskv2.DiskPartitions = func(_ bool) ([]gopsutil_disk.PartitionStat, error) {
-		return []gopsutil_disk.PartitionStat{
-			{
-				Device:     "/dev/SDA1",
-				Mountpoint: "/home",
-				Fstype:     "ext4",
-				Opts:       []string{"rw", "relatime"},
-			}}, nil
-	}
-	diskv2.DiskIOCounters = func(...string) (map[string]gopsutil_disk.IOCountersStat, error) {
+	diskCheck := createDiskCheck()
+	diskCheck = diskv2.WithDiskPartitions(diskv2.WithDiskIOCounters(diskCheck, func(...string) (map[string]gopsutil_disk.IOCountersStat, error) {
 		return map[string]gopsutil_disk.IOCountersStat{
 			"/dev/SDA1": {
 				Name:       "sda1",
@@ -110,8 +102,16 @@ func TestGivenADiskCheckWithLowercaseDeviceTagConfigured_WhenCheckRuns_ThenLower
 				WriteTime:  150,
 			},
 		}, nil
-	}
-	diskCheck := createCheck()
+	}), func(_ bool) ([]gopsutil_disk.PartitionStat, error) {
+		return []gopsutil_disk.PartitionStat{
+			{
+				Device:     "/dev/SDA1",
+				Mountpoint: "/home",
+				Fstype:     "ext4",
+				Opts:       []string{"rw", "relatime"},
+			}}, nil
+	})
+
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte("lowercase_device_tag: true"))
@@ -131,7 +131,7 @@ func TestGivenADiskCheckWithLowercaseDeviceTagConfigured_WhenCheckRuns_ThenLower
 
 func TestGivenADiskCheckWithIncludeAllDevicesTrueConfigured_WhenCheckRuns_ThenAllUsageMetricsAreReported(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte("include_all_devices: true"))
@@ -156,7 +156,7 @@ func TestGivenADiskCheckWithIncludeAllDevicesTrueConfigured_WhenCheckRuns_ThenAl
 
 func TestGivenADiskCheckWithIncludeAllDevicesFalseConfigured_WhenCheckRuns_ThenOnlyPhysicalDevicesUsageMetricsAreReported(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte("include_all_devices: false"))
@@ -181,7 +181,8 @@ func TestGivenADiskCheckWithIncludeAllDevicesFalseConfigured_WhenCheckRuns_ThenO
 
 func TestGivenADiskCheckWithDefaultConfig_WhenCheckRunsAndPartitionsSystemReturnsEmptyDevice_ThenNoUsageMetricsAreReportedForThatPartition(t *testing.T) {
 	setupDefaultMocks()
-	diskv2.DiskPartitions = func(_ bool) ([]gopsutil_disk.PartitionStat, error) {
+	diskCheck := createDiskCheck()
+	diskCheck = diskv2.WithDiskPartitions(diskCheck, func(_ bool) ([]gopsutil_disk.PartitionStat, error) {
 		return []gopsutil_disk.PartitionStat{
 			{
 				Device:     "",
@@ -195,8 +196,8 @@ func TestGivenADiskCheckWithDefaultConfig_WhenCheckRunsAndPartitionsSystemReturn
 				Fstype:     "ext4",
 				Opts:       []string{"rw", "relatime"},
 			}}, nil
-	}
-	diskCheck := createCheck()
+	})
+
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 
@@ -214,7 +215,8 @@ func TestGivenADiskCheckWithDefaultConfig_WhenCheckRunsAndPartitionsSystemReturn
 
 func TestGivenADiskCheckWithAllPartitionsFalseConfigured_WhenCheckRunsAndPartitionsSystemReturnsEmptyDevice_ThenNoUsageMetricsAreReportedForThatPartition(t *testing.T) {
 	setupDefaultMocks()
-	diskv2.DiskPartitions = func(_ bool) ([]gopsutil_disk.PartitionStat, error) {
+	diskCheck := createDiskCheck()
+	diskCheck = diskv2.WithDiskPartitions(diskCheck, func(_ bool) ([]gopsutil_disk.PartitionStat, error) {
 		return []gopsutil_disk.PartitionStat{
 			{
 				Device:     "",
@@ -228,8 +230,8 @@ func TestGivenADiskCheckWithAllPartitionsFalseConfigured_WhenCheckRunsAndPartiti
 				Fstype:     "ext4",
 				Opts:       []string{"rw", "relatime"},
 			}}, nil
-	}
-	diskCheck := createCheck()
+	})
+
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte("all_partitions: false"))
@@ -248,7 +250,8 @@ func TestGivenADiskCheckWithAllPartitionsFalseConfigured_WhenCheckRunsAndPartiti
 
 func TestGivenADiskCheckWithAllPartitionsTrueConfigured_WhenCheckRunsAndPartitionsSystemReturnsEmptyDevice_ThenUsageMetricsAreReportedForThatPartition(t *testing.T) {
 	setupDefaultMocks()
-	diskv2.DiskPartitions = func(_ bool) ([]gopsutil_disk.PartitionStat, error) {
+	diskCheck := createDiskCheck()
+	diskCheck = diskv2.WithDiskPartitions(diskCheck, func(_ bool) ([]gopsutil_disk.PartitionStat, error) {
 		return []gopsutil_disk.PartitionStat{
 			{
 				Device:     "",
@@ -262,8 +265,8 @@ func TestGivenADiskCheckWithAllPartitionsTrueConfigured_WhenCheckRunsAndPartitio
 				Fstype:     "ext4",
 				Opts:       []string{"rw", "relatime"},
 			}}, nil
-	}
-	diskCheck := createCheck()
+	})
+
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte("all_partitions: true"))
@@ -282,7 +285,7 @@ func TestGivenADiskCheckWithAllPartitionsTrueConfigured_WhenCheckRunsAndPartitio
 
 func TestGivenADiskCheckWithDeviceIncludeConfigured_WhenCheckRuns_ThenOnlyUsageMetricsForPartitionsWithThoseDevicesAreReported(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte(`
@@ -310,7 +313,7 @@ device_include:
 
 func TestGivenADiskCheckWithDeviceWhiteListConfigured_WhenCheckRuns_ThenOnlyUsageMetricsForPartitionsWithThoseDevicesAreReported(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte(`
@@ -338,7 +341,8 @@ device_whitelist:
 
 func TestGivenADiskCheckWithFileSystemGlobalExcludeNotConfigured_WhenCheckRuns_ThenUsageMetricsAreNotReportedForPartitionsWithIso9660FileSystems(t *testing.T) {
 	setupDefaultMocks()
-	diskv2.DiskPartitions = func(_ bool) ([]gopsutil_disk.PartitionStat, error) {
+	diskCheck := createDiskCheck()
+	diskCheck = diskv2.WithDiskPartitions(diskCheck, func(_ bool) ([]gopsutil_disk.PartitionStat, error) {
 		return []gopsutil_disk.PartitionStat{
 			{
 				Device:     "cdrom",
@@ -352,8 +356,7 @@ func TestGivenADiskCheckWithFileSystemGlobalExcludeNotConfigured_WhenCheckRuns_T
 				Fstype:     "ext4",
 				Opts:       []string{"rw", "relatime"},
 			}}, nil
-	}
-	diskCheck := createCheck()
+	})
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 
@@ -371,7 +374,8 @@ func TestGivenADiskCheckWithFileSystemGlobalExcludeNotConfigured_WhenCheckRuns_T
 
 func TestGivenADiskCheckWithFileSystemGlobalExcludeNotConfigured_WhenCheckRuns_ThenUsageMetricsAreNotReportedForPartitionsWithTracefsFileSystems(t *testing.T) {
 	setupDefaultMocks()
-	diskv2.DiskPartitions = func(_ bool) ([]gopsutil_disk.PartitionStat, error) {
+	diskCheck := createDiskCheck()
+	diskCheck = diskv2.WithDiskPartitions(diskCheck, func(_ bool) ([]gopsutil_disk.PartitionStat, error) {
 		return []gopsutil_disk.PartitionStat{
 			{
 				Device:     "trace",
@@ -385,8 +389,7 @@ func TestGivenADiskCheckWithFileSystemGlobalExcludeNotConfigured_WhenCheckRuns_T
 				Fstype:     "ext4",
 				Opts:       []string{"rw", "relatime"},
 			}}, nil
-	}
-	diskCheck := createCheck()
+	})
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 
@@ -404,7 +407,7 @@ func TestGivenADiskCheckWithFileSystemGlobalExcludeNotConfigured_WhenCheckRuns_T
 
 func TestGivenADiskCheckWithFileSystemGlobalExcludeConfigured_WhenCheckRuns_ThenUsageMetricsAreNotReportedForPartitionsWithThoseFileSystems(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	initConfig := integration.Data([]byte(`
@@ -432,7 +435,7 @@ file_system_global_exclude:
 
 func TestGivenADiskCheckWithFileSystemGlobalBlackListConfigured_WhenCheckRuns_ThenUsageMetricsAreNotReportedForPartitionsWithThoseFileSystems(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	initConfig := integration.Data([]byte(`
@@ -460,7 +463,7 @@ file_system_global_blacklist:
 
 func TestGivenADiskCheckWithExcludedFileSystemsConfigured_WhenCheckRuns_ThenUsageMetricsAreNotReportedForPartitionsWithThoseFileSystems(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte(`
@@ -480,7 +483,7 @@ excluded_filesystems:
 
 func TestGivenADiskCheckWithFileSystemExcludeConfigured_WhenCheckRuns_ThenUsageMetricsAreNotReportedForPartitionsWithThoseFileSystems(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte(`
@@ -500,7 +503,7 @@ file_system_exclude:
 
 func TestGivenADiskCheckWithFileSystemBlackListConfigured_WhenCheckRuns_ThenUsageMetricsAreNotReportedForPartitionsWithThoseFileSystems(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte(`
@@ -520,7 +523,7 @@ file_system_blacklist:
 
 func TestGivenADiskCheckWithFileSystemIncludeConfigured_WhenCheckRuns_ThenOnlyUsageMetricsForPartitionsWithThoseFileSystemsAreReported(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte(`
@@ -540,7 +543,7 @@ file_system_include:
 
 func TestGivenADiskCheckWithFileSystemWhiteListConfigured_WhenCheckRuns_ThenOnlyUsageMetricsForPartitionsWithThoseFileSystemsAreReported(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte(`
@@ -560,7 +563,7 @@ file_system_whitelist:
 
 func TestGivenADiskCheckWithDeviceTagReConfigured_WhenCheckRuns_ThenUsageMetricsAreReportedWithTheseTags(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte(`
@@ -589,7 +592,7 @@ device_tag_re:
 
 func TestGivenADiskCheckWithDefaultConfig_WhenCheckRuns_ThenAllIOCountersMetricsAreReported(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 
@@ -609,7 +612,7 @@ func TestGivenADiskCheckWithDefaultConfig_WhenCheckRuns_ThenAllIOCountersMetrics
 
 func TestGivenADiskCheckWithTagByLabelConfiguredFalse_WhenCheckRuns_ThenBlkidLabelsAreNotReportedAsTags(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte(`
@@ -630,7 +633,7 @@ tag_by_label: false
 
 func TestGivenADiskCheckWithDefaultConfig_WhenCheckRuns_ThenBlkidLabelsAreReportedAsTags(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 
@@ -648,7 +651,7 @@ func TestGivenADiskCheckWithDefaultConfig_WhenCheckRuns_ThenBlkidLabelsAreReport
 
 func TestGivenADiskCheckWithDefaultConfig_WhenCheckRuns_ThenEmptyBlkidLabelsAreNotReportedAsTags(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 
@@ -663,7 +666,7 @@ func TestGivenADiskCheckWithDefaultConfig_WhenCheckRuns_ThenEmptyBlkidLabelsAreN
 
 func TestGivenADiskCheckWithTagByLabelConfiguredTrue_WhenCheckRuns_ThenBlkidLabelsAreReportedAsTags(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte(`
@@ -687,7 +690,7 @@ func TestGivenADiskCheckWithTagByLabelConfiguredTrue_WhenCheckRunsAndBlkidReturn
 	diskv2.BlkidCommand = func() (string, error) {
 		return "", errors.New("error calling blkid")
 	}
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte(`
@@ -708,7 +711,7 @@ tag_by_label: true
 
 func TestGivenADiskCheckWithUseLsblkConfiguredTrue_WhenCheckRuns_ThenLsblkLabelsAreReportedAsTags(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte(`
@@ -729,7 +732,7 @@ use_lsblk: true
 
 func TestGivenADiskCheckWithTagByLabelConfiguredTrueAndUseLsblk_WhenCheckRuns_ThenLsblkLabelsAreNotReportedAsTags(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte(`
@@ -751,7 +754,7 @@ use_lsblk: true
 
 func TestGivenADiskCheckWithTagByLabelConfiguredFalseAndUseLsblk_WhenCheckRuns_ThenLsblkLabelsAreNotReportedAsTags(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte(`
@@ -776,7 +779,7 @@ func TestGivenADiskCheckWithUseLsblkConfiguredTrue_WhenLsblkReturnsError_ThenLsb
 	diskv2.LsblkCommand = func() (string, error) {
 		return "", errors.New("error calling lsblk")
 	}
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte(`
@@ -802,7 +805,7 @@ func TestGivenADiskCheckWithBlkidCacheFileConfigured_WhenCheckRuns_ThenBlkidCach
 		actualBlkidCacheFile = blkidCacheFile
 		return blkidCacheData, nil
 	}
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte(`
@@ -829,7 +832,7 @@ func TestGivenADiskCheckWithBlkidCacheFileConfigured_WhenBlkidCacheReturnsError_
 		actualBlkidCacheFile = blkidCacheFile
 		return "", errors.New("error calling blkid cache")
 	}
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte(`
@@ -862,7 +865,7 @@ func TestGivenADiskCheckWithBlkidCacheFileConfigured_WhenBlkidCacheHasWrongLines
 <device DEVNO="0x0812" LABEL="DATA_DISK" UUID="ijkl-mnop" TYPE="ntfs">/dev/sdb2</device>
 `), nil
 	}
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte(`
@@ -884,7 +887,7 @@ blkid_cache_file: /run/blkid/blkid.tab
 
 func TestGivenADiskCheckWithMountPointGlobalExcludeConfigured_WhenCheckRuns_ThenUsageMetricsAreNotReportedForPartitionsWithThoseMountPoints(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	initConfig := integration.Data([]byte(`
@@ -912,7 +915,7 @@ mount_point_global_exclude:
 
 func TestGivenADiskCheckWithMountPointGlobalBlackListConfigured_WhenCheckRuns_ThenUsageMetricsAreNotReportedForPartitionsWithThoseMountPoints(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	initConfig := integration.Data([]byte(`
@@ -940,7 +943,7 @@ mount_point_global_blacklist:
 
 func TestGivenADiskCheckWithMountPointExcludeConfigured_WhenCheckRuns_ThenUsageMetricsAreNotReportedForPartitionsWithThoseMountPoints(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte(`
@@ -968,7 +971,7 @@ mount_point_exclude:
 
 func TestGivenADiskCheckWithMountPointBlackListConfigured_WhenCheckRuns_ThenUsageMetricsAreNotReportedForPartitionsWithThoseMountPoints(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte(`
@@ -996,7 +999,7 @@ mount_point_blacklist:
 
 func TestGivenADiskCheckWithExcludedMountPointReConfigured_WhenCheckRuns_ThenUsageMetricsAreNotReportedForPartitionsWithThoseMountPoints(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte("excluded_mountpoint_re: /dev/.*"))
@@ -1021,7 +1024,7 @@ func TestGivenADiskCheckWithExcludedMountPointReConfigured_WhenCheckRuns_ThenUsa
 
 func TestGivenADiskCheckWithUseMountConfigured_WhenCheckRuns_ThenUsageMetricsAreReportedWithMountPointTags(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte("use_mount: true"))
@@ -1046,7 +1049,7 @@ func TestGivenADiskCheckWithUseMountConfigured_WhenCheckRuns_ThenUsageMetricsAre
 
 func TestGivenADiskCheckWithServiceCheckRwTrueConfigured_WhenCheckRuns_ThenReadWriteServiceCheckReported(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte(`
diff --git a/pkg/collector/corechecks/system/disk/diskv2/disk_test.go b/pkg/collector/corechecks/system/disk/diskv2/disk_test.go
index 1e3bd2798b66..73487cb330ce 100644
--- a/pkg/collector/corechecks/system/disk/diskv2/disk_test.go
+++ b/pkg/collector/corechecks/system/disk/diskv2/disk_test.go
@@ -154,25 +154,23 @@ var ioCountersData = map[string]gopsutil_disk.IOCountersStat{
 }
 
 func setupDefaultMocks() {
-	diskv2.DiskPartitions = func(all bool) ([]gopsutil_disk.PartitionStat, error) {
-		if all {
-			return partitionsTrue, nil
-		}
-		return partitionsFalse, nil
-	}
-	diskv2.DiskUsage = func(mountpoint string) (*gopsutil_disk.UsageStat, error) {
-		return usageData[mountpoint], nil
-	}
-	diskv2.DiskIOCounters = func(_names ...string) (map[string]gopsutil_disk.IOCountersStat, error) {
-		return ioCountersData, nil
-	}
 	setupPlatformMocks()
 }
 
-func createCheck() check.Check {
+func createDiskCheck() check.Check {
 	diskCheckOpt := diskv2.Factory()
 	diskCheckFunc, _ := diskCheckOpt.Get()
 	diskCheck := diskCheckFunc()
+	diskCheck = diskv2.WithDiskPartitions(diskv2.WithDiskUsage(diskv2.WithDiskIOCounters(diskCheck, func(...string) (map[string]gopsutil_disk.IOCountersStat, error) {
+		return ioCountersData, nil
+	}), func(mountpoint string) (*gopsutil_disk.UsageStat, error) {
+		return usageData[mountpoint], nil
+	}), func(all bool) ([]gopsutil_disk.PartitionStat, error) {
+		if all {
+			return partitionsTrue, nil
+		}
+		return partitionsFalse, nil
+	})
 	return diskCheck
 }
 
@@ -191,15 +189,8 @@ func (sc *signalClock) After(d time.Duration) <-chan time.Time {
 	return ch
 }
 
-func createCheckWithClock(clock clock.Clock) check.Check {
-	diskCheckOpt := diskv2.FactoryWithClock(clock)
-	diskCheckFunc, _ := diskCheckOpt.Get()
-	diskCheck := diskCheckFunc()
-	return diskCheck
-}
-
 func TestGivenADiskCheckWithDefaultConfig_WhenCheckIsConfigured_ThenErrorIsReturned(t *testing.T) {
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 
 	err := diskCheck.Configure(m.GetSenderManager(), integration.FakeConfigHash, []byte(`min_collection_interval: "string_value"`), nil, "test")
@@ -209,7 +200,7 @@ func TestGivenADiskCheckWithDefaultConfig_WhenCheckIsConfigured_ThenErrorIsRetur
 
 func TestGivenADiskCheckAndStoppedSender(t *testing.T) {
 	stoppedSenderError := errors.New("demultiplexer is stopped")
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 
 	diskCheck.Configure(m.GetSenderManager(), integration.FakeConfigHash, nil, nil, "test")
@@ -221,10 +212,10 @@ func TestGivenADiskCheckAndStoppedSender(t *testing.T) {
 
 func TestGivenADiskCheckWithDefaultConfig_WhenCheckRunsAndPartitionsSystemCallReturnsError_ThenErrorIsReturnedAndNoUsageMetricsAreReported(t *testing.T) {
 	setupDefaultMocks()
-	diskv2.DiskPartitions = func(_ bool) ([]gopsutil_disk.PartitionStat, error) {
+	diskCheck := createDiskCheck()
+	diskCheck = diskv2.WithDiskPartitions(diskCheck, func(_ bool) ([]gopsutil_disk.PartitionStat, error) {
 		return nil, errors.New("error calling disk.DiskPartitions")
-	}
-	diskCheck := createCheck()
+	})
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 
@@ -239,10 +230,10 @@ func TestGivenADiskCheckWithDefaultConfig_WhenCheckRunsAndPartitionsSystemCallRe
 
 func TestGivenADiskCheckWithDefaultConfig_WhenCheckRunsAndUsageSystemCallReturnsError_ThenNoUsageMetricsAreReported(t *testing.T) {
 	setupDefaultMocks()
-	diskv2.DiskUsage = func(_ string) (*gopsutil_disk.UsageStat, error) {
+	diskCheck := createDiskCheck()
+	diskCheck = diskv2.WithDiskUsage(diskCheck, func(_ string) (*gopsutil_disk.UsageStat, error) {
 		return nil, errors.New("error calling diskUsage")
-	}
-	diskCheck := createCheck()
+	})
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 
@@ -270,10 +261,10 @@ func TestGivenADiskCheckWithDefaultConfig_WhenCheckRunsAndUsageSystemCallReturns
 
 func TestGivenADiskCheckWithDefaultConfig_WhenCheckRunsAndIOCountersSystemCallReturnsError_ThenErrorIsReturnedAndNoUsageMetricsAreReported(t *testing.T) {
 	setupDefaultMocks()
-	diskv2.DiskIOCounters = func(...string) (map[string]gopsutil_disk.IOCountersStat, error) {
+	diskCheck := createDiskCheck()
+	diskCheck = diskv2.WithDiskIOCounters(diskCheck, func(...string) (map[string]gopsutil_disk.IOCountersStat, error) {
 		return nil, errors.New("error calling diskIOCounters")
-	}
-	diskCheck := createCheck()
+	})
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 
@@ -289,7 +280,7 @@ func TestGivenADiskCheckWithDefaultConfig_WhenCheckRunsAndIOCountersSystemCallRe
 
 func TestGivenADiskCheckWithFileSystemGlobalBlackListConfigured_WhenCheckIsConfigured_ThenWarningMessagedIsLogged(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	initConfig := integration.Data([]byte(`
@@ -310,7 +301,7 @@ file_system_global_blacklist:
 
 func TestGivenADiskCheckWithDeviceGlobalBlackListConfigured_WhenCheckIsConfigured_ThenWarningMessagedIsLogged(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	initConfig := integration.Data([]byte(`
@@ -331,7 +322,7 @@ device_global_blacklist:
 
 func TestGivenADiskCheckWithMountpointGlobalBlackListConfigured_WhenCheckIsConfigured_ThenWarningMessagedIsLogged(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	initConfig := integration.Data([]byte(`
@@ -352,7 +343,7 @@ mount_point_global_blacklist:
 
 func TestGivenADiskCheckWithFileSystemWhiteListConfigured_WhenCheckIsConfigured_ThenWarningMessagedIsLogged(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte(`
@@ -373,7 +364,7 @@ file_system_whitelist:
 
 func TestGivenADiskCheckWithFileSystemBlackListConfigured_WhenCheckIsConfigured_ThenWarningMessagedIsLogged(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte(`
@@ -394,7 +385,7 @@ file_system_blacklist:
 
 func TestGivenADiskCheckWithDeviceWhiteListConfigured_WhenCheckIsConfigured_ThenWarningMessagedIsLogged(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte(`
@@ -415,7 +406,7 @@ device_whitelist:
 
 func TestGivenADiskCheckWithDeviceBlackListConfigured_WhenCheckIsConfigured_ThenWarningMessagedIsLogged(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte(`
@@ -436,7 +427,7 @@ device_blacklist:
 
 func TestGivenADiskCheckWithMountPointWhiteListConfigured_WhenCheckIsConfigured_ThenWarningMessagedIsLogged(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte(`
@@ -457,7 +448,7 @@ mount_point_whitelist:
 
 func TestGivenADiskCheckWithMountPointBlackListConfigured_WhenCheckIsConfigured_ThenWarningMessagedIsLogged(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte(`
@@ -478,7 +469,7 @@ mount_point_blacklist:
 
 func TestGivenADiskCheckWithExcludedMountPointReConfigured_WhenCheckIsConfigured_ThenWarningMessagedIsLogged(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte(`
@@ -499,7 +490,7 @@ excluded_mountpoint_re:
 
 func TestGivenADiskCheckWithExcludedFileSystemsConfigured_WhenCheckIsConfigured_ThenWarningMessagedIsLogged(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte(`
@@ -520,7 +511,7 @@ excluded_filesystems:
 
 func TestGivenADiskCheckWithExcludedDisksConfigured_WhenCheckIsConfigured_ThenWarningMessagedIsLogged(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte(`
@@ -541,7 +532,7 @@ excluded_disks:
 
 func TestGivenADiskCheckWithExcludedDisksReConfigured_WhenCheckIsConfigured_ThenWarningMessagedIsLogged(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte(`
@@ -562,7 +553,7 @@ excluded_disk_re:
 
 func TestGivenADiskCheckWithDeviceGlobalExcludeAndDeviceExcludeConfigured_WhenCheckRuns_ThenUsageMetricsAreNotReportedForPartitionsWithThoseDevices(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	initConfig := integration.Data([]byte(`
@@ -594,7 +585,7 @@ device_exclude:
 
 func TestGivenADiskCheckWithDeviceGlobalBlackListAndDeviceExcludeConfigured_WhenCheckRuns_ThenUsageMetricsAreNotReportedForPartitionsWithThoseDevices(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	initConfig := integration.Data([]byte(`
@@ -626,7 +617,7 @@ device_exclude:
 
 func TestGivenADiskCheckWithDeviceGlobalExcludeIncorrectlyConfigured_WhenCheckIsConfigured_ThenErrorIsReturned(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	initConfig := integration.Data([]byte(`
@@ -641,7 +632,7 @@ device_global_exclude:
 
 func TestGivenADiskCheckWithDeviceExcludeConfigured_WhenCheckRuns_ThenUsageMetricsAreNotReportedForPartitionsWithThoseDevices(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte(`
@@ -669,7 +660,7 @@ device_exclude:
 
 func TestGivenADiskCheckWithDeviceBlackListConfigured_WhenCheckRuns_ThenUsageMetricsAreNotReportedForPartitionsWithThoseDevices(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte(`
@@ -697,7 +688,7 @@ device_blacklist:
 
 func TestGivenADiskCheckWithExcludedDisksConfigured_WhenCheckRuns_ThenUsageMetricsAreNotReportedForPartitionsWithThoseDevices(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte(`
@@ -725,7 +716,7 @@ excluded_disks:
 
 func TestGivenADiskCheckWithDeviceExcludeIncorrectlyConfigured_WhenCheckIsConfigured_ThenErrorIsReturned(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte(`
@@ -740,7 +731,7 @@ device_exclude:
 
 func TestGivenADiskCheckWithExcludedDiskReConfigured_WhenCheckRuns_ThenUsageMetricsAreNotReportedForPartitionsWithThoseDevices(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte("excluded_disk_re: /dev/sda.*"))
@@ -765,7 +756,7 @@ func TestGivenADiskCheckWithExcludedDiskReConfigured_WhenCheckRuns_ThenUsageMetr
 
 func TestGivenADiskCheckWithExcludedDiskReIncorrectlyConfigured_WhenCheckIsConfigured_ThenErrorIsReturned(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte("excluded_disk_re: /dev/sda(.*"))
@@ -777,7 +768,7 @@ func TestGivenADiskCheckWithExcludedDiskReIncorrectlyConfigured_WhenCheckIsConfi
 
 func TestGivenADiskCheckWithDeviceIncludeIncorrectlyConfigured_WhenCheckIsConfigured_ThenErrorIsReturned(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte(`
@@ -792,7 +783,7 @@ device_include:
 
 func TestGivenADiskCheckWithFileSystemGlobalExcludeIncorrectlyConfigured_WhenCheckIsConfigured_ThenErrorIsReturned(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	initConfig := integration.Data([]byte(`
@@ -807,7 +798,7 @@ file_system_global_exclude:
 
 func TestGivenADiskCheckWithFileSystemExcludeIncorrectlyConfigured_WhenCheckIsConfigured_ThenErrorIsReturned(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte(`
@@ -822,7 +813,7 @@ file_system_exclude:
 
 func TestGivenADiskCheckWithFileSystemIncludeIncorrectlyConfigured_WhenCheckIsConfigured_ThenErrorIsReturned(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte(`
@@ -837,7 +828,21 @@ file_system_include:
 
 func TestGivenADiskCheckWithMountPointGlobalExcludeNotConfigured_WhenCheckRuns_ThenUsageMetricsAreNotReportedForPartitionsWithBinfmt_miscMountPoints(t *testing.T) {
 	setupDefaultMocks()
-	diskv2.DiskPartitions = func(_ bool) ([]gopsutil_disk.PartitionStat, error) {
+	diskCheck := createDiskCheck()
+	diskCheck = diskv2.WithDiskPartitions(diskv2.WithDiskUsage(diskCheck, func(_ string) (*gopsutil_disk.UsageStat, error) {
+		return &gopsutil_disk.UsageStat{
+			Path:              "/host/proc/sys/fs/binfmt_misc",
+			Fstype:            "ext4",
+			Total:             100000000000, // 100 GB
+			Free:              30000000000,  // 30 GB
+			Used:              70000000000,  // 70 GB
+			UsedPercent:       70.0,
+			InodesTotal:       1000000,
+			InodesUsed:        500000,
+			InodesFree:        500000,
+			InodesUsedPercent: 50.0,
+		}, nil
+	}), func(_ bool) ([]gopsutil_disk.PartitionStat, error) {
 		return []gopsutil_disk.PartitionStat{
 			{
 				Device:     "first",
@@ -851,22 +856,7 @@ func TestGivenADiskCheckWithMountPointGlobalExcludeNotConfigured_WhenCheckRuns_T
 				Fstype:     "ext4",
 				Opts:       []string{"rw", "relatime"},
 			}}, nil
-	}
-	diskv2.DiskUsage = func(_ string) (*gopsutil_disk.UsageStat, error) {
-		return &gopsutil_disk.UsageStat{
-			Path:              "/host/proc/sys/fs/binfmt_misc",
-			Fstype:            "ext4",
-			Total:             100000000000, // 100 GB
-			Free:              30000000000,  // 30 GB
-			Used:              70000000000,  // 70 GB
-			UsedPercent:       70.0,
-			InodesTotal:       1000000,
-			InodesUsed:        500000,
-			InodesFree:        500000,
-			InodesUsedPercent: 50.0,
-		}, nil
-	}
-	diskCheck := createCheck()
+	})
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 
@@ -884,7 +874,7 @@ func TestGivenADiskCheckWithMountPointGlobalExcludeNotConfigured_WhenCheckRuns_T
 
 func TestGivenADiskCheckWithMountPointGlobalExcludeIncorrectlyConfigured_WhenCheckIsConfigured_ThenErrorIsReturned(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	initConfig := integration.Data([]byte(`
@@ -899,7 +889,7 @@ mount_point_global_exclude:
 
 func TestGivenADiskCheckWithMountPointExcludeIncorrectlyConfigured_WhenCheckIsConfigured_ThenErrorIsReturned(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte(`
@@ -914,7 +904,7 @@ mount_point_exclude:
 
 func TestGivenADiskCheckWithExcludedMountPointReIncorrectlyConfigured_WhenCheckIsConfigured_ThenErrorIsReturned(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte("excluded_mountpoint_re: /dev/(.*"))
@@ -926,7 +916,7 @@ func TestGivenADiskCheckWithExcludedMountPointReIncorrectlyConfigured_WhenCheckI
 
 func TestGivenADiskCheckWithMountPointIncludeConfigured_WhenCheckRuns_ThenOnlyUsageMetricsForPartitionsWithThoseMountPointsAreReported(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte(`
@@ -954,7 +944,7 @@ mount_point_include:
 
 func TestGivenADiskCheckWithMountPointWhiteListConfigured_WhenCheckRuns_ThenOnlyUsageMetricsForPartitionsWithThoseMountPointsAreReported(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte(`
@@ -982,7 +972,7 @@ mount_point_whitelist:
 
 func TestGivenADiskCheckWithMountPointIncludeIncorrectlyConfigured_WhenCheckIsConfigured_ThenErrorIsReturned(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte(`
@@ -997,19 +987,8 @@ mount_point_include:
 
 func TestGivenADiskCheckWithDefaultConfig_WhenCheckRunsAndUsageSystemCallReturnsAPartitionWithZeroTotal_ThenNoUsageMetricsAreReportedForThatPartition(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
-	m := mocksender.NewMockSender(diskCheck.ID())
-	m.SetupAcceptAll()
-	diskv2.DiskPartitions = func(_ bool) ([]gopsutil_disk.PartitionStat, error) {
-		return []gopsutil_disk.PartitionStat{
-			{
-				Device:     "shm",
-				Mountpoint: "/dev/shm",
-				Fstype:     "tmpfs",
-				Opts:       []string{"rw", "nosuid", "nodev"},
-			}}, nil
-	}
-	diskv2.DiskUsage = func(_ string) (*gopsutil_disk.UsageStat, error) {
+	diskCheck := createDiskCheck()
+	diskCheck = diskv2.WithDiskPartitions(diskv2.WithDiskUsage(diskCheck, func(_ string) (*gopsutil_disk.UsageStat, error) {
 		return &gopsutil_disk.UsageStat{
 			Path:              "/dev/shm",
 			Fstype:            "tmpfs",
@@ -1022,7 +1001,17 @@ func TestGivenADiskCheckWithDefaultConfig_WhenCheckRunsAndUsageSystemCallReturns
 			InodesFree:        0,
 			InodesUsedPercent: 0,
 		}, nil
-	}
+	}), func(_ bool) ([]gopsutil_disk.PartitionStat, error) {
+		return []gopsutil_disk.PartitionStat{
+			{
+				Device:     "shm",
+				Mountpoint: "/dev/shm",
+				Fstype:     "tmpfs",
+				Opts:       []string{"rw", "nosuid", "nodev"},
+			}}, nil
+	})
+	m := mocksender.NewMockSender(diskCheck.ID())
+	m.SetupAcceptAll()
 
 	diskCheck.Configure(m.GetSenderManager(), integration.FakeConfigHash, nil, nil, "test")
 	err := diskCheck.Run()
@@ -1033,19 +1022,8 @@ func TestGivenADiskCheckWithDefaultConfig_WhenCheckRunsAndUsageSystemCallReturns
 
 func TestGivenADiskCheckWithMinDiskSizeConfiguredTo1MiBConfig_WhenCheckRunsAndUsageSystemCallReturnsAPartitionWith1024Total_ThenNoUsageMetricsAreReportedForThatPartition(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
-	m := mocksender.NewMockSender(diskCheck.ID())
-	m.SetupAcceptAll()
-	diskv2.DiskPartitions = func(_ bool) ([]gopsutil_disk.PartitionStat, error) {
-		return []gopsutil_disk.PartitionStat{
-			{
-				Device:     "shm",
-				Mountpoint: "/dev/shm",
-				Fstype:     "tmpfs",
-				Opts:       []string{"rw", "nosuid", "nodev"},
-			}}, nil
-	}
-	diskv2.DiskUsage = func(_ string) (*gopsutil_disk.UsageStat, error) {
+	diskCheck := createDiskCheck()
+	diskCheck = diskv2.WithDiskPartitions(diskv2.WithDiskUsage(diskCheck, func(_ string) (*gopsutil_disk.UsageStat, error) {
 		return &gopsutil_disk.UsageStat{
 			Path:              "/dev/shm",
 			Fstype:            "tmpfs",
@@ -1058,7 +1036,18 @@ func TestGivenADiskCheckWithMinDiskSizeConfiguredTo1MiBConfig_WhenCheckRunsAndUs
 			InodesFree:        0,
 			InodesUsedPercent: 0,
 		}, nil
-	}
+	}), func(_ bool) ([]gopsutil_disk.PartitionStat, error) {
+		return []gopsutil_disk.PartitionStat{
+			{
+				Device:     "shm",
+				Mountpoint: "/dev/shm",
+				Fstype:     "tmpfs",
+				Opts:       []string{"rw", "nosuid", "nodev"},
+			}}, nil
+	})
+
+	m := mocksender.NewMockSender(diskCheck.ID())
+	m.SetupAcceptAll()
 	config := integration.Data([]byte(`min_disk_size: 1`))
 	var b bytes.Buffer
 	w := bufio.NewWriter(&b)
@@ -1078,19 +1067,8 @@ func TestGivenADiskCheckWithMinDiskSizeConfiguredTo1MiBConfig_WhenCheckRunsAndUs
 
 func TestGivenADiskCheckWithMinDiskSizeConfiguredTo1MiBConfig_WhenCheckRunsAndUsageSystemCallReturnsAPartitionWith1048576Total_ThenUsageMetricsAreReportedForThatPartition(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
-	m := mocksender.NewMockSender(diskCheck.ID())
-	m.SetupAcceptAll()
-	diskv2.DiskPartitions = func(_ bool) ([]gopsutil_disk.PartitionStat, error) {
-		return []gopsutil_disk.PartitionStat{
-			{
-				Device:     "shm",
-				Mountpoint: "/dev/shm",
-				Fstype:     "tmpfs",
-				Opts:       []string{"rw", "nosuid", "nodev"},
-			}}, nil
-	}
-	diskv2.DiskUsage = func(_ string) (*gopsutil_disk.UsageStat, error) {
+	diskCheck := createDiskCheck()
+	diskCheck = diskv2.WithDiskPartitions(diskv2.WithDiskUsage(diskCheck, func(_ string) (*gopsutil_disk.UsageStat, error) {
 		return &gopsutil_disk.UsageStat{
 			Path:              "/dev/shm",
 			Fstype:            "tmpfs",
@@ -1103,7 +1081,18 @@ func TestGivenADiskCheckWithMinDiskSizeConfiguredTo1MiBConfig_WhenCheckRunsAndUs
 			InodesFree:        0,
 			InodesUsedPercent: 0,
 		}, nil
-	}
+	}), func(_ bool) ([]gopsutil_disk.PartitionStat, error) {
+		return []gopsutil_disk.PartitionStat{
+			{
+				Device:     "shm",
+				Mountpoint: "/dev/shm",
+				Fstype:     "tmpfs",
+				Opts:       []string{"rw", "nosuid", "nodev"},
+			}}, nil
+	})
+
+	m := mocksender.NewMockSender(diskCheck.ID())
+	m.SetupAcceptAll()
 	config := integration.Data([]byte(`min_disk_size: 1`))
 
 	diskCheck.Configure(m.GetSenderManager(), integration.FakeConfigHash, config, nil, "test")
@@ -1115,7 +1104,7 @@ func TestGivenADiskCheckWithMinDiskSizeConfiguredTo1MiBConfig_WhenCheckRunsAndUs
 
 func TestGivenADiskCheckWithDefaultConfig_WhenCheckRuns_ThenUsageMetricsAreNotReportedWithFileSystemTags(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 
@@ -1139,7 +1128,7 @@ func TestGivenADiskCheckWithDefaultConfig_WhenCheckRuns_ThenUsageMetricsAreNotRe
 
 func TestGivenADiskCheckWithTagByFileSystemFalseConfigured_WhenCheckRuns_ThenUsageMetricsAreNotReportedWithFileSystemTags(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte("tag_by_filesystem: false"))
@@ -1164,7 +1153,7 @@ func TestGivenADiskCheckWithTagByFileSystemFalseConfigured_WhenCheckRuns_ThenUsa
 
 func TestGivenADiskCheckWithTagByFileSystemTrueConfigured_WhenCheckRuns_ThenUsageMetricsAreReportedWithFileSystemTags(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte("tag_by_filesystem: true"))
@@ -1189,7 +1178,7 @@ func TestGivenADiskCheckWithTagByFileSystemTrueConfigured_WhenCheckRuns_ThenUsag
 
 func TestGivenADiskCheckWithDefaultConfig_WhenCheckRuns_ThenUsageMetricsAreNotReportedWithMountPointTags(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 
@@ -1213,7 +1202,7 @@ func TestGivenADiskCheckWithDefaultConfig_WhenCheckRuns_ThenUsageMetricsAreNotRe
 
 func TestGivenADiskCheckWithDeviceTagReIncorrectlyConfigured_WhenCheckIsConfigured_ThenErrorIsReturned(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte(`
@@ -1229,7 +1218,7 @@ device_tag_re:
 
 func TestGivenADiskCheckWithUseLsblkAndBlkidCacheFileConfigured_WhenCheckIsConfigured_ThenErrorIsReturned(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte(`
@@ -1245,7 +1234,7 @@ blkid_cache_file: /run/blkid/blkid.tab
 
 func TestGivenADiskCheckWithDefaultConfig_WhenCheckRuns_ThenReadWriteServiceCheckNotReported(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 
@@ -1258,7 +1247,7 @@ func TestGivenADiskCheckWithDefaultConfig_WhenCheckRuns_ThenReadWriteServiceChec
 
 func TestGivenADiskCheckWithServiceCheckRwFalseConfigured_WhenCheckRuns_ThenReadWriteServiceCheckNotReported(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createDiskCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte(`
@@ -1274,16 +1263,15 @@ service_check_rw: false
 
 func TestGivenADiskCheckWithDefaultConfig_WhenUsagePartitionTimeout_ThenUsageMetricsNotReported(t *testing.T) {
 	setupDefaultMocks()
-	diskv2.DiskPartitions = func(_ bool) ([]gopsutil_disk.PartitionStat, error) {
-		return []gopsutil_disk.PartitionStat{
-			{
-				Device:     "shm",
-				Mountpoint: "/dev/shm",
-				Fstype:     "tmpfs",
-				Opts:       []string{"rw", "nosuid", "nodev"},
-			}}, nil
+	mockClock := clock.NewMock()
+	afterCalled := make(chan time.Time, 1)
+	// Wrap your mockClock with the signaling clock
+	testClock := &signalClock{
+		Clock:       mockClock,
+		afterCalled: afterCalled,
 	}
-	diskv2.DiskUsage = func(_ string) (*gopsutil_disk.UsageStat, error) {
+	diskCheck := createDiskCheck()
+	diskCheck = diskv2.WithClock(diskv2.WithDiskPartitions(diskv2.WithDiskUsage(diskCheck, func(_ string) (*gopsutil_disk.UsageStat, error) {
 		// Sleep 10s (longer than default timeout)
 		time.Sleep(10 * time.Second)
 		return &gopsutil_disk.UsageStat{
@@ -1298,15 +1286,16 @@ func TestGivenADiskCheckWithDefaultConfig_WhenUsagePartitionTimeout_ThenUsageMet
 			InodesFree:        0,
 			InodesUsedPercent: 0,
 		}, nil
-	}
-	mockClock := clock.NewMock()
-	afterCalled := make(chan time.Time, 1)
-	// Wrap your mockClock with the signaling clock
-	testClock := &signalClock{
-		Clock:       mockClock,
-		afterCalled: afterCalled,
-	}
-	diskCheck := createCheckWithClock(testClock)
+	}), func(_ bool) ([]gopsutil_disk.PartitionStat, error) {
+		return []gopsutil_disk.PartitionStat{
+			{
+				Device:     "shm",
+				Mountpoint: "/dev/shm",
+				Fstype:     "tmpfs",
+				Opts:       []string{"rw", "nosuid", "nodev"},
+			}}, nil
+	}), testClock)
+
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 
@@ -1318,7 +1307,7 @@ func TestGivenADiskCheckWithDefaultConfig_WhenUsagePartitionTimeout_ThenUsageMet
 	// Explicitly wait until diskCheck.Run calls mockClock.After()
 	<-afterCalled
 	// Move the clock forward longer than default timeout (5s)
-	mockClock.Add(10 * time.Second)
+	mockClock.Add(5 * time.Second)
 	err := <-done
 
 	assert.Nil(t, err)
diff --git a/pkg/collector/corechecks/system/disk/diskv2/disk_windows_test.go b/pkg/collector/corechecks/system/disk/diskv2/disk_windows_test.go
index 40b83ac8a0df..6602a476c477 100644
--- a/pkg/collector/corechecks/system/disk/diskv2/disk_windows_test.go
+++ b/pkg/collector/corechecks/system/disk/diskv2/disk_windows_test.go
@@ -15,6 +15,7 @@ import (
 
 	"github.com/DataDog/datadog-agent/comp/core/autodiscovery/integration"
 	"github.com/DataDog/datadog-agent/pkg/aggregator/mocksender"
+	"github.com/DataDog/datadog-agent/pkg/collector/check"
 	"github.com/DataDog/datadog-agent/pkg/collector/corechecks/system/disk/diskv2"
 	"github.com/DataDog/datadog-agent/pkg/metrics/servicecheck"
 	"github.com/DataDog/datadog-agent/pkg/util/log"
@@ -29,18 +30,23 @@ func setupPlatformMocks() {
 	}
 }
 
-func TestGivenADiskCheckWithDefaultConfig_WhenCheckRuns_ThenAllUsageMetricsAreReported(t *testing.T) {
-	setupDefaultMocks()
-	diskv2.DiskPartitions = func(_ bool) ([]gopsutil_disk.PartitionStat, error) {
-		return []gopsutil_disk.PartitionStat{
-			{
-				Device:     "\\\\?\\Volume{a1b2c3d4-e5f6-7890-abcd-ef1234567890}\\",
-				Mountpoint: "D:\\",
-				Fstype:     "NTFS",
-				Opts:       []string{"rw", "relatime"},
-			}}, nil
-	}
-	diskv2.DiskUsage = func(_ string) (*gopsutil_disk.UsageStat, error) {
+func createWindowsCheck() check.Check {
+	diskCheckOpt := diskv2.Factory()
+	diskCheckFunc, _ := diskCheckOpt.Get()
+	diskCheck := diskCheckFunc()
+	diskCheck = diskv2.WithDiskPartitions(diskv2.WithDiskUsage(diskv2.WithDiskIOCounters(diskCheck, func(...string) (map[string]gopsutil_disk.IOCountersStat, error) {
+		return map[string]gopsutil_disk.IOCountersStat{
+			"\\\\?\\Volume{a1b2c3d4-e5f6-7890-abcd-ef1234567890}\\": {
+				Name:       "sda1",
+				ReadCount:  100,
+				WriteCount: 200,
+				ReadBytes:  1048576,
+				WriteBytes: 2097152,
+				ReadTime:   300,
+				WriteTime:  450,
+			},
+		}, nil
+	}), func(_ string) (*gopsutil_disk.UsageStat, error) {
 		return &gopsutil_disk.UsageStat{
 			Path:              "D:\\",
 			Fstype:            "NTFS",
@@ -53,8 +59,21 @@ func TestGivenADiskCheckWithDefaultConfig_WhenCheckRuns_ThenAllUsageMetricsAreRe
 			InodesFree:        500000,
 			InodesUsedPercent: 50.0,
 		}, nil
-	}
-	diskCheck := createCheck()
+	}), func(_ bool) ([]gopsutil_disk.PartitionStat, error) {
+		return []gopsutil_disk.PartitionStat{
+			{
+				Device:     `\\?\Volume{a1b2c3d4-e5f6-7890-abcd-ef1234567890}\`,
+				Mountpoint: "D:\\",
+				Fstype:     "NTFS",
+				Opts:       []string{"rw", "relatime"},
+			}}, nil
+	})
+	return diskCheck
+}
+
+func TestGivenADiskCheckWithDefaultConfig_WhenCheckRuns_ThenAllUsageMetricsAreReported(t *testing.T) {
+	setupDefaultMocks()
+	diskCheck := createWindowsCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 
@@ -69,43 +88,7 @@ func TestGivenADiskCheckWithDefaultConfig_WhenCheckRuns_ThenAllUsageMetricsAreRe
 
 func TestGivenADiskCheckWithLowercaseDeviceTagConfigured_WhenCheckRuns_ThenLowercaseDevicesAreReported(t *testing.T) {
 	setupDefaultMocks()
-	diskv2.DiskPartitions = func(_ bool) ([]gopsutil_disk.PartitionStat, error) {
-		return []gopsutil_disk.PartitionStat{
-			{
-				Device:     "\\\\?\\Volume{a1b2c3d4-e5f6-7890-abcd-ef1234567890}\\",
-				Mountpoint: "D:\\",
-				Fstype:     "NTFS",
-				Opts:       []string{"rw", "relatime"},
-			}}, nil
-	}
-	diskv2.DiskUsage = func(_ string) (*gopsutil_disk.UsageStat, error) {
-		return &gopsutil_disk.UsageStat{
-			Path:              "D:\\",
-			Fstype:            "NTFS",
-			Total:             100000000000, // 100 GB
-			Free:              30000000000,  // 30 GB
-			Used:              70000000000,  // 70 GB
-			UsedPercent:       70.0,
-			InodesTotal:       1000000,
-			InodesUsed:        500000,
-			InodesFree:        500000,
-			InodesUsedPercent: 50.0,
-		}, nil
-	}
-	diskv2.DiskIOCounters = func(...string) (map[string]gopsutil_disk.IOCountersStat, error) {
-		return map[string]gopsutil_disk.IOCountersStat{
-			"\\\\?\\Volume{a1b2c3d4-e5f6-7890-abcd-ef1234567890}\\": {
-				Name:       "sda1",
-				ReadCount:  100,
-				WriteCount: 200,
-				ReadBytes:  1048576,
-				WriteBytes: 2097152,
-				ReadTime:   300,
-				WriteTime:  450,
-			},
-		}, nil
-	}
-	diskCheck := createCheck()
+	diskCheck := createWindowsCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte("lowercase_device_tag: true"))
@@ -125,30 +108,7 @@ func TestGivenADiskCheckWithLowercaseDeviceTagConfigured_WhenCheckRuns_ThenLower
 
 func TestGivenADiskCheckWithIncludeAllDevicesTrueConfigured_WhenCheckRuns_ThenAllUsageMetricsAreReported(t *testing.T) {
 	setupDefaultMocks()
-	diskv2.DiskPartitions = func(_ bool) ([]gopsutil_disk.PartitionStat, error) {
-		return []gopsutil_disk.PartitionStat{
-			{
-				Device:     "\\\\?\\Volume{a1b2c3d4-e5f6-7890-abcd-ef1234567890}\\",
-				Mountpoint: "D:\\",
-				Fstype:     "NTFS",
-				Opts:       []string{"rw", "relatime"},
-			}}, nil
-	}
-	diskv2.DiskUsage = func(_ string) (*gopsutil_disk.UsageStat, error) {
-		return &gopsutil_disk.UsageStat{
-			Path:              "D:\\",
-			Fstype:            "NTFS",
-			Total:             100000000000, // 100 GB
-			Free:              30000000000,  // 30 GB
-			Used:              70000000000,  // 70 GB
-			UsedPercent:       70.0,
-			InodesTotal:       1000000,
-			InodesUsed:        500000,
-			InodesFree:        500000,
-			InodesUsedPercent: 50.0,
-		}, nil
-	}
-	diskCheck := createCheck()
+	diskCheck := createWindowsCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte("include_all_devices: true"))
@@ -164,30 +124,7 @@ func TestGivenADiskCheckWithIncludeAllDevicesTrueConfigured_WhenCheckRuns_ThenAl
 
 func TestGivenADiskCheckWithIncludeAllDevicesFalseConfigured_WhenCheckRuns_ThenOnlyPhysicalDevicesUsageMetricsAreReported(t *testing.T) {
 	setupDefaultMocks()
-	diskv2.DiskPartitions = func(_ bool) ([]gopsutil_disk.PartitionStat, error) {
-		return []gopsutil_disk.PartitionStat{
-			{
-				Device:     "\\\\?\\Volume{a1b2c3d4-e5f6-7890-abcd-ef1234567890}\\",
-				Mountpoint: "D:\\",
-				Fstype:     "NTFS",
-				Opts:       []string{"rw", "relatime"},
-			}}, nil
-	}
-	diskv2.DiskUsage = func(_ string) (*gopsutil_disk.UsageStat, error) {
-		return &gopsutil_disk.UsageStat{
-			Path:              "D:\\",
-			Fstype:            "NTFS",
-			Total:             100000000000, // 100 GB
-			Free:              30000000000,  // 30 GB
-			Used:              70000000000,  // 70 GB
-			UsedPercent:       70.0,
-			InodesTotal:       1000000,
-			InodesUsed:        500000,
-			InodesFree:        500000,
-			InodesUsedPercent: 50.0,
-		}, nil
-	}
-	diskCheck := createCheck()
+	diskCheck := createWindowsCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte("include_all_devices: false"))
@@ -203,7 +140,8 @@ func TestGivenADiskCheckWithIncludeAllDevicesFalseConfigured_WhenCheckRuns_ThenO
 
 func TestGivenADiskCheckWithDefaultConfig_WhenCheckRunsAndPartitionsSystemReturnsEmptyDevice_ThenNoUsageMetricsAreReportedForThatPartition(t *testing.T) {
 	setupDefaultMocks()
-	diskv2.DiskPartitions = func(_ bool) ([]gopsutil_disk.PartitionStat, error) {
+	diskCheck := createWindowsCheck()
+	diskCheck = diskv2.WithDiskPartitions(diskCheck, func(_ bool) ([]gopsutil_disk.PartitionStat, error) {
 		return []gopsutil_disk.PartitionStat{
 			{
 				Device:     "",
@@ -217,22 +155,7 @@ func TestGivenADiskCheckWithDefaultConfig_WhenCheckRunsAndPartitionsSystemReturn
 				Fstype:     "NTFS",
 				Opts:       []string{"rw", "relatime"},
 			}}, nil
-	}
-	diskv2.DiskUsage = func(_ string) (*gopsutil_disk.UsageStat, error) {
-		return &gopsutil_disk.UsageStat{
-			Path:              "D:\\",
-			Fstype:            "NTFS",
-			Total:             100000000000, // 100 GB
-			Free:              30000000000,  // 30 GB
-			Used:              70000000000,  // 70 GB
-			UsedPercent:       70.0,
-			InodesTotal:       1000000,
-			InodesUsed:        500000,
-			InodesFree:        500000,
-			InodesUsedPercent: 50.0,
-		}, nil
-	}
-	diskCheck := createCheck()
+	})
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 
@@ -250,30 +173,7 @@ func TestGivenADiskCheckWithDefaultConfig_WhenCheckRunsAndPartitionsSystemReturn
 
 func TestGivenADiskCheckWithDeviceIncludeConfigured_WhenCheckRuns_ThenOnlyUsageMetricsForPartitionsWithThoseDevicesAreReported(t *testing.T) {
 	setupDefaultMocks()
-	diskv2.DiskPartitions = func(_ bool) ([]gopsutil_disk.PartitionStat, error) {
-		return []gopsutil_disk.PartitionStat{
-			{
-				Device:     "\\\\?\\Volume{a1b2c3d4-e5f6-7890-abcd-ef1234567890}\\",
-				Mountpoint: "D:\\",
-				Fstype:     "NTFS",
-				Opts:       []string{"rw", "relatime"},
-			}}, nil
-	}
-	diskv2.DiskUsage = func(_ string) (*gopsutil_disk.UsageStat, error) {
-		return &gopsutil_disk.UsageStat{
-			Path:              "D:\\",
-			Fstype:            "NTFS",
-			Total:             100000000000, // 100 GB
-			Free:              30000000000,  // 30 GB
-			Used:              70000000000,  // 70 GB
-			UsedPercent:       70.0,
-			InodesTotal:       1000000,
-			InodesUsed:        500000,
-			InodesFree:        500000,
-			InodesUsedPercent: 50.0,
-		}, nil
-	}
-	diskCheck := createCheck()
+	diskCheck := createWindowsCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte(`
@@ -292,30 +192,7 @@ device_include:
 
 func TestGivenADiskCheckWithDeviceWhiteListConfigured_WhenCheckRuns_ThenOnlyUsageMetricsForPartitionsWithThoseDevicesAreReported(t *testing.T) {
 	setupDefaultMocks()
-	diskv2.DiskPartitions = func(_ bool) ([]gopsutil_disk.PartitionStat, error) {
-		return []gopsutil_disk.PartitionStat{
-			{
-				Device:     "\\\\?\\Volume{a1b2c3d4-e5f6-7890-abcd-ef1234567890}\\",
-				Mountpoint: "D:\\",
-				Fstype:     "NTFS",
-				Opts:       []string{"rw", "relatime"},
-			}}, nil
-	}
-	diskv2.DiskUsage = func(_ string) (*gopsutil_disk.UsageStat, error) {
-		return &gopsutil_disk.UsageStat{
-			Path:              "D:\\",
-			Fstype:            "NTFS",
-			Total:             100000000000, // 100 GB
-			Free:              30000000000,  // 30 GB
-			Used:              70000000000,  // 70 GB
-			UsedPercent:       70.0,
-			InodesTotal:       1000000,
-			InodesUsed:        500000,
-			InodesFree:        500000,
-			InodesUsedPercent: 50.0,
-		}, nil
-	}
-	diskCheck := createCheck()
+	diskCheck := createWindowsCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte(`
@@ -334,7 +211,8 @@ device_whitelist:
 
 func TestGivenADiskCheckWithFileSystemGlobalExcludeNotConfigured_WhenCheckRuns_ThenUsageMetricsAreNotReportedForPartitionsWithIso9660FileSystems(t *testing.T) {
 	setupDefaultMocks()
-	diskv2.DiskPartitions = func(_ bool) ([]gopsutil_disk.PartitionStat, error) {
+	diskCheck := createWindowsCheck()
+	diskCheck = diskv2.WithDiskPartitions(diskCheck, func(_ bool) ([]gopsutil_disk.PartitionStat, error) {
 		return []gopsutil_disk.PartitionStat{
 			{
 				Device:     "cdrom",
@@ -344,26 +222,11 @@ func TestGivenADiskCheckWithFileSystemGlobalExcludeNotConfigured_WhenCheckRuns_T
 			},
 			{
 				Device:     "\\\\?\\Volume{a1b2c3d4-e5f6-7890-abcd-ef1234567890}\\",
-				Mountpoint: "D:\\",
+				Mountpoint: "E:\\",
 				Fstype:     "NTFS",
 				Opts:       []string{"rw", "relatime"},
 			}}, nil
-	}
-	diskv2.DiskUsage = func(_ string) (*gopsutil_disk.UsageStat, error) {
-		return &gopsutil_disk.UsageStat{
-			Path:              "D:\\",
-			Fstype:            "NTFS",
-			Total:             100000000000, // 100 GB
-			Free:              30000000000,  // 30 GB
-			Used:              70000000000,  // 70 GB
-			UsedPercent:       70.0,
-			InodesTotal:       1000000,
-			InodesUsed:        500000,
-			InodesFree:        500000,
-			InodesUsedPercent: 50.0,
-		}, nil
-	}
-	diskCheck := createCheck()
+	})
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 
@@ -381,7 +244,8 @@ func TestGivenADiskCheckWithFileSystemGlobalExcludeNotConfigured_WhenCheckRuns_T
 
 func TestGivenADiskCheckWithFileSystemGlobalExcludeNotConfigured_WhenCheckRuns_ThenUsageMetricsAreNotReportedForPartitionsWithTracefsFileSystems(t *testing.T) {
 	setupDefaultMocks()
-	diskv2.DiskPartitions = func(_ bool) ([]gopsutil_disk.PartitionStat, error) {
+	diskCheck := createWindowsCheck()
+	diskCheck = diskv2.WithDiskPartitions(diskCheck, func(_ bool) ([]gopsutil_disk.PartitionStat, error) {
 		return []gopsutil_disk.PartitionStat{
 			{
 				Device:     "trace",
@@ -391,26 +255,11 @@ func TestGivenADiskCheckWithFileSystemGlobalExcludeNotConfigured_WhenCheckRuns_T
 			},
 			{
 				Device:     "\\\\?\\Volume{a1b2c3d4-e5f6-7890-abcd-ef1234567890}\\",
-				Mountpoint: "D:\\",
+				Mountpoint: "E:\\",
 				Fstype:     "NTFS",
 				Opts:       []string{"rw", "relatime"},
 			}}, nil
-	}
-	diskv2.DiskUsage = func(_ string) (*gopsutil_disk.UsageStat, error) {
-		return &gopsutil_disk.UsageStat{
-			Path:              "D:\\",
-			Fstype:            "NTFS",
-			Total:             100000000000, // 100 GB
-			Free:              30000000000,  // 30 GB
-			Used:              70000000000,  // 70 GB
-			UsedPercent:       70.0,
-			InodesTotal:       1000000,
-			InodesUsed:        500000,
-			InodesFree:        500000,
-			InodesUsedPercent: 50.0,
-		}, nil
-	}
-	diskCheck := createCheck()
+	})
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 
@@ -428,7 +277,7 @@ func TestGivenADiskCheckWithFileSystemGlobalExcludeNotConfigured_WhenCheckRuns_T
 
 func TestGivenADiskCheckWithDefaultConfig_WhenCheckRuns_ThenAllIOCountersMetricsAreReported(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createWindowsCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 
@@ -436,14 +285,10 @@ func TestGivenADiskCheckWithDefaultConfig_WhenCheckRuns_ThenAllIOCountersMetrics
 	err := diskCheck.Run()
 
 	assert.Nil(t, err)
-	m.AssertMetric(t, "MonotonicCount", "system.disk.read_time", float64(300), "", []string{"device:/dev/sda1", "device_name:/dev/sda1"})
-	m.AssertMetric(t, "MonotonicCount", "system.disk.write_time", float64(450), "", []string{"device:/dev/sda1", "device_name:/dev/sda1"})
-	m.AssertMetric(t, "Rate", "system.disk.read_time_pct", float64(30), "", []string{"device:/dev/sda1", "device_name:/dev/sda1"})
-	m.AssertMetric(t, "Rate", "system.disk.write_time_pct", float64(45), "", []string{"device:/dev/sda1", "device_name:/dev/sda1"})
-	m.AssertMetric(t, "MonotonicCount", "system.disk.read_time", float64(500), "", []string{"device:/dev/sda2", "device_name:/dev/sda2"})
-	m.AssertMetric(t, "MonotonicCount", "system.disk.write_time", float64(150), "", []string{"device:/dev/sda2", "device_name:/dev/sda2"})
-	m.AssertMetric(t, "Rate", "system.disk.read_time_pct", float64(50), "", []string{"device:/dev/sda2", "device_name:/dev/sda2"})
-	m.AssertMetric(t, "Rate", "system.disk.write_time_pct", float64(15), "", []string{"device:/dev/sda2", "device_name:/dev/sda2"})
+	m.AssertMetric(t, "MonotonicCount", "system.disk.read_time", float64(300), "", []string{`device:\\?\Volume{a1b2c3d4-e5f6-7890-abcd-ef1234567890}\`, `device_name:?\volume{a1b2c3d4-e5f6-7890-abcd-ef1234567890}`})
+	m.AssertMetric(t, "MonotonicCount", "system.disk.write_time", float64(450), "", []string{`device:\\?\Volume{a1b2c3d4-e5f6-7890-abcd-ef1234567890}\`, `device_name:?\volume{a1b2c3d4-e5f6-7890-abcd-ef1234567890}`})
+	m.AssertMetric(t, "Rate", "system.disk.read_time_pct", float64(30), "", []string{`device:\\?\Volume{a1b2c3d4-e5f6-7890-abcd-ef1234567890}\`, `device_name:?\volume{a1b2c3d4-e5f6-7890-abcd-ef1234567890}`})
+	m.AssertMetric(t, "Rate", "system.disk.write_time_pct", float64(45), "", []string{`device:\\?\Volume{a1b2c3d4-e5f6-7890-abcd-ef1234567890}\`, `device_name:?\volume{a1b2c3d4-e5f6-7890-abcd-ef1234567890}`})
 }
 
 func TestGivenADiskCheckWithCreateMountsConfigured_WhenCheckIsConfigured_ThenMountsAreCreated(t *testing.T) {
@@ -453,7 +298,7 @@ func TestGivenADiskCheckWithCreateMountsConfigured_WhenCheckIsConfigured_ThenMou
 		netAddConnectionCalls = append(netAddConnectionCalls, []string{localName, remoteName, password, username})
 		return nil
 	}
-	diskCheck := createCheck()
+	diskCheck := createWindowsCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte(`
@@ -495,7 +340,7 @@ func TestGivenADiskCheckWithCreateMountsConfiguredWithoutHost_WhenCheckIsConfigu
 		netAddConnectionCalls = append(netAddConnectionCalls, []string{localName, remoteName, password, username})
 		return nil
 	}
-	diskCheck := createCheck()
+	diskCheck := createWindowsCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte(`
@@ -523,7 +368,7 @@ func TestGivenADiskCheckWithCreateMountsConfigured_WhenCheckRunsAndIOCountersSys
 	diskv2.NetAddConnection = func(_localName, _remoteName, _password, _username string) error {
 		return errors.New("error calling NetAddConnection")
 	}
-	diskCheck := createCheck()
+	diskCheck := createWindowsCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte(`
@@ -548,30 +393,7 @@ create_mounts:
 
 func TestGivenADiskCheckWithDeviceTagReConfigured_WhenCheckRuns_ThenUsageMetricsAreReportedWithTheseTags(t *testing.T) {
 	setupDefaultMocks()
-	diskv2.DiskPartitions = func(_ bool) ([]gopsutil_disk.PartitionStat, error) {
-		return []gopsutil_disk.PartitionStat{
-			{
-				Device:     `\\?\Volume{a1b2c3d4-e5f6-7890-abcd-ef1234567890}\`,
-				Mountpoint: "D:\\",
-				Fstype:     "NTFS",
-				Opts:       []string{"rw", "relatime"},
-			}}, nil
-	}
-	diskv2.DiskUsage = func(_ string) (*gopsutil_disk.UsageStat, error) {
-		return &gopsutil_disk.UsageStat{
-			Path:              "D:\\",
-			Fstype:            "NTFS",
-			Total:             100000000000, // 100 GB
-			Free:              30000000000,  // 30 GB
-			Used:              70000000000,  // 70 GB
-			UsedPercent:       70.0,
-			InodesTotal:       1000000,
-			InodesUsed:        500000,
-			InodesFree:        500000,
-			InodesUsedPercent: 50.0,
-		}, nil
-	}
-	diskCheck := createCheck()
+	diskCheck := createWindowsCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte(`
@@ -590,30 +412,7 @@ device_tag_re:
 
 func TestGivenADiskCheckWithFileSystemGlobalExcludeConfigured_WhenCheckRuns_ThenUsageMetricsAreNotReportedForPartitionsWithThoseFileSystems(t *testing.T) {
 	setupDefaultMocks()
-	diskv2.DiskPartitions = func(_ bool) ([]gopsutil_disk.PartitionStat, error) {
-		return []gopsutil_disk.PartitionStat{
-			{
-				Device:     "\\\\?\\Volume{a1b2c3d4-e5f6-7890-abcd-ef1234567890}\\",
-				Mountpoint: "D:\\",
-				Fstype:     "NTFS",
-				Opts:       []string{"rw", "relatime"},
-			}}, nil
-	}
-	diskv2.DiskUsage = func(_ string) (*gopsutil_disk.UsageStat, error) {
-		return &gopsutil_disk.UsageStat{
-			Path:              "D:\\",
-			Fstype:            "NTFS",
-			Total:             100000000000, // 100 GB
-			Free:              30000000000,  // 30 GB
-			Used:              70000000000,  // 70 GB
-			UsedPercent:       70.0,
-			InodesTotal:       1000000,
-			InodesUsed:        500000,
-			InodesFree:        500000,
-			InodesUsedPercent: 50.0,
-		}, nil
-	}
-	diskCheck := createCheck()
+	diskCheck := createWindowsCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	initConfig := integration.Data([]byte(`
@@ -632,30 +431,7 @@ file_system_global_exclude:
 
 func TestGivenADiskCheckWithFileSystemGlobalBlackListConfigured_WhenCheckRuns_ThenUsageMetricsAreNotReportedForPartitionsWithThoseFileSystems(t *testing.T) {
 	setupDefaultMocks()
-	diskv2.DiskPartitions = func(_ bool) ([]gopsutil_disk.PartitionStat, error) {
-		return []gopsutil_disk.PartitionStat{
-			{
-				Device:     "\\\\?\\Volume{a1b2c3d4-e5f6-7890-abcd-ef1234567890}\\",
-				Mountpoint: "D:\\",
-				Fstype:     "NTFS",
-				Opts:       []string{"rw", "relatime"},
-			}}, nil
-	}
-	diskv2.DiskUsage = func(_ string) (*gopsutil_disk.UsageStat, error) {
-		return &gopsutil_disk.UsageStat{
-			Path:              "D:\\",
-			Fstype:            "NTFS",
-			Total:             100000000000, // 100 GB
-			Free:              30000000000,  // 30 GB
-			Used:              70000000000,  // 70 GB
-			UsedPercent:       70.0,
-			InodesTotal:       1000000,
-			InodesUsed:        500000,
-			InodesFree:        500000,
-			InodesUsedPercent: 50.0,
-		}, nil
-	}
-	diskCheck := createCheck()
+	diskCheck := createWindowsCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	initConfig := integration.Data([]byte(`
@@ -674,30 +450,7 @@ file_system_global_blacklist:
 
 func TestGivenADiskCheckWithExcludedFileSystemsConfigured_WhenCheckRuns_ThenUsageMetricsAreNotReportedForPartitionsWithThoseFileSystems(t *testing.T) {
 	setupDefaultMocks()
-	diskv2.DiskPartitions = func(_ bool) ([]gopsutil_disk.PartitionStat, error) {
-		return []gopsutil_disk.PartitionStat{
-			{
-				Device:     "\\\\?\\Volume{a1b2c3d4-e5f6-7890-abcd-ef1234567890}\\",
-				Mountpoint: "D:\\",
-				Fstype:     "NTFS",
-				Opts:       []string{"rw", "relatime"},
-			}}, nil
-	}
-	diskv2.DiskUsage = func(_ string) (*gopsutil_disk.UsageStat, error) {
-		return &gopsutil_disk.UsageStat{
-			Path:              "D:\\",
-			Fstype:            "NTFS",
-			Total:             100000000000, // 100 GB
-			Free:              30000000000,  // 30 GB
-			Used:              70000000000,  // 70 GB
-			UsedPercent:       70.0,
-			InodesTotal:       1000000,
-			InodesUsed:        500000,
-			InodesFree:        500000,
-			InodesUsedPercent: 50.0,
-		}, nil
-	}
-	diskCheck := createCheck()
+	diskCheck := createWindowsCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte(`
@@ -716,30 +469,7 @@ excluded_filesystems:
 
 func TestGivenADiskCheckWithFileSystemExcludeConfigured_WhenCheckRuns_ThenUsageMetricsAreNotReportedForPartitionsWithThoseFileSystems(t *testing.T) {
 	setupDefaultMocks()
-	diskv2.DiskPartitions = func(_ bool) ([]gopsutil_disk.PartitionStat, error) {
-		return []gopsutil_disk.PartitionStat{
-			{
-				Device:     "\\\\?\\Volume{a1b2c3d4-e5f6-7890-abcd-ef1234567890}\\",
-				Mountpoint: "D:\\",
-				Fstype:     "NTFS",
-				Opts:       []string{"rw", "relatime"},
-			}}, nil
-	}
-	diskv2.DiskUsage = func(_ string) (*gopsutil_disk.UsageStat, error) {
-		return &gopsutil_disk.UsageStat{
-			Path:              "D:\\",
-			Fstype:            "NTFS",
-			Total:             100000000000, // 100 GB
-			Free:              30000000000,  // 30 GB
-			Used:              70000000000,  // 70 GB
-			UsedPercent:       70.0,
-			InodesTotal:       1000000,
-			InodesUsed:        500000,
-			InodesFree:        500000,
-			InodesUsedPercent: 50.0,
-		}, nil
-	}
-	diskCheck := createCheck()
+	diskCheck := createWindowsCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte(`
@@ -758,30 +488,7 @@ file_system_exclude:
 
 func TestGivenADiskCheckWithFileSystemBlackListConfigured_WhenCheckRuns_ThenUsageMetricsAreNotReportedForPartitionsWithThoseFileSystems(t *testing.T) {
 	setupDefaultMocks()
-	diskv2.DiskPartitions = func(_ bool) ([]gopsutil_disk.PartitionStat, error) {
-		return []gopsutil_disk.PartitionStat{
-			{
-				Device:     "\\\\?\\Volume{a1b2c3d4-e5f6-7890-abcd-ef1234567890}\\",
-				Mountpoint: "D:\\",
-				Fstype:     "NTFS",
-				Opts:       []string{"rw", "relatime"},
-			}}, nil
-	}
-	diskv2.DiskUsage = func(_ string) (*gopsutil_disk.UsageStat, error) {
-		return &gopsutil_disk.UsageStat{
-			Path:              "D:\\",
-			Fstype:            "NTFS",
-			Total:             100000000000, // 100 GB
-			Free:              30000000000,  // 30 GB
-			Used:              70000000000,  // 70 GB
-			UsedPercent:       70.0,
-			InodesTotal:       1000000,
-			InodesUsed:        500000,
-			InodesFree:        500000,
-			InodesUsedPercent: 50.0,
-		}, nil
-	}
-	diskCheck := createCheck()
+	diskCheck := createWindowsCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte(`
@@ -800,30 +507,7 @@ file_system_blacklist:
 
 func TestGivenADiskCheckWithFileSystemIncludeConfigured_WhenCheckRuns_ThenOnlyUsageMetricsForPartitionsWithThoseFileSystemsAreReported(t *testing.T) {
 	setupDefaultMocks()
-	diskv2.DiskPartitions = func(_ bool) ([]gopsutil_disk.PartitionStat, error) {
-		return []gopsutil_disk.PartitionStat{
-			{
-				Device:     "\\\\?\\Volume{a1b2c3d4-e5f6-7890-abcd-ef1234567890}\\",
-				Mountpoint: "D:\\",
-				Fstype:     "NTFS",
-				Opts:       []string{"rw", "relatime"},
-			}}, nil
-	}
-	diskv2.DiskUsage = func(_ string) (*gopsutil_disk.UsageStat, error) {
-		return &gopsutil_disk.UsageStat{
-			Path:              "D:\\",
-			Fstype:            "NTFS",
-			Total:             100000000000, // 100 GB
-			Free:              30000000000,  // 30 GB
-			Used:              70000000000,  // 70 GB
-			UsedPercent:       70.0,
-			InodesTotal:       1000000,
-			InodesUsed:        500000,
-			InodesFree:        500000,
-			InodesUsedPercent: 50.0,
-		}, nil
-	}
-	diskCheck := createCheck()
+	diskCheck := createWindowsCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte(`
@@ -842,30 +526,7 @@ file_system_include:
 
 func TestGivenADiskCheckWithFileSystemWhiteListConfigured_WhenCheckRuns_ThenOnlyUsageMetricsForPartitionsWithThoseFileSystemsAreReported(t *testing.T) {
 	setupDefaultMocks()
-	diskv2.DiskPartitions = func(_ bool) ([]gopsutil_disk.PartitionStat, error) {
-		return []gopsutil_disk.PartitionStat{
-			{
-				Device:     "\\\\?\\Volume{a1b2c3d4-e5f6-7890-abcd-ef1234567890}\\",
-				Mountpoint: "D:\\",
-				Fstype:     "NTFS",
-				Opts:       []string{"rw", "relatime"},
-			}}, nil
-	}
-	diskv2.DiskUsage = func(_ string) (*gopsutil_disk.UsageStat, error) {
-		return &gopsutil_disk.UsageStat{
-			Path:              "D:\\",
-			Fstype:            "NTFS",
-			Total:             100000000000, // 100 GB
-			Free:              30000000000,  // 30 GB
-			Used:              70000000000,  // 70 GB
-			UsedPercent:       70.0,
-			InodesTotal:       1000000,
-			InodesUsed:        500000,
-			InodesFree:        500000,
-			InodesUsedPercent: 50.0,
-		}, nil
-	}
-	diskCheck := createCheck()
+	diskCheck := createWindowsCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte(`
@@ -884,30 +545,7 @@ file_system_whitelist:
 
 func TestGivenADiskCheckWithMountPointGlobalExcludeConfigured_WhenCheckRuns_ThenUsageMetricsAreNotReportedForPartitionsWithThoseMountPoints(t *testing.T) {
 	setupDefaultMocks()
-	diskv2.DiskPartitions = func(_ bool) ([]gopsutil_disk.PartitionStat, error) {
-		return []gopsutil_disk.PartitionStat{
-			{
-				Device:     "\\\\?\\Volume{a1b2c3d4-e5f6-7890-abcd-ef1234567890}\\",
-				Mountpoint: "D:\\",
-				Fstype:     "NTFS",
-				Opts:       []string{"rw", "relatime"},
-			}}, nil
-	}
-	diskv2.DiskUsage = func(_ string) (*gopsutil_disk.UsageStat, error) {
-		return &gopsutil_disk.UsageStat{
-			Path:              "D:\\",
-			Fstype:            "NTFS",
-			Total:             100000000000, // 100 GB
-			Free:              30000000000,  // 30 GB
-			Used:              70000000000,  // 70 GB
-			UsedPercent:       70.0,
-			InodesTotal:       1000000,
-			InodesUsed:        500000,
-			InodesFree:        500000,
-			InodesUsedPercent: 50.0,
-		}, nil
-	}
-	diskCheck := createCheck()
+	diskCheck := createWindowsCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	initConfig := integration.Data([]byte(`
@@ -926,30 +564,7 @@ mount_point_global_exclude:
 
 func TestGivenADiskCheckWithMountPointGlobalBlackListConfigured_WhenCheckRuns_ThenUsageMetricsAreNotReportedForPartitionsWithThoseMountPoints(t *testing.T) {
 	setupDefaultMocks()
-	diskv2.DiskPartitions = func(_ bool) ([]gopsutil_disk.PartitionStat, error) {
-		return []gopsutil_disk.PartitionStat{
-			{
-				Device:     "\\\\?\\Volume{a1b2c3d4-e5f6-7890-abcd-ef1234567890}\\",
-				Mountpoint: "D:\\",
-				Fstype:     "NTFS",
-				Opts:       []string{"rw", "relatime"},
-			}}, nil
-	}
-	diskv2.DiskUsage = func(_ string) (*gopsutil_disk.UsageStat, error) {
-		return &gopsutil_disk.UsageStat{
-			Path:              "D:\\",
-			Fstype:            "NTFS",
-			Total:             100000000000, // 100 GB
-			Free:              30000000000,  // 30 GB
-			Used:              70000000000,  // 70 GB
-			UsedPercent:       70.0,
-			InodesTotal:       1000000,
-			InodesUsed:        500000,
-			InodesFree:        500000,
-			InodesUsedPercent: 50.0,
-		}, nil
-	}
-	diskCheck := createCheck()
+	diskCheck := createWindowsCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	initConfig := integration.Data([]byte(`
@@ -968,30 +583,7 @@ mount_point_global_blacklist:
 
 func TestGivenADiskCheckWithMountPointExcludeConfigured_WhenCheckRuns_ThenUsageMetricsAreNotReportedForPartitionsWithThoseMountPoints(t *testing.T) {
 	setupDefaultMocks()
-	diskv2.DiskPartitions = func(_ bool) ([]gopsutil_disk.PartitionStat, error) {
-		return []gopsutil_disk.PartitionStat{
-			{
-				Device:     "\\\\?\\Volume{a1b2c3d4-e5f6-7890-abcd-ef1234567890}\\",
-				Mountpoint: "D:\\",
-				Fstype:     "NTFS",
-				Opts:       []string{"rw", "relatime"},
-			}}, nil
-	}
-	diskv2.DiskUsage = func(_ string) (*gopsutil_disk.UsageStat, error) {
-		return &gopsutil_disk.UsageStat{
-			Path:              "D:\\",
-			Fstype:            "NTFS",
-			Total:             100000000000, // 100 GB
-			Free:              30000000000,  // 30 GB
-			Used:              70000000000,  // 70 GB
-			UsedPercent:       70.0,
-			InodesTotal:       1000000,
-			InodesUsed:        500000,
-			InodesFree:        500000,
-			InodesUsedPercent: 50.0,
-		}, nil
-	}
-	diskCheck := createCheck()
+	diskCheck := createWindowsCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte(`
@@ -1010,30 +602,7 @@ mount_point_exclude:
 
 func TestGivenADiskCheckWithMountPointBlackListConfigured_WhenCheckRuns_ThenUsageMetricsAreNotReportedForPartitionsWithThoseMountPoints(t *testing.T) {
 	setupDefaultMocks()
-	diskv2.DiskPartitions = func(_ bool) ([]gopsutil_disk.PartitionStat, error) {
-		return []gopsutil_disk.PartitionStat{
-			{
-				Device:     "\\\\?\\Volume{a1b2c3d4-e5f6-7890-abcd-ef1234567890}\\",
-				Mountpoint: "D:\\",
-				Fstype:     "NTFS",
-				Opts:       []string{"rw", "relatime"},
-			}}, nil
-	}
-	diskv2.DiskUsage = func(_ string) (*gopsutil_disk.UsageStat, error) {
-		return &gopsutil_disk.UsageStat{
-			Path:              "D:\\",
-			Fstype:            "NTFS",
-			Total:             100000000000, // 100 GB
-			Free:              30000000000,  // 30 GB
-			Used:              70000000000,  // 70 GB
-			UsedPercent:       70.0,
-			InodesTotal:       1000000,
-			InodesUsed:        500000,
-			InodesFree:        500000,
-			InodesUsedPercent: 50.0,
-		}, nil
-	}
-	diskCheck := createCheck()
+	diskCheck := createWindowsCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte(`
@@ -1052,30 +621,7 @@ mount_point_blacklist:
 
 func TestGivenADiskCheckWithExcludedMountPointReConfigured_WhenCheckRuns_ThenUsageMetricsAreNotReportedForPartitionsWithThoseMountPoints(t *testing.T) {
 	setupDefaultMocks()
-	diskv2.DiskPartitions = func(_ bool) ([]gopsutil_disk.PartitionStat, error) {
-		return []gopsutil_disk.PartitionStat{
-			{
-				Device:     "\\\\?\\Volume{a1b2c3d4-e5f6-7890-abcd-ef1234567890}\\",
-				Mountpoint: "D:\\",
-				Fstype:     "NTFS",
-				Opts:       []string{"rw", "relatime"},
-			}}, nil
-	}
-	diskv2.DiskUsage = func(_ string) (*gopsutil_disk.UsageStat, error) {
-		return &gopsutil_disk.UsageStat{
-			Path:              "D:\\",
-			Fstype:            "NTFS",
-			Total:             100000000000, // 100 GB
-			Free:              30000000000,  // 30 GB
-			Used:              70000000000,  // 70 GB
-			UsedPercent:       70.0,
-			InodesTotal:       1000000,
-			InodesUsed:        500000,
-			InodesFree:        500000,
-			InodesUsedPercent: 50.0,
-		}, nil
-	}
-	diskCheck := createCheck()
+	diskCheck := createWindowsCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte(`excluded_mountpoint_re: D:\\`))
@@ -1091,30 +637,7 @@ func TestGivenADiskCheckWithExcludedMountPointReConfigured_WhenCheckRuns_ThenUsa
 
 func TestGivenADiskCheckWithUseMountConfigured_WhenCheckRuns_ThenUsageMetricsAreReportedWithMountPointTags(t *testing.T) {
 	setupDefaultMocks()
-	diskv2.DiskPartitions = func(_ bool) ([]gopsutil_disk.PartitionStat, error) {
-		return []gopsutil_disk.PartitionStat{
-			{
-				Device:     "\\\\?\\Volume{a1b2c3d4-e5f6-7890-abcd-ef1234567890}\\",
-				Mountpoint: "D:\\",
-				Fstype:     "NTFS",
-				Opts:       []string{"rw", "relatime"},
-			}}, nil
-	}
-	diskv2.DiskUsage = func(_ string) (*gopsutil_disk.UsageStat, error) {
-		return &gopsutil_disk.UsageStat{
-			Path:              "D:\\",
-			Fstype:            "NTFS",
-			Total:             100000000000, // 100 GB
-			Free:              30000000000,  // 30 GB
-			Used:              70000000000,  // 70 GB
-			UsedPercent:       70.0,
-			InodesTotal:       1000000,
-			InodesUsed:        500000,
-			InodesFree:        500000,
-			InodesUsedPercent: 50.0,
-		}, nil
-	}
-	diskCheck := createCheck()
+	diskCheck := createWindowsCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte("use_mount: true"))
@@ -1130,30 +653,7 @@ func TestGivenADiskCheckWithUseMountConfigured_WhenCheckRuns_ThenUsageMetricsAre
 
 func TestGivenADiskCheckWithServiceCheckRwTrueConfigured_WhenCheckRuns_ThenReadWriteServiceCheckReported(t *testing.T) {
 	setupDefaultMocks()
-	diskv2.DiskPartitions = func(_ bool) ([]gopsutil_disk.PartitionStat, error) {
-		return []gopsutil_disk.PartitionStat{
-			{
-				Device:     "\\\\?\\Volume{a1b2c3d4-e5f6-7890-abcd-ef1234567890}\\",
-				Mountpoint: "D:\\",
-				Fstype:     "NTFS",
-				Opts:       []string{"rw", "relatime"},
-			}}, nil
-	}
-	diskv2.DiskUsage = func(_ string) (*gopsutil_disk.UsageStat, error) {
-		return &gopsutil_disk.UsageStat{
-			Path:              "D:\\",
-			Fstype:            "NTFS",
-			Total:             100000000000, // 100 GB
-			Free:              30000000000,  // 30 GB
-			Used:              70000000000,  // 70 GB
-			UsedPercent:       70.0,
-			InodesTotal:       1000000,
-			InodesUsed:        500000,
-			InodesFree:        500000,
-			InodesUsedPercent: 50.0,
-		}, nil
-	}
-	diskCheck := createCheck()
+	diskCheck := createWindowsCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 	config := integration.Data([]byte(`
diff --git a/pkg/collector/corechecks/system/disk/diskv2/with_test.go b/pkg/collector/corechecks/system/disk/diskv2/with_test.go
new file mode 100644
index 000000000000..277d682a68ca
--- /dev/null
+++ b/pkg/collector/corechecks/system/disk/diskv2/with_test.go
@@ -0,0 +1,39 @@
+// Unless explicitly stated otherwise all files in this repository are licensed
+// under the Apache License Version 2.0.
+// This product includes software developed at Datadog (https://www.datadoghq.com/).
+// Copyright 2016-present Datadog, Inc.
+
+// Package diskv2 provides Disk Check.
+package diskv2
+
+import (
+	"github.com/DataDog/datadog-agent/pkg/collector/check"
+	"github.com/benbjohnson/clock"
+	gopsutil_disk "github.com/shirou/gopsutil/v4/disk"
+)
+
+// Test helpers
+
+// WithClock sets a custom clock on the Check and returns the updated Check.
+func WithClock(c check.Check, clock clock.Clock) check.Check {
+	c.(*Check).clock = clock
+	return c
+}
+
+// WithDiskPartitions sets a diskPartitions call on the Check and returns the updated Check.
+func WithDiskPartitions(c check.Check, f func(bool) ([]gopsutil_disk.PartitionStat, error)) check.Check {
+	c.(*Check).diskPartitions = f
+	return c
+}
+
+// WithDiskUsage sets a diskUsage call on the Check and returns the updated Check.
+func WithDiskUsage(c check.Check, f func(string) (*gopsutil_disk.UsageStat, error)) check.Check {
+	c.(*Check).diskUsage = f
+	return c
+}
+
+// WithDiskIOCounters sets a diskIOCounters call on the Check and returns the updated Check.
+func WithDiskIOCounters(c check.Check, f func(...string) (map[string]gopsutil_disk.IOCountersStat, error)) check.Check {
+	c.(*Check).diskIOCounters = f
+	return c
+}


Reviews:
user: login: GustavoCaso
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-13T10:53:52Z
user: login: GustavoCaso
body: I'm ok with the changes on removing globals from the diskv2 package. Still, I left a comment regarding the code we are force to write because we have a separate test package, I would suggest to move everything on the same package and allow setting private fields directly on the test 😄 
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-05-13T10:55:21Z
user: login: pgimalac
state: APPROVED
author_association: MEMBER
submitted_at: 2025-05-13T11:45:36Z
user: login: julien-lebot
body: Left some comments. Could you also update the description to explain why the timings in the code change?
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-13T11:55:12Z
user: login: jose-manuel-almaza
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-13T13:01:24Z
user: login: jose-manuel-almaza
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-13T13:01:51Z
user: login: jose-manuel-almaza
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-13T14:15:12Z
user: login: jose-manuel-almaza
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-13T14:37:30Z
user: login: jose-manuel-almaza
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-13T14:38:09Z
user: login: pgimalac
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-05-13T14:38:44Z
user: login: GustavoCaso
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-13T14:58:23Z
user: login: julien-lebot
body: 👍 for Windows Product changes
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-05-13T15:15:11Z
user: login: jose-manuel-almaza
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-13T17:43:21Z
user: login: GustavoCaso
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-14T07:38:53Z

Review comments:
diff_hunk: @@ -80,16 +80,15 @@ func TestGivenADiskCheckWithDefaultConfig_WhenCheckRuns_ThenAllUsageMetricsAreRe
 
 func TestGivenADiskCheckWithLowercaseDeviceTagConfigured_WhenCheckRuns_ThenLowercaseDevicesAreReported(t *testing.T) {
 	setupDefaultMocks()
-	diskv2.DiskPartitions = func(_ bool) ([]gopsutil_disk.PartitionStat, error) {
+	diskCheck := createCheck().(*diskv2.Check).WithDiskPartitions(func(_ bool) ([]gopsutil_disk.PartitionStat, error) {
path: pkg/collector/corechecks/system/disk/diskv2/disk_nix_test.go
user: login: GustavoCaso
body: I think, the fact that we need to convert value from `createCheck()` to `*diskv2.Check` to call their public API `WithDiskPartitions` in a way defeats the purpose of having a separate test package for the diskv2 package. 

I'm not sure if we should continue having a separate test package, as it forces us to write this type of code. Nevertheless, I'm not going to die on this hill 😄 
created_at: 2025-05-13T10:53:52Z
author_association: CONTRIBUTOR
diff_hunk: @@ -1274,18 +1253,24 @@ service_check_rw: false
 
 func TestGivenADiskCheckWithDefaultConfig_WhenUsagePartitionTimeout_ThenUsageMetricsNotReported(t *testing.T) {
 	setupDefaultMocks()
-	diskv2.DiskPartitions = func(_ bool) ([]gopsutil_disk.PartitionStat, error) {
+	mockClock := clock.NewMock()
+	afterCalled := make(chan time.Time, 1)
+	// Wrap your mockClock with the signaling clock
+	testClock := &signalClock{
+		Clock:       mockClock,
+		afterCalled: afterCalled,
+	}
+	diskCheck := createDiskCheck().WithClock(testClock).WithDiskPartitions(func(_ bool) ([]gopsutil_disk.PartitionStat, error) {
 		return []gopsutil_disk.PartitionStat{
 			{
 				Device:     "shm",
 				Mountpoint: "/dev/shm",
 				Fstype:     "tmpfs",
 				Opts:       []string{"rw", "nosuid", "nodev"},
 			}}, nil
-	}
-	diskv2.DiskUsage = func(_ string) (*gopsutil_disk.UsageStat, error) {
+	}).WithDiskUsage(func(_ string) (*gopsutil_disk.UsageStat, error) {
 		// Sleep 10s (longer than default timeout)
-		time.Sleep(10 * time.Second)
+		time.Sleep(60 * time.Second)
path: pkg/collector/corechecks/system/disk/diskv2/disk_test.go
user: login: julien-lebot
body: Should we update the comment here?
created_at: 2025-05-13T11:33:15Z
author_association: CONTRIBUTOR
diff_hunk: @@ -1318,7 +1295,7 @@ func TestGivenADiskCheckWithDefaultConfig_WhenUsagePartitionTimeout_ThenUsageMet
 	// Explicitly wait until diskCheck.Run calls mockClock.After()
 	<-afterCalled
 	// Move the clock forward longer than default timeout (5s)
-	mockClock.Add(10 * time.Second)
+	mockClock.Add(5 * time.Second)
path: pkg/collector/corechecks/system/disk/diskv2/disk_test.go
user: login: julien-lebot
body: Same here
created_at: 2025-05-13T11:33:33Z
author_association: CONTRIBUTOR
diff_hunk: @@ -640,26 +633,42 @@ func (c *Check) fetchAllDeviceLabels() error {
 	return c.fetchAllDeviceLabelsFromBlkid()
 }
 
-// Factory creates a new check factory
-func Factory() option.Option[func() check.Check] {
-	return option.New(newCheck)
+// WithClock sets a custom clock on the Check and returns the updated Check.
+func (c *Check) WithClock(clock clock.Clock) *Check {
path: pkg/collector/corechecks/system/disk/diskv2/disk.go
user: login: pgimalac
body: We're adding more functions to the API just so that we can run tests from another package, that seems less and less convenient...
created_at: 2025-05-13T11:42:23Z
author_association: MEMBER
diff_hunk: @@ -428,22 +273,18 @@ func TestGivenADiskCheckWithFileSystemGlobalExcludeNotConfigured_WhenCheckRuns_T
 
 func TestGivenADiskCheckWithDefaultConfig_WhenCheckRuns_ThenAllIOCountersMetricsAreReported(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createWindowsCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 
 	diskCheck.Configure(m.GetSenderManager(), integration.FakeConfigHash, nil, nil, "test")
 	err := diskCheck.Run()
 
 	assert.Nil(t, err)
-	m.AssertMetric(t, "MonotonicCount", "system.disk.read_time", float64(300), "", []string{"device:/dev/sda1", "device_name:/dev/sda1"})
-	m.AssertMetric(t, "MonotonicCount", "system.disk.write_time", float64(450), "", []string{"device:/dev/sda1", "device_name:/dev/sda1"})
-	m.AssertMetric(t, "Rate", "system.disk.read_time_pct", float64(30), "", []string{"device:/dev/sda1", "device_name:/dev/sda1"})
-	m.AssertMetric(t, "Rate", "system.disk.write_time_pct", float64(45), "", []string{"device:/dev/sda1", "device_name:/dev/sda1"})
-	m.AssertMetric(t, "MonotonicCount", "system.disk.read_time", float64(500), "", []string{"device:/dev/sda2", "device_name:/dev/sda2"})
-	m.AssertMetric(t, "MonotonicCount", "system.disk.write_time", float64(150), "", []string{"device:/dev/sda2", "device_name:/dev/sda2"})
-	m.AssertMetric(t, "Rate", "system.disk.read_time_pct", float64(50), "", []string{"device:/dev/sda2", "device_name:/dev/sda2"})
-	m.AssertMetric(t, "Rate", "system.disk.write_time_pct", float64(15), "", []string{"device:/dev/sda2", "device_name:/dev/sda2"})
+	m.AssertMetric(t, "MonotonicCount", "system.disk.read_time", float64(300), "", []string{`device:\\?\Volume{a1b2c3d4-e5f6-7890-abcd-ef1234567890}\`, `device_name:?\volume{a1b2c3d4-e5f6-7890-abcd-ef1234567890}`})
path: pkg/collector/corechecks/system/disk/diskv2/disk_windows_test.go
user: login: julien-lebot
body: Can you explain why did the tags assertion change?
Previously we were setting up the test function like so:
```go
diskv2.DiskIOCounters = func(...string) (map[string]gopsutil_disk.IOCountersStat, error) {
		return map[string]gopsutil_disk.IOCountersStat{
			"\\\\?\\Volume{a1b2c3d4-e5f6-7890-abcd-ef1234567890}\\": {
				Name:       "sda1",
				ReadCount:  100,
				WriteCount: 200,
				ReadBytes:  1048576,
				WriteBytes: 2097152,
				ReadTime:   300,
				WriteTime:  450,
			},
		}, nil
	}
```
and now `CreateWindowsCheck` does:
```go
WithDiskIOCounters(func(...string) (map[string]gopsutil_disk.IOCountersStat, error) {
		return map[string]gopsutil_disk.IOCountersStat{
			"\\\\?\\Volume{a1b2c3d4-e5f6-7890-abcd-ef1234567890}\\": {
				Name:       "sda1",
				ReadCount:  100,
				WriteCount: 200,
				ReadBytes:  1048576,
				WriteBytes: 2097152,
				ReadTime:   300,
				WriteTime:  450,
			},
		}, nil
	})
	return diskCheck
}
```
but that doesn't explain the change in tags. What am I missing?
created_at: 2025-05-13T11:46:35Z
author_association: CONTRIBUTOR
diff_hunk: @@ -640,26 +633,42 @@ func (c *Check) fetchAllDeviceLabels() error {
 	return c.fetchAllDeviceLabelsFromBlkid()
 }
 
-// Factory creates a new check factory
-func Factory() option.Option[func() check.Check] {
-	return option.New(newCheck)
+// WithClock sets a custom clock on the Check and returns the updated Check.
+func (c *Check) WithClock(clock clock.Clock) *Check {
path: pkg/collector/corechecks/system/disk/diskv2/disk.go
user: login: jose-manuel-almaza
body: Using the .WithX() pattern instead of exposing struct fields directly allows you to control and validate state changes, maintain fluent configuration, and enable dependency injection when it can't be done via the constructor — improving testability, encapsulation, and long-term maintainability.
The reason is not running tests from another package.
created_at: 2025-05-13T13:01:24Z
author_association: CONTRIBUTOR
diff_hunk: @@ -80,16 +80,15 @@ func TestGivenADiskCheckWithDefaultConfig_WhenCheckRuns_ThenAllUsageMetricsAreRe
 
 func TestGivenADiskCheckWithLowercaseDeviceTagConfigured_WhenCheckRuns_ThenLowercaseDevicesAreReported(t *testing.T) {
 	setupDefaultMocks()
-	diskv2.DiskPartitions = func(_ bool) ([]gopsutil_disk.PartitionStat, error) {
+	diskCheck := createCheck().(*diskv2.Check).WithDiskPartitions(func(_ bool) ([]gopsutil_disk.PartitionStat, error) {
path: pkg/collector/corechecks/system/disk/diskv2/disk_nix_test.go
user: login: jose-manuel-almaza
body: Using the .WithX() pattern instead of exposing struct fields directly allows you to control and validate state changes, maintain fluent configuration, and enable dependency injection when it can't be done via the constructor — improving testability, encapsulation, and long-term maintainability.
The reason is not running tests from another package.
created_at: 2025-05-13T13:01:51Z
author_association: CONTRIBUTOR
diff_hunk: @@ -428,22 +273,18 @@ func TestGivenADiskCheckWithFileSystemGlobalExcludeNotConfigured_WhenCheckRuns_T
 
 func TestGivenADiskCheckWithDefaultConfig_WhenCheckRuns_ThenAllIOCountersMetricsAreReported(t *testing.T) {
 	setupDefaultMocks()
-	diskCheck := createCheck()
+	diskCheck := createWindowsCheck()
 	m := mocksender.NewMockSender(diskCheck.ID())
 	m.SetupAcceptAll()
 
 	diskCheck.Configure(m.GetSenderManager(), integration.FakeConfigHash, nil, nil, "test")
 	err := diskCheck.Run()
 
 	assert.Nil(t, err)
-	m.AssertMetric(t, "MonotonicCount", "system.disk.read_time", float64(300), "", []string{"device:/dev/sda1", "device_name:/dev/sda1"})
-	m.AssertMetric(t, "MonotonicCount", "system.disk.write_time", float64(450), "", []string{"device:/dev/sda1", "device_name:/dev/sda1"})
-	m.AssertMetric(t, "Rate", "system.disk.read_time_pct", float64(30), "", []string{"device:/dev/sda1", "device_name:/dev/sda1"})
-	m.AssertMetric(t, "Rate", "system.disk.write_time_pct", float64(45), "", []string{"device:/dev/sda1", "device_name:/dev/sda1"})
-	m.AssertMetric(t, "MonotonicCount", "system.disk.read_time", float64(500), "", []string{"device:/dev/sda2", "device_name:/dev/sda2"})
-	m.AssertMetric(t, "MonotonicCount", "system.disk.write_time", float64(150), "", []string{"device:/dev/sda2", "device_name:/dev/sda2"})
-	m.AssertMetric(t, "Rate", "system.disk.read_time_pct", float64(50), "", []string{"device:/dev/sda2", "device_name:/dev/sda2"})
-	m.AssertMetric(t, "Rate", "system.disk.write_time_pct", float64(15), "", []string{"device:/dev/sda2", "device_name:/dev/sda2"})
+	m.AssertMetric(t, "MonotonicCount", "system.disk.read_time", float64(300), "", []string{`device:\\?\Volume{a1b2c3d4-e5f6-7890-abcd-ef1234567890}\`, `device_name:?\volume{a1b2c3d4-e5f6-7890-abcd-ef1234567890}`})
path: pkg/collector/corechecks/system/disk/diskv2/disk_windows_test.go
user: login: jose-manuel-almaza
body: These tags come from `DiskPartitions` and now they're different by default for all Windows checks
created_at: 2025-05-13T14:15:11Z
author_association: CONTRIBUTOR
diff_hunk: @@ -1274,18 +1253,24 @@ service_check_rw: false
 
 func TestGivenADiskCheckWithDefaultConfig_WhenUsagePartitionTimeout_ThenUsageMetricsNotReported(t *testing.T) {
 	setupDefaultMocks()
-	diskv2.DiskPartitions = func(_ bool) ([]gopsutil_disk.PartitionStat, error) {
+	mockClock := clock.NewMock()
+	afterCalled := make(chan time.Time, 1)
+	// Wrap your mockClock with the signaling clock
+	testClock := &signalClock{
+		Clock:       mockClock,
+		afterCalled: afterCalled,
+	}
+	diskCheck := createDiskCheck().WithClock(testClock).WithDiskPartitions(func(_ bool) ([]gopsutil_disk.PartitionStat, error) {
 		return []gopsutil_disk.PartitionStat{
 			{
 				Device:     "shm",
 				Mountpoint: "/dev/shm",
 				Fstype:     "tmpfs",
 				Opts:       []string{"rw", "nosuid", "nodev"},
 			}}, nil
-	}
-	diskv2.DiskUsage = func(_ string) (*gopsutil_disk.UsageStat, error) {
+	}).WithDiskUsage(func(_ string) (*gopsutil_disk.UsageStat, error) {
 		// Sleep 10s (longer than default timeout)
-		time.Sleep(10 * time.Second)
+		time.Sleep(60 * time.Second)
path: pkg/collector/corechecks/system/disk/diskv2/disk_test.go
user: login: jose-manuel-almaza
body: Back to sleep of 10s
created_at: 2025-05-13T14:37:30Z
author_association: CONTRIBUTOR
diff_hunk: @@ -1318,7 +1295,7 @@ func TestGivenADiskCheckWithDefaultConfig_WhenUsagePartitionTimeout_ThenUsageMet
 	// Explicitly wait until diskCheck.Run calls mockClock.After()
 	<-afterCalled
 	// Move the clock forward longer than default timeout (5s)
-	mockClock.Add(10 * time.Second)
+	mockClock.Add(5 * time.Second)
path: pkg/collector/corechecks/system/disk/diskv2/disk_test.go
user: login: jose-manuel-almaza
body: Same as what?
created_at: 2025-05-13T14:38:08Z
author_association: CONTRIBUTOR
diff_hunk: @@ -640,26 +633,42 @@ func (c *Check) fetchAllDeviceLabels() error {
 	return c.fetchAllDeviceLabelsFromBlkid()
 }
 
-// Factory creates a new check factory
-func Factory() option.Option[func() check.Check] {
-	return option.New(newCheck)
+// WithClock sets a custom clock on the Check and returns the updated Check.
+func (c *Check) WithClock(clock clock.Clock) *Check {
path: pkg/collector/corechecks/system/disk/diskv2/disk.go
user: login: pgimalac
body: Yeah but we're adding public APIs that are not used in the "real" code just so that we can test that, I don't see how that's better than just having the tests in the same package and setting the unexported fields in the tests
created_at: 2025-05-13T14:38:44Z
author_association: MEMBER
diff_hunk: @@ -640,26 +633,42 @@ func (c *Check) fetchAllDeviceLabels() error {
 	return c.fetchAllDeviceLabelsFromBlkid()
 }
 
-// Factory creates a new check factory
-func Factory() option.Option[func() check.Check] {
-	return option.New(newCheck)
+// WithClock sets a custom clock on the Check and returns the updated Check.
+func (c *Check) WithClock(clock clock.Clock) *Check {
path: pkg/collector/corechecks/system/disk/diskv2/disk.go
user: login: GustavoCaso
body: I'm with @pgimalac on this one. The encapsulation is broken the moment we add an API that is only used, because we are not using the package in the test the way is going to be used in production (outside of the test package)

For this particular case, the fields are private, so they could only be modified inside the package, so being able to set them in the test seems less convoluted that the `.WithX()` pattern in this case 
created_at: 2025-05-13T14:58:23Z
author_association: CONTRIBUTOR
diff_hunk: @@ -640,26 +633,42 @@ func (c *Check) fetchAllDeviceLabels() error {
 	return c.fetchAllDeviceLabelsFromBlkid()
 }
 
-// Factory creates a new check factory
-func Factory() option.Option[func() check.Check] {
-	return option.New(newCheck)
+// WithClock sets a custom clock on the Check and returns the updated Check.
+func (c *Check) WithClock(clock clock.Clock) *Check {
path: pkg/collector/corechecks/system/disk/diskv2/disk.go
user: login: jose-manuel-almaza
body: Moved WithX methods from public API to some helpers into the `diskv2` package only available in tests.
This is a good solution after some research and combines the best of both worlds.
created_at: 2025-05-13T17:43:21Z
author_association: CONTRIBUTOR
diff_hunk: @@ -640,26 +633,42 @@ func (c *Check) fetchAllDeviceLabels() error {
 	return c.fetchAllDeviceLabelsFromBlkid()
 }
 
-// Factory creates a new check factory
-func Factory() option.Option[func() check.Check] {
-	return option.New(newCheck)
+// WithClock sets a custom clock on the Check and returns the updated Check.
+func (c *Check) WithClock(clock clock.Clock) *Check {
path: pkg/collector/corechecks/system/disk/diskv2/disk.go
user: login: GustavoCaso
body: Great middle ground 🤝
created_at: 2025-05-14T07:38:53Z
author_association: CONTRIBUTOR

PR comments:
user: login: datadog-datadog-prod-us1[bot]
created_at: 2025-05-12T17:57:35Z
body: # Datadog Summary

<b>✅&nbsp;Code Quality</b>&nbsp;&nbsp;&nbsp;&nbsp;<b>✅&nbsp;Code Security</b>&nbsp;&nbsp;&nbsp;&nbsp;<b>✅&nbsp;Dependencies</b>



---
Was this helpful? Give us [feedback](https://dd.enterprise.slack.com/archives/C01FA7FASUR)!

author_association: CONTRIBUTOR
user: login: agent-platform-auto-pr[bot]
created_at: 2025-05-12T18:53:20Z
body: ## Uncompressed package size comparison

Comparison with [ancestor](https://github.com/DataDog/datadog-agent/commit/7cead801a9edc41b052650cab4a58401600a6c4b) `7cead801a9edc41b052650cab4a58401600a6c4b`
<details open>
<summary> Size reduction summary </summary>

|package|diff|status|size|ancestor|threshold|
|--|--|--|--|--|--|
|datadog-iot-agent-x86_64-rpm|-0.00MB|✅|60.65MB|60.65MB|0.50MB|
|datadog-iot-agent-x86_64-suse|-0.00MB|✅|60.65MB|60.65MB|0.50MB|
|datadog-iot-agent-aarch64-rpm|-0.00MB|✅|57.94MB|57.94MB|0.50MB|

</details>


<details>
  <summary> Diff per package </summary>

|package|diff|status|size|ancestor|threshold|
|--|--|--|--|--|--|
|datadog-agent-x86_64-rpm|0.00MB|✅|782.18MB|782.18MB|0.50MB|
|datadog-agent-x86_64-suse|0.00MB|✅|782.18MB|782.18MB|0.50MB|
|datadog-agent-amd64-deb|0.00MB|✅|773.23MB|773.23MB|0.50MB|
|datadog-agent-aarch64-rpm|0.00MB|✅|771.94MB|771.94MB|0.50MB|
|datadog-agent-arm64-deb|0.00MB|✅|763.02MB|763.02MB|0.50MB|
|datadog-dogstatsd-amd64-deb|0.00MB|✅|31.20MB|31.20MB|0.50MB|
|datadog-dogstatsd-x86_64-rpm|0.00MB|✅|31.28MB|31.28MB|0.50MB|
|datadog-dogstatsd-x86_64-suse|0.00MB|✅|31.28MB|31.28MB|0.50MB|
|datadog-dogstatsd-arm64-deb|0.00MB|✅|30.03MB|30.03MB|0.50MB|
|datadog-heroku-agent-amd64-deb|0.00MB|✅|377.90MB|377.90MB|0.50MB|
|datadog-iot-agent-amd64-deb|0.00MB|✅|60.57MB|60.57MB|0.50MB|
|datadog-iot-agent-arm64-deb|0.00MB|✅|57.86MB|57.86MB|0.50MB|

</details>

## Decision
✅ Passed



author_association: CONTRIBUTOR
user: login: cit-pr-commenter[bot]
created_at: 2025-05-12T19:54:11Z
body: ## Regression Detector

# Regression Detector Results

[Metrics dashboard](https://app.datadoghq.com/dashboard/ykh-ua8-vcu/SMP-Regression-Detector-Metrics?fromUser=true&refresh_mode=paused&tpl_var_run-id%5B0%5D=9d458d89-725f-4752-b687-e809656d0553&view=spans&from_ts=1747159929000&to_ts=1747160529000&live=false)  
[Target profiles](https://app.datadoghq.com/profiling/explorer?query=env%3Asingle-machine-performance%20service%3Adatadog-agent%20job_id%3A9d458d89-725f-4752-b687-e809656d0553&agg_m=count&agg_m_source=base&agg_t=count&fromUser=false&viz=stream&start=1747152729000&end=1747164129000&paused=true)  
Run ID: 9d458d89-725f-4752-b687-e809656d0553

Baseline: 7cead801a9edc41b052650cab4a58401600a6c4b
Comparison: a93d758dcadb5e01c3e3d46b099d176ef9976aec
[Diff](7cead801a9edc41b052650cab4a58401600a6c4b...a93d758dcadb5e01c3e3d46b099d176ef9976aec)


## Optimization Goals: ✅ No significant changes detected


<details>
<summary><h2>
Fine details of change detection per experiment
</h2></summary>

| perf | experiment                                   | goal               | Δ mean % | Δ mean % CI    | trials | links                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
|------|----------------------------------------------|--------------------|----------|----------------|--------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ➖   | quality_gate_logs                            | % cpu utilization  | +1.81    | [-0.99, +4.61] | 1      | [Logs](https://app.datadoghq.com/logs?query=experiment%3Aquality_gate_logs%20job_id%3A9d458d89-725f-4752-b687-e809656d0553&agg_m=count&agg_m_source=base&agg_q=%40span.url&agg_q_source=base&agg_t=count&fromUser=true&index=single-machine-performance-target-logs&messageDisplay=inline&refresh_mode=paused&storage=hot&stream_sort=time%2Cdesc&top_n=100&top_o=top&viz=stream&x_missing=true&from_ts=1747152729000&to_ts=1747164129000&live=false) [bounds checks dashboard](https://app.datadoghq.com/dashboard/vz3-jd5-bdi?fromUser=true&refresh_mode=paused&tpl_var_experiment%5B0%5D=quality_gate_logs&tpl_var_job_id%5B0%5D=9d458d89-725f-4752-b687-e809656d0553&view=spans&from_ts=1747159929000&to_ts=1747160529000&live=false)                           |
| ➖   | tcp_syslog_to_blackhole                      | ingress throughput | +1.17    | [+1.12, +1.23] | 1      | [Logs](https://app.datadoghq.com/logs?query=experiment%3Atcp_syslog_to_blackhole%20job_id%3A9d458d89-725f-4752-b687-e809656d0553&agg_m=count&agg_m_source=base&agg_q=%40span.url&agg_q_source=base&agg_t=count&fromUser=true&index=single-machine-performance-target-logs&messageDisplay=inline&refresh_mode=paused&storage=hot&stream_sort=time%2Cdesc&top_n=100&top_o=top&viz=stream&x_missing=true&from_ts=1747152729000&to_ts=1747164129000&live=false)                                                                                                                                                                                                                                                                                                         |
| ➖   | quality_gate_idle                            | memory utilization | +0.63    | [+0.57, +0.69] | 1      | [Logs](https://app.datadoghq.com/logs?query=experiment%3Aquality_gate_idle%20job_id%3A9d458d89-725f-4752-b687-e809656d0553&agg_m=count&agg_m_source=base&agg_q=%40span.url&agg_q_source=base&agg_t=count&fromUser=true&index=single-machine-performance-target-logs&messageDisplay=inline&refresh_mode=paused&storage=hot&stream_sort=time%2Cdesc&top_n=100&top_o=top&viz=stream&x_missing=true&from_ts=1747152729000&to_ts=1747164129000&live=false) [bounds checks dashboard](https://app.datadoghq.com/dashboard/vz3-jd5-bdi?fromUser=true&refresh_mode=paused&tpl_var_experiment%5B0%5D=quality_gate_idle&tpl_var_job_id%5B0%5D=9d458d89-725f-4752-b687-e809656d0553&view=spans&from_ts=1747159929000&to_ts=1747160529000&live=false)                           |
| ➖   | docker_containers_memory                     | memory utilization | +0.57    | [+0.47, +0.66] | 1      | [Logs](https://app.datadoghq.com/logs?query=experiment%3Adocker_containers_memory%20job_id%3A9d458d89-725f-4752-b687-e809656d0553&agg_m=count&agg_m_source=base&agg_q=%40span.url&agg_q_source=base&agg_t=count&fromUser=true&index=single-machine-performance-target-logs&messageDisplay=inline&refresh_mode=paused&storage=hot&stream_sort=time%2Cdesc&top_n=100&top_o=top&viz=stream&x_missing=true&from_ts=1747152729000&to_ts=1747164129000&live=false)                                                                                                                                                                                                                                                                                                        |
| ➖   | uds_dogstatsd_20mb_12k_contexts_20_senders   | memory utilization | +0.26    | [+0.22, +0.30] | 1      | [Logs](https://app.datadoghq.com/logs?query=experiment%3Auds_dogstatsd_20mb_12k_contexts_20_senders%20job_id%3A9d458d89-725f-4752-b687-e809656d0553&agg_m=count&agg_m_source=base&agg_q=%40span.url&agg_q_source=base&agg_t=count&fromUser=true&index=single-machine-performance-target-logs&messageDisplay=inline&refresh_mode=paused&storage=hot&stream_sort=time%2Cdesc&top_n=100&top_o=top&viz=stream&x_missing=true&from_ts=1747152729000&to_ts=1747164129000&live=false)                                                                                                                                                                                                                                                                                      |
| ➖   | otlp_ingest_metrics                          | memory utilization | +0.12    | [-0.02, +0.27] | 1      | [Logs](https://app.datadoghq.com/logs?query=experiment%3Aotlp_ingest_metrics%20job_id%3A9d458d89-725f-4752-b687-e809656d0553&agg_m=count&agg_m_source=base&agg_q=%40span.url&agg_q_source=base&agg_t=count&fromUser=true&index=single-machine-performance-target-logs&messageDisplay=inline&refresh_mode=paused&storage=hot&stream_sort=time%2Cdesc&top_n=100&top_o=top&viz=stream&x_missing=true&from_ts=1747152729000&to_ts=1747164129000&live=false)                                                                                                                                                                                                                                                                                                             |
| ➖   | file_to_blackhole_0ms_latency                | egress throughput  | +0.07    | [-0.60, +0.75] | 1      | [Logs](https://app.datadoghq.com/logs?query=experiment%3Afile_to_blackhole_0ms_latency%20job_id%3A9d458d89-725f-4752-b687-e809656d0553&agg_m=count&agg_m_source=base&agg_q=%40span.url&agg_q_source=base&agg_t=count&fromUser=true&index=single-machine-performance-target-logs&messageDisplay=inline&refresh_mode=paused&storage=hot&stream_sort=time%2Cdesc&top_n=100&top_o=top&viz=stream&x_missing=true&from_ts=1747152729000&to_ts=1747164129000&live=false)                                                                                                                                                                                                                                                                                                   |
| ➖   | docker_containers_cpu                        | % cpu utilization  | +0.07    | [-3.74, +3.87] | 1      | [Logs](https://app.datadoghq.com/logs?query=experiment%3Adocker_containers_cpu%20job_id%3A9d458d89-725f-4752-b687-e809656d0553&agg_m=count&agg_m_source=base&agg_q=%40span.url&agg_q_source=base&agg_t=count&fromUser=true&index=single-machine-performance-target-logs&messageDisplay=inline&refresh_mode=paused&storage=hot&stream_sort=time%2Cdesc&top_n=100&top_o=top&viz=stream&x_missing=true&from_ts=1747152729000&to_ts=1747164129000&live=false)                                                                                                                                                                                                                                                                                                           |
| ➖   | file_to_blackhole_500ms_latency              | egress throughput  | +0.03    | [-0.62, +0.68] | 1      | [Logs](https://app.datadoghq.com/logs?query=experiment%3Afile_to_blackhole_500ms_latency%20job_id%3A9d458d89-725f-4752-b687-e809656d0553&agg_m=count&agg_m_source=base&agg_q=%40span.url&agg_q_source=base&agg_t=count&fromUser=true&index=single-machine-performance-target-logs&messageDisplay=inline&refresh_mode=paused&storage=hot&stream_sort=time%2Cdesc&top_n=100&top_o=top&viz=stream&x_missing=true&from_ts=1747152729000&to_ts=1747164129000&live=false)                                                                                                                                                                                                                                                                                                 |
| ➖   | file_to_blackhole_0ms_latency_http2          | egress throughput  | +0.02    | [-0.67, +0.71] | 1      | [Logs](https://app.datadoghq.com/logs?query=experiment%3Afile_to_blackhole_0ms_latency_http2%20job_id%3A9d458d89-725f-4752-b687-e809656d0553&agg_m=count&agg_m_source=base&agg_q=%40span.url&agg_q_source=base&agg_t=count&fromUser=true&index=single-machine-performance-target-logs&messageDisplay=inline&refresh_mode=paused&storage=hot&stream_sort=time%2Cdesc&top_n=100&top_o=top&viz=stream&x_missing=true&from_ts=1747152729000&to_ts=1747164129000&live=false)                                                                                                                                                                                                                                                                                             |
| ➖   | file_to_blackhole_1000ms_latency             | egress throughput  | +0.02    | [-0.63, +0.66] | 1      | [Logs](https://app.datadoghq.com/logs?query=experiment%3Afile_to_blackhole_1000ms_latency%20job_id%3A9d458d89-725f-4752-b687-e809656d0553&agg_m=count&agg_m_source=base&agg_q=%40span.url&agg_q_source=base&agg_t=count&fromUser=true&index=single-machine-performance-target-logs&messageDisplay=inline&refresh_mode=paused&storage=hot&stream_sort=time%2Cdesc&top_n=100&top_o=top&viz=stream&x_missing=true&from_ts=1747152729000&to_ts=1747164129000&live=false)                                                                                                                                                                                                                                                                                                |
| ➖   | uds_dogstatsd_to_api                         | ingress throughput | +0.01    | [-0.29, +0.31] | 1      | [Logs](https://app.datadoghq.com/logs?query=experiment%3Auds_dogstatsd_to_api%20job_id%3A9d458d89-725f-4752-b687-e809656d0553&agg_m=count&agg_m_source=base&agg_q=%40span.url&agg_q_source=base&agg_t=count&fromUser=true&index=single-machine-performance-target-logs&messageDisplay=inline&refresh_mode=paused&storage=hot&stream_sort=time%2Cdesc&top_n=100&top_o=top&viz=stream&x_missing=true&from_ts=1747152729000&to_ts=1747164129000&live=false)                                                                                                                                                                                                                                                                                                            |
| ➖   | tcp_dd_logs_filter_exclude                   | ingress throughput | -0.00    | [-0.02, +0.02] | 1      | [Logs](https://app.datadoghq.com/logs?query=experiment%3Atcp_dd_logs_filter_exclude%20job_id%3A9d458d89-725f-4752-b687-e809656d0553&agg_m=count&agg_m_source=base&agg_q=%40span.url&agg_q_source=base&agg_t=count&fromUser=true&index=single-machine-performance-target-logs&messageDisplay=inline&refresh_mode=paused&storage=hot&stream_sort=time%2Cdesc&top_n=100&top_o=top&viz=stream&x_missing=true&from_ts=1747152729000&to_ts=1747164129000&live=false)                                                                                                                                                                                                                                                                                                      |
| ➖   | file_to_blackhole_1000ms_latency_linear_load | egress throughput  | -0.02    | [-0.24, +0.21] | 1      | [Logs](https://app.datadoghq.com/logs?query=experiment%3Afile_to_blackhole_1000ms_latency_linear_load%20job_id%3A9d458d89-725f-4752-b687-e809656d0553&agg_m=count&agg_m_source=base&agg_q=%40span.url&agg_q_source=base&agg_t=count&fromUser=true&index=single-machine-performance-target-logs&messageDisplay=inline&refresh_mode=paused&storage=hot&stream_sort=time%2Cdesc&top_n=100&top_o=top&viz=stream&x_missing=true&from_ts=1747152729000&to_ts=1747164129000&live=false)                                                                                                                                                                                                                                                                                    |
| ➖   | file_to_blackhole_100ms_latency              | egress throughput  | -0.04    | [-0.65, +0.58] | 1      | [Logs](https://app.datadoghq.com/logs?query=experiment%3Afile_to_blackhole_100ms_latency%20job_id%3A9d458d89-725f-4752-b687-e809656d0553&agg_m=count&agg_m_source=base&agg_q=%40span.url&agg_q_source=base&agg_t=count&fromUser=true&index=single-machine-performance-target-logs&messageDisplay=inline&refresh_mode=paused&storage=hot&stream_sort=time%2Cdesc&top_n=100&top_o=top&viz=stream&x_missing=true&from_ts=1747152729000&to_ts=1747164129000&live=false)                                                                                                                                                                                                                                                                                                 |
| ➖   | file_to_blackhole_0ms_latency_http1          | egress throughput  | -0.09    | [-0.72, +0.53] | 1      | [Logs](https://app.datadoghq.com/logs?query=experiment%3Afile_to_blackhole_0ms_latency_http1%20job_id%3A9d458d89-725f-4752-b687-e809656d0553&agg_m=count&agg_m_source=base&agg_q=%40span.url&agg_q_source=base&agg_t=count&fromUser=true&index=single-machine-performance-target-logs&messageDisplay=inline&refresh_mode=paused&storage=hot&stream_sort=time%2Cdesc&top_n=100&top_o=top&viz=stream&x_missing=true&from_ts=1747152729000&to_ts=1747164129000&live=false)                                                                                                                                                                                                                                                                                             |
| ➖   | file_to_blackhole_300ms_latency              | egress throughput  | -0.10    | [-0.74, +0.53] | 1      | [Logs](https://app.datadoghq.com/logs?query=experiment%3Afile_to_blackhole_300ms_latency%20job_id%3A9d458d89-725f-4752-b687-e809656d0553&agg_m=count&agg_m_source=base&agg_q=%40span.url&agg_q_source=base&agg_t=count&fromUser=true&index=single-machine-performance-target-logs&messageDisplay=inline&refresh_mode=paused&storage=hot&stream_sort=time%2Cdesc&top_n=100&top_o=top&viz=stream&x_missing=true&from_ts=1747152729000&to_ts=1747164129000&live=false)                                                                                                                                                                                                                                                                                                 |
| ➖   | ddot_metrics                                 | memory utilization | -0.22    | [-0.34, -0.10] | 1      | [Logs](https://app.datadoghq.com/logs?query=experiment%3Addot_metrics%20job_id%3A9d458d89-725f-4752-b687-e809656d0553&agg_m=count&agg_m_source=base&agg_q=%40span.url&agg_q_source=base&agg_t=count&fromUser=true&index=single-machine-performance-target-logs&messageDisplay=inline&refresh_mode=paused&storage=hot&stream_sort=time%2Cdesc&top_n=100&top_o=top&viz=stream&x_missing=true&from_ts=1747152729000&to_ts=1747164129000&live=false)                                                                                                                                                                                                                                                                                                                    |
| ➖   | file_tree                                    | memory utilization | -0.25    | [-0.40, -0.10] | 1      | [Logs](https://app.datadoghq.com/logs?query=experiment%3Afile_tree%20job_id%3A9d458d89-725f-4752-b687-e809656d0553&agg_m=count&agg_m_source=base&agg_q=%40span.url&agg_q_source=base&agg_t=count&fromUser=true&index=single-machine-performance-target-logs&messageDisplay=inline&refresh_mode=paused&storage=hot&stream_sort=time%2Cdesc&top_n=100&top_o=top&viz=stream&x_missing=true&from_ts=1747152729000&to_ts=1747164129000&live=false)                                                                                                                                                                                                                                                                                                                       |
| ➖   | ddot_logs                                    | memory utilization | -0.35    | [-0.47, -0.22] | 1      | [Logs](https://app.datadoghq.com/logs?query=experiment%3Addot_logs%20job_id%3A9d458d89-725f-4752-b687-e809656d0553&agg_m=count&agg_m_source=base&agg_q=%40span.url&agg_q_source=base&agg_t=count&fromUser=true&index=single-machine-performance-target-logs&messageDisplay=inline&refresh_mode=paused&storage=hot&stream_sort=time%2Cdesc&top_n=100&top_o=top&viz=stream&x_missing=true&from_ts=1747152729000&to_ts=1747164129000&live=false)                                                                                                                                                                                                                                                                                                                       |
| ➖   | otlp_ingest_logs                             | memory utilization | -0.41    | [-0.53, -0.28] | 1      | [Logs](https://app.datadoghq.com/logs?query=experiment%3Aotlp_ingest_logs%20job_id%3A9d458d89-725f-4752-b687-e809656d0553&agg_m=count&agg_m_source=base&agg_q=%40span.url&agg_q_source=base&agg_t=count&fromUser=true&index=single-machine-performance-target-logs&messageDisplay=inline&refresh_mode=paused&storage=hot&stream_sort=time%2Cdesc&top_n=100&top_o=top&viz=stream&x_missing=true&from_ts=1747152729000&to_ts=1747164129000&live=false)                                                                                                                                                                                                                                                                                                                |
| ➖   | quality_gate_idle_all_features               | memory utilization | -0.42    | [-0.51, -0.32] | 1      | [Logs](https://app.datadoghq.com/logs?query=experiment%3Aquality_gate_idle_all_features%20job_id%3A9d458d89-725f-4752-b687-e809656d0553&agg_m=count&agg_m_source=base&agg_q=%40span.url&agg_q_source=base&agg_t=count&fromUser=true&index=single-machine-performance-target-logs&messageDisplay=inline&refresh_mode=paused&storage=hot&stream_sort=time%2Cdesc&top_n=100&top_o=top&viz=stream&x_missing=true&from_ts=1747152729000&to_ts=1747164129000&live=false) [bounds checks dashboard](https://app.datadoghq.com/dashboard/vz3-jd5-bdi?fromUser=true&refresh_mode=paused&tpl_var_experiment%5B0%5D=quality_gate_idle_all_features&tpl_var_job_id%5B0%5D=9d458d89-725f-4752-b687-e809656d0553&view=spans&from_ts=1747159929000&to_ts=1747160529000&live=false) |
| ➖   | uds_dogstatsd_to_api_cpu                     | % cpu utilization  | -0.74    | [-1.60, +0.12] | 1      | [Logs](https://app.datadoghq.com/logs?query=experiment%3Auds_dogstatsd_to_api_cpu%20job_id%3A9d458d89-725f-4752-b687-e809656d0553&agg_m=count&agg_m_source=base&agg_q=%40span.url&agg_q_source=base&agg_t=count&fromUser=true&index=single-machine-performance-target-logs&messageDisplay=inline&refresh_mode=paused&storage=hot&stream_sort=time%2Cdesc&top_n=100&top_o=top&viz=stream&x_missing=true&from_ts=1747152729000&to_ts=1747164129000&live=false)                                                                                                                                                                                                                                                                                                        |
</details>


<details>
<summary><h2>
Bounds Checks: ✅ Passed
</h2></summary>

| perf | experiment                                   | bounds_check_name  | replicates_passed | links                                                                                                                                                                                                                                                                                            |
|------|----------------------------------------------|--------------------|-------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ✅   | docker_containers_cpu                        | simple_check_run   | 10/10             |                                                                                                                                                                                                                                                                                                  |
| ✅   | docker_containers_memory                     | memory_usage       | 10/10             |                                                                                                                                                                                                                                                                                                  |
| ✅   | docker_containers_memory                     | simple_check_run   | 10/10             |                                                                                                                                                                                                                                                                                                  |
| ✅   | file_to_blackhole_0ms_latency                | lost_bytes         | 10/10             |                                                                                                                                                                                                                                                                                                  |
| ✅   | file_to_blackhole_0ms_latency                | memory_usage       | 10/10             |                                                                                                                                                                                                                                                                                                  |
| ✅   | file_to_blackhole_0ms_latency_http1          | lost_bytes         | 10/10             |                                                                                                                                                                                                                                                                                                  |
| ✅   | file_to_blackhole_0ms_latency_http1          | memory_usage       | 10/10             |                                                                                                                                                                                                                                                                                                  |
| ✅   | file_to_blackhole_0ms_latency_http2          | lost_bytes         | 10/10             |                                                                                                                                                                                                                                                                                                  |
| ✅   | file_to_blackhole_0ms_latency_http2          | memory_usage       | 10/10             |                                                                                                                                                                                                                                                                                                  |
| ✅   | file_to_blackhole_1000ms_latency             | memory_usage       | 10/10             |                                                                                                                                                                                                                                                                                                  |
| ✅   | file_to_blackhole_1000ms_latency_linear_load | memory_usage       | 10/10             |                                                                                                                                                                                                                                                                                                  |
| ✅   | file_to_blackhole_100ms_latency              | lost_bytes         | 10/10             |                                                                                                                                                                                                                                                                                                  |
| ✅   | file_to_blackhole_100ms_latency              | memory_usage       | 10/10             |                                                                                                                                                                                                                                                                                                  |
| ✅   | file_to_blackhole_300ms_latency              | lost_bytes         | 10/10             |                                                                                                                                                                                                                                                                                                  |
| ✅   | file_to_blackhole_300ms_latency              | memory_usage       | 10/10             |                                                                                                                                                                                                                                                                                                  |
| ✅   | file_to_blackhole_500ms_latency              | lost_bytes         | 10/10             |                                                                                                                                                                                                                                                                                                  |
| ✅   | file_to_blackhole_500ms_latency              | memory_usage       | 10/10             |                                                                                                                                                                                                                                                                                                  |
| ✅   | quality_gate_idle                            | intake_connections | 10/10             | [bounds checks dashboard](https://app.datadoghq.com/dashboard/vz3-jd5-bdi?fromUser=true&refresh_mode=paused&tpl_var_experiment%5B0%5D=quality_gate_idle&tpl_var_job_id%5B0%5D=9d458d89-725f-4752-b687-e809656d0553&view=spans&from_ts=1747159929000&to_ts=1747160529000&live=false)              |
| ✅   | quality_gate_idle                            | memory_usage       | 10/10             | [bounds checks dashboard](https://app.datadoghq.com/dashboard/vz3-jd5-bdi?fromUser=true&refresh_mode=paused&tpl_var_experiment%5B0%5D=quality_gate_idle&tpl_var_job_id%5B0%5D=9d458d89-725f-4752-b687-e809656d0553&view=spans&from_ts=1747159929000&to_ts=1747160529000&live=false)              |
| ✅   | quality_gate_idle_all_features               | intake_connections | 10/10             | [bounds checks dashboard](https://app.datadoghq.com/dashboard/vz3-jd5-bdi?fromUser=true&refresh_mode=paused&tpl_var_experiment%5B0%5D=quality_gate_idle_all_features&tpl_var_job_id%5B0%5D=9d458d89-725f-4752-b687-e809656d0553&view=spans&from_ts=1747159929000&to_ts=1747160529000&live=false) |
| ✅   | quality_gate_idle_all_features               | memory_usage       | 10/10             | [bounds checks dashboard](https://app.datadoghq.com/dashboard/vz3-jd5-bdi?fromUser=true&refresh_mode=paused&tpl_var_experiment%5B0%5D=quality_gate_idle_all_features&tpl_var_job_id%5B0%5D=9d458d89-725f-4752-b687-e809656d0553&view=spans&from_ts=1747159929000&to_ts=1747160529000&live=false) |
| ✅   | quality_gate_logs                            | intake_connections | 10/10             | [bounds checks dashboard](https://app.datadoghq.com/dashboard/vz3-jd5-bdi?fromUser=true&refresh_mode=paused&tpl_var_experiment%5B0%5D=quality_gate_logs&tpl_var_job_id%5B0%5D=9d458d89-725f-4752-b687-e809656d0553&view=spans&from_ts=1747159929000&to_ts=1747160529000&live=false)              |
| ✅   | quality_gate_logs                            | lost_bytes         | 10/10             | [bounds checks dashboard](https://app.datadoghq.com/dashboard/vz3-jd5-bdi?fromUser=true&refresh_mode=paused&tpl_var_experiment%5B0%5D=quality_gate_logs&tpl_var_job_id%5B0%5D=9d458d89-725f-4752-b687-e809656d0553&view=spans&from_ts=1747159929000&to_ts=1747160529000&live=false)              |
| ✅   | quality_gate_logs                            | memory_usage       | 10/10             | [bounds checks dashboard](https://app.datadoghq.com/dashboard/vz3-jd5-bdi?fromUser=true&refresh_mode=paused&tpl_var_experiment%5B0%5D=quality_gate_logs&tpl_var_job_id%5B0%5D=9d458d89-725f-4752-b687-e809656d0553&view=spans&from_ts=1747159929000&to_ts=1747160529000&live=false)              |
</details>


<details>
<summary><h2>
Explanation
</h2></summary>

**Confidence level:** 90.00%
**Effect size tolerance:** |Δ mean %| ≥ 5.00%

Performance changes are noted in the **perf** column of each table:

* ✅ = significantly better comparison variant performance
* ❌ = significantly worse comparison variant performance
* ➖ = no significant change in performance

A regression test is an A/B test of target performance in a repeatable rig, where "performance" is measured as "comparison variant minus baseline variant" for an optimization goal (e.g., ingress throughput). Due to intrinsic variability in measuring that goal, we can only estimate its mean value for each experiment; we report uncertainty in that value as a 90.00% confidence interval denoted "Δ mean % CI".

For each experiment, we decide whether a change in performance is a "regression" -- a change worth investigating further -- if all of the following criteria are true:

1. Its estimated |Δ mean %| ≥ 5.00%, indicating the change is big enough to merit a closer look.

2. Its 90.00% confidence interval "Δ mean % CI" does not contain zero, indicating that *if our statistical model is accurate*, there is at least a 90.00% chance there is a difference in performance between baseline and comparison variants.

3. Its configuration does not mark it "erratic".
</details>

## CI Pass/Fail Decision

✅ **Passed.** All Quality Gates passed.

- **quality_gate_idle_all_features**, bounds check **memory_usage**: 10/10 replicas passed. Gate passed.
- **quality_gate_idle_all_features**, bounds check **intake_connections**: 10/10 replicas passed. Gate passed.
- **quality_gate_logs**, bounds check **memory_usage**: 10/10 replicas passed. Gate passed.
- **quality_gate_logs**, bounds check **lost_bytes**: 10/10 replicas passed. Gate passed.
- **quality_gate_logs**, bounds check **intake_connections**: 10/10 replicas passed. Gate passed.
- **quality_gate_idle**, bounds check **memory_usage**: 10/10 replicas passed. Gate passed.
- **quality_gate_idle**, bounds check **intake_connections**: 10/10 replicas passed. Gate passed.
author_association: NONE
user: login: agent-platform-auto-pr[bot]
created_at: 2025-05-12T20:29:41Z
body: ## Static quality checks

✅ Please find below the results from static quality gates


<details>
<summary>Successful checks</summary>

### Info

|Result|Quality gate|On disk size|On disk size limit|On wire size|On wire size limit|
|----|----|----|----|----|----|
|✅|static_quality_gate_agent_deb_amd64|748.18 MiB|778.06 MiB|185.54 MiB|191.06 MiB|
|✅|static_quality_gate_agent_deb_amd64_fips|746.09 MiB|776.09 MiB|184.6 MiB|190.72 MiB|
|✅|static_quality_gate_agent_heroku_amd64|368.53 MiB|434.99 MiB|98.03 MiB|114.34 MiB|
|✅|static_quality_gate_agent_msi|969.24 MiB|978.45 MiB|146.83 MiB|151.65 MiB|
|✅|static_quality_gate_agent_rpm_amd64|748.23 MiB|778.06 MiB|186.33 MiB|193.42 MiB|
|✅|static_quality_gate_agent_rpm_amd64_fips|746.01 MiB|776.06 MiB|185.92 MiB|192.61 MiB|
|✅|static_quality_gate_agent_rpm_arm64|738.45 MiB|768.33 MiB|169.41 MiB|174.71 MiB|
|✅|static_quality_gate_agent_rpm_arm64_fips|736.51 MiB|766.55 MiB|168.31 MiB|173.92 MiB|
|✅|static_quality_gate_agent_suse_amd64|748.23 MiB|778.08 MiB|186.33 MiB|193.42 MiB|
|✅|static_quality_gate_agent_suse_amd64_fips|746.09 MiB|776.11 MiB|185.92 MiB|192.78 MiB|
|✅|static_quality_gate_agent_suse_arm64|738.45 MiB|768.31 MiB|169.41 MiB|174.71 MiB|
|✅|static_quality_gate_agent_suse_arm64_fips|736.53 MiB|766.5 MiB|168.31 MiB|173.92 MiB|
|✅|static_quality_gate_docker_agent_amd64|842.35 MiB|862.5 MiB|285.19 MiB|292.0 MiB|
|✅|static_quality_gate_docker_agent_arm64|855.74 MiB|876.0 MiB|272.03 MiB|278.3 MiB|
|✅|static_quality_gate_docker_agent_jmx_amd64|842.35 MiB|862.5 MiB|285.19 MiB|292.0 MiB|
|✅|static_quality_gate_docker_agent_jmx_arm64|855.74 MiB|876.63 MiB|272.03 MiB|278.4 MiB|
|✅|static_quality_gate_docker_agent_windows1809|842.35 MiB|862.5 MiB|285.19 MiB|292.0 MiB|
|✅|static_quality_gate_docker_agent_windows1809_core|842.35 MiB|862.5 MiB|285.19 MiB|292.0 MiB|
|✅|static_quality_gate_docker_agent_windows1809_core_jmx|842.35 MiB|862.5 MiB|285.19 MiB|292.0 MiB|
|✅|static_quality_gate_docker_agent_windows1809_jmx|842.35 MiB|862.5 MiB|285.19 MiB|292.0 MiB|
|✅|static_quality_gate_docker_agent_windows2022|842.35 MiB|862.5 MiB|285.19 MiB|292.0 MiB|
|✅|static_quality_gate_docker_agent_windows2022_core|842.35 MiB|862.5 MiB|285.19 MiB|292.0 MiB|
|✅|static_quality_gate_docker_agent_windows2022_core_jmx|842.35 MiB|862.5 MiB|285.19 MiB|292.0 MiB|
|✅|static_quality_gate_docker_agent_windows2022_jmx|842.35 MiB|862.5 MiB|285.19 MiB|292.0 MiB|
|✅|static_quality_gate_docker_cluster_agent_amd64|256.69 MiB|263.4 MiB|101.86 MiB|104.07 MiB|
|✅|static_quality_gate_docker_cluster_agent_arm64|272.7 MiB|279.38 MiB|96.8 MiB|98.95 MiB|
|✅|static_quality_gate_docker_cws_instrumentation_amd64|6.66 MiB|7.12 MiB|2.82 MiB|3.29 MiB|
|✅|static_quality_gate_docker_cws_instrumentation_arm64|6.44 MiB|6.92 MiB|2.6 MiB|3.07 MiB|
|✅|static_quality_gate_docker_dogstatsd_amd64|37.97 MiB|46.39 MiB|14.64 MiB|17.78 MiB|
|✅|static_quality_gate_docker_dogstatsd_arm64|36.9 MiB|45.05 MiB|13.73 MiB|16.65 MiB|
|✅|static_quality_gate_dogstatsd_deb_amd64|29.83 MiB|38.4 MiB|7.89 MiB|10.26 MiB|
|✅|static_quality_gate_dogstatsd_deb_arm64|28.71 MiB|36.98 MiB|6.87 MiB|8.96 MiB|
|✅|static_quality_gate_dogstatsd_rpm_amd64|29.83 MiB|38.4 MiB|7.9 MiB|10.27 MiB|
|✅|static_quality_gate_dogstatsd_suse_amd64|29.83 MiB|38.4 MiB|7.9 MiB|10.27 MiB|
|✅|static_quality_gate_iot_agent_deb_amd64|57.85 MiB|58.51 MiB|14.56 MiB|15.02 MiB|
|✅|static_quality_gate_iot_agent_deb_arm64|55.27 MiB|55.94 MiB|12.57 MiB|13.05 MiB|
|✅|static_quality_gate_iot_agent_deb_armhf|54.03 MiB|54.32 MiB|12.59 MiB|13.05 MiB|
|✅|static_quality_gate_iot_agent_rpm_amd64|57.85 MiB|58.51 MiB|14.58 MiB|15.04 MiB|
|✅|static_quality_gate_iot_agent_rpm_arm64|55.27 MiB|55.94 MiB|12.59 MiB|13.07 MiB|
|✅|static_quality_gate_iot_agent_suse_amd64|57.85 MiB|58.51 MiB|14.58 MiB|15.04 MiB|

</details>

author_association: CONTRIBUTOR
user: login: jose-manuel-almaza
created_at: 2025-05-13T14:49:49Z
body: > Left some comments. Could you also update the description to explain why the timings in the code change?

Done
author_association: CONTRIBUTOR
user: login: jose-manuel-almaza
created_at: 2025-05-13T20:49:10Z
body: /merge
author_association: CONTRIBUTOR
user: login: dd-devflow[bot]
created_at: 2025-05-13T20:49:13Z
body: <!-- "FeedbackWorkflowId":"7630a989-76c7-4f77-9851-cdc3d6bc3a51_36" -->
[View all feedbacks in Devflow UI.](https://mosaic.us1.ddbuild.io/devflow/logs/7630a989-76c7-4f77-9851-cdc3d6bc3a51_36)

`2025-05-13 20:49:13 UTC` :information_source: Start processing command `/merge`

---
`2025-05-13 20:49:17 UTC` :information_source: **MergeQueue:** pull request added to the queue

The expected merge time in `main` is approximately 1h (p90).

---
`2025-05-13 21:27:07 UTC` :information_source: **MergeQueue:** This merge request was merged

author_association: NONE