mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-03-31 23:06:36 +00:00
mi: make timeout configurable for build functions (#2377)
This commit is contained in:
@@ -20,6 +20,7 @@ package mscluster
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/prometheus-community/windows_exporter/internal/mi"
|
||||
"github.com/prometheus-community/windows_exporter/internal/types"
|
||||
@@ -76,16 +77,16 @@ func (c *Collector) buildSharedVolumes() error {
|
||||
)
|
||||
|
||||
var dst []msClusterDiskPartition
|
||||
if err := c.miSession.Query(&dst, mi.NamespaceRootMSCluster, c.sharedVolumesMIQuery); err != nil {
|
||||
if err := c.miSession.Query(&dst, mi.NamespaceRootMSCluster, c.sharedVolumesMIQuery, 0); err != nil {
|
||||
return fmt.Errorf("WMI query failed: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Collector) collectSharedVolumes(ch chan<- prometheus.Metric) error {
|
||||
func (c *Collector) collectSharedVolumes(ch chan<- prometheus.Metric, maxScrapeDuration time.Duration) error {
|
||||
var dst []msClusterDiskPartition
|
||||
if err := c.miSession.Query(&dst, mi.NamespaceRootMSCluster, c.sharedVolumesMIQuery); err != nil {
|
||||
if err := c.miSession.Query(&dst, mi.NamespaceRootMSCluster, c.sharedVolumesMIQuery, maxScrapeDuration); err != nil {
|
||||
return fmt.Errorf("WMI query failed: %w", err)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user