diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..1230149 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" diff --git a/go.mod b/go.mod index 2c66b5c..7f478fb 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,6 @@ module github.com/chrissxMedia/redirector go 1.16 require ( - github.com/chrissxMedia/cm3.go v0.0.0-20230327023026-5b09b3e68183 + github.com/chrissxMedia/cm3.go v0.1.0 github.com/prometheus/client_golang v1.14.0 ) diff --git a/go.sum b/go.sum index b39b357..94d0087 100644 --- a/go.sum +++ b/go.sum @@ -48,6 +48,8 @@ github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cb github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/chrissxMedia/cm3.go v0.0.0-20230327023026-5b09b3e68183 h1:DRQfmnf1lS/K5wn+wrbTtSLJhyt6B9Pmcs4dQRD/1Ys= github.com/chrissxMedia/cm3.go v0.0.0-20230327023026-5b09b3e68183/go.mod h1:f7SWla9HMSV27sT1HLXvwp52PvQTZOeNpWhJiI22Apk= +github.com/chrissxMedia/cm3.go v0.1.0 h1:5lJswWWmy5EL6ErK4IoA62elnVfj+DmEXwmb/3hsXgo= +github.com/chrissxMedia/cm3.go v0.1.0/go.mod h1:Ic5ruwg6hNm+tOgUO7eJwrDXT1HJcV7FsIWnfuEt5SE= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= diff --git a/redirector.go b/redirector.go index bc829e6..612a829 100644 --- a/redirector.go +++ b/redirector.go @@ -9,7 +9,6 @@ import ( "github.com/chrissxMedia/cm3.go" "github.com/prometheus/client_golang/prometheus" - "github.com/prometheus/client_golang/prometheus/promhttp" ) //go:embed response.min.html @@ -26,9 +25,7 @@ func main() { Help: "Number of HTTP requests that contain the Host header.", }, []string{}) - prometheus.MustRegister(totalReqs) - prometheus.MustRegister(hostReqs) - http.Handle("/metrics", promhttp.Handler()) + cm3.HandleMetrics(totalReqs, hostReqs) cm3.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { totalReqs.WithLabelValues().Inc()