Skip to content

Commit fce80a0

Browse files
committed
refactor: using reflect.TypeFor
1 parent fcbc439 commit fce80a0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

internal/metrics/metrics.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ func Init(m any, factory Factory, globalTags map[string]string) error {
3535
factory = NullFactory
3636
}
3737

38-
counterPtrType := reflect.TypeOf((*Counter)(nil)).Elem()
39-
gaugePtrType := reflect.TypeOf((*Gauge)(nil)).Elem()
40-
timerPtrType := reflect.TypeOf((*Timer)(nil)).Elem()
41-
histogramPtrType := reflect.TypeOf((*Histogram)(nil)).Elem()
38+
counterPtrType := reflect.TypeFor[Counter]()
39+
gaugePtrType := reflect.TypeFor[Gauge]()
40+
timerPtrType := reflect.TypeFor[Timer]()
41+
histogramPtrType := reflect.TypeFor[Histogram]()
4242

4343
v := reflect.ValueOf(m).Elem()
4444
t := v.Type()

0 commit comments

Comments
 (0)