mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-03-12 21:46:35 +00:00
@@ -136,10 +136,10 @@ func NewWithFlags(app *kingpin.Application) *Collector {
|
||||
}
|
||||
|
||||
sb := strings.Builder{}
|
||||
sb.WriteString(fmt.Sprintf("%-32s %-32s\n", "Collector Name", "[PerfID] Perflib Object"))
|
||||
_, _ = fmt.Fprintf(&sb, "%-32s %-32s\n", "Collector Name", "[PerfID] Perflib Object")
|
||||
|
||||
for _, cname := range ConfigDefaults.CollectorsEnabled {
|
||||
sb.WriteString(fmt.Sprintf("%-32s %-32s\n", cname, collectorDesc[cname]))
|
||||
_, _ = fmt.Fprintf(&sb, "%-32s %-32s\n", cname, collectorDesc[cname])
|
||||
}
|
||||
|
||||
app.UsageTemplate(sb.String()).Usage(nil)
|
||||
|
||||
@@ -118,7 +118,7 @@ func TestDuplicateMetricEntry(t *testing.T) {
|
||||
Metric: []*dto.Metric{&metric1, &metric2},
|
||||
}
|
||||
|
||||
var duplicateFamily []*dto.MetricFamily
|
||||
duplicateFamily := make([]*dto.MetricFamily, 0, 1)
|
||||
|
||||
duplicateFamily = append(duplicateFamily, &duplicate)
|
||||
|
||||
@@ -146,7 +146,7 @@ func TestDuplicateMetricEntry(t *testing.T) {
|
||||
Metric: []*dto.Metric{&metric1, &metric3},
|
||||
}
|
||||
|
||||
duplicateFamily = []*dto.MetricFamily{}
|
||||
duplicateFamily = make([]*dto.MetricFamily, 0, 1)
|
||||
duplicateFamily = append(duplicateFamily, &differentLabels)
|
||||
|
||||
// Additional label on second metric should not be cause for duplicate detection
|
||||
@@ -171,7 +171,7 @@ func TestDuplicateMetricEntry(t *testing.T) {
|
||||
Type: &metric_type,
|
||||
Metric: []*dto.Metric{&metric3, &metric4},
|
||||
}
|
||||
duplicateFamily = []*dto.MetricFamily{}
|
||||
duplicateFamily = make([]*dto.MetricFamily, 0, 1)
|
||||
duplicateFamily = append(duplicateFamily, &differentValues)
|
||||
|
||||
// Additional label with different values metric should not be cause for duplicate detection
|
||||
|
||||
@@ -71,6 +71,7 @@ func GetDHCPV4ScopeStatistics() ([]DHCPV4Scope, error) {
|
||||
for _, subnet := range subnets {
|
||||
if err := (func() error {
|
||||
var subnetInfo *DHCP_SUBNET_INFO
|
||||
|
||||
err := dhcpGetSubnetInfo(subnet.SubnetAddress, &subnetInfo)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to get subnet info: %w", err)
|
||||
@@ -109,6 +110,7 @@ func GetDHCPV4ScopeStatistics() ([]DHCPV4Scope, error) {
|
||||
}
|
||||
|
||||
var subnetStatistics *DHCP_FAILOVER_STATISTICS
|
||||
|
||||
err = dhcpV4FailoverGetScopeStatistics(subnet.SubnetAddress, &subnetStatistics)
|
||||
|
||||
defer dhcpRpcFreeMemory(unsafe.Pointer(subnetStatistics))
|
||||
|
||||
@@ -142,7 +142,7 @@ func (c *ClassDecl) Properties() []*PropertyDecl {
|
||||
// Iterate over the number of properties and fetch each property
|
||||
for i := range c.NumProperties {
|
||||
// Get the property pointer at index i
|
||||
propertyPtr := *(**PropertyDecl)(unsafe.Pointer(uintptr(unsafe.Pointer(propertiesArray)) + uintptr(i)*unsafe.Sizeof(uintptr(0))))
|
||||
propertyPtr := *(**PropertyDecl)(unsafe.Add(unsafe.Pointer(propertiesArray), uintptr(i)*unsafe.Sizeof(uintptr(0))))
|
||||
|
||||
// Append the property to the slice
|
||||
properties[i] = propertyPtr
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//go:build windows
|
||||
|
||||
package testutils
|
||||
|
||||
|
||||
Reference in New Issue
Block a user