func InstrumentLabels(r *http.Request, keys ...string) prometheus.Labels {
	ctx := r.Context()
	routeCtx := chi.RouteContext(ctx)

	pattern := routeCtx.RoutePattern()
	if pattern == "" {
		pattern = r.RequestURI
	}

	method := routeCtx.RouteMethod
	if method == "" {
		method = r.Method
	}

	labels := prometheus.Labels{
		"handler": pattern,
		"method":  method,
	}

	for _, key := range keys {
		value := ""

		switch key {
		case "id":
			value = middleware.GetReqID(ctx)
		case "code":
			status, ok := r.Context().Value(render.StatusCtxKey).(int)
			if !ok {
				status = 0
			}
			value = fmt.Sprintf("%v", status)
		}

		labels[key] = value
	}

	return labels
}
// InstrumentLabels returns the instrument labels
InstrumentLabels returns the instrument labels
// InstrumentLabels returns the instrument labels
func InstrumentLabels(r *http.Request, keys ...string) prometheus.Labels {
	ctx := r.Context()
	routeCtx := chi.RouteContext(ctx)
	pattern := routeCtx.RoutePattern()
	if pattern == "" {
		pattern = r.RequestURI
	}
	method := routeCtx.RouteMethod
	if method == "" {
		method = r.Method
	}
	labels := prometheus.Labels{
		"handler": pattern,
		"method":  method,
	}
	for _, key := range keys {
		value := ""
		switch key {
		case "id":
			value = middleware.GetReqID(ctx)
		case "code":
			status, ok := r.Context().Value(render.StatusCtxKey).(int)
			if !ok {
				status = 0
			}
			value = fmt.Sprintf("%v", status)
		}
		labels[key] = value
	}
	return labels
}
func InstrumentLabels ( r * http . Request , keys ... string ) prometheus . Labels { ctx := r . Context ( ) routeCtx := chi . RouteContext ( ctx ) pattern := routeCtx . RoutePattern ( ) if pattern == " " { pattern = r . RequestURI } method := routeCtx . RouteMethod if method == " " { method = r . Method } labels := prometheus . Labels { " " : pattern , " " : method , } for _ , key := range keys { value := " " switch key { case " " : value = middleware . GetReqID ( ctx ) case " " : status , ok := r . Context ( ) . Value ( render . StatusCtxKey ) . ( int ) if ! ok { status = 0 } value = fmt . Sprintf ( " " , status ) } labels [ key ] = value } return labels }
InstrumentLabels returns the instrument labels
InstrumentLabels returns the instrument labels