Skip to content

Commit c9c4dd4

Browse files
committed
hotfixes
1 parent 80a733d commit c9c4dd4

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

prometheus/promsafe/safe.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ func (h handler[T]) extractLabelsWithValues(labelProvider T) prometheus.Labels {
117117

118118
// extractLabelValues extracts label string values from a given labelProviderMarker (SingleLabelProvider or StructLabelProvider)
119119
func (h handler[T]) extractLabelValues(labelProvider T) []string {
120-
m := h.extractLabels(labelProvider)
120+
m := h.extractLabelsWithValues(labelProvider)
121121

122122
labelValues := make([]string, 0, len(m))
123123
for _, v := range m {

prometheus/promsafe/safe_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,18 +55,17 @@ func ExampleNewCounterVecT_multiple_labels_manual() {
5555
}
5656

5757
func ExampleNewCounterVecT_promauto_migrated() {
58-
5958
// Examples on how to migrate from promauto to promsafe
6059
// When promauto was using a custom factory with custom registry
6160

62-
var myReg = prometheus.NewRegistry()
61+
myReg := prometheus.NewRegistry()
6362

6463
counterOpts := prometheus.CounterOpts{
6564
Name: "items_counted_detailed_auto",
6665
}
6766

6867
// Old unsafe code
69-
//promauto.With(myReg).NewCounterVec(counterOpts, []string{"event_type", "source"})
68+
// promauto.With(myReg).NewCounterVec(counterOpts, []string{"event_type", "source"})
7069
// becomes:
7170

7271
type TicketReservationAttemptsLabels struct {

0 commit comments

Comments
 (0)