mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-03-26 04:16:36 +00:00
pdh/registry: fix panic when T is a struct type (#2366)
This commit is contained in:
@@ -53,7 +53,7 @@ func NewCollector[T any](object string, _ []string) (*Collector, error) {
|
||||
counters: make(map[string]Counter),
|
||||
}
|
||||
|
||||
valueType := reflect.TypeFor[T]().Elem()
|
||||
valueType := reflect.TypeFor[T]()
|
||||
|
||||
if f, ok := valueType.FieldByName("Name"); ok {
|
||||
if f.Type.Kind() == reflect.String {
|
||||
|
||||
Reference in New Issue
Block a user