package metricshandler

import (
	"github.com/gin-gonic/gin"
	"github.com/prometheus/client_golang/prometheus"
	"github.com/prometheus/client_golang/prometheus/promauto"
	ginprometheus "github.com/zsais/go-gin-prometheus"
)

func RegisterMetricsRoute(r *gin.Engine) {
	p := ginprometheus.NewPrometheus("billing2")
	p.ReqCntURLLabelMappingFn = func(c *gin.Context) string {
		return c.FullPath()
	}
	p.Use(r)
}

func RegisterMetricsRouteWithSub(r *gin.Engine, sub string) {
	p := ginprometheus.NewPrometheus(sub)
	p.ReqCntURLLabelMappingFn = func(c *gin.Context) string {
		return c.FullPath()
	}
	p.Use(r)
}

var (
	MeasureInput = promauto.NewCounter(
		prometheus.CounterOpts{
			Namespace: "dbaas",
			Subsystem: "billing",
			Name:      "test_counter",
		})

	MeasureLabeledInput = promauto.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: "dbaas",
			Subsystem: "billing",
			Name:      "test_labeled_counter",
		}, []string{
			"label1",
			"label2",
		})
)
