pdh/registry: fix panic when T is a struct type (#2366)

This commit is contained in:
Kayla Ondracek
2026-03-20 10:18:12 -08:00
committed by GitHub
parent 43a413a2bb
commit e8e775b711
2 changed files with 17 additions and 1 deletions

View File

@@ -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 {