<commit_before>package thetis

import (
	"fmt"
	"net/http"

	"github.com/prometheus/client_golang/prometheus"
)

type httpMetric struct {
	collector *prometheus.CounterVec
}

func (h *httpMetric) GetCollector() prometheus.Collector {
	responses := prometheus.NewCounterVec(prometheus.CounterOpts{
		Name: "http_status",
		Help: "HTTP Status per request",
	}, []string{"code", "route", "method"},
	)
	/*histogram: = prometheus.NewHistogram(prometheus.HistogramOpts {
	    Name: "http_requests",
	    Help: "HTTP Requests status and size per route.",
	})*/
	h.collector = responses
	return responses
}

func (h *httpMetric) CreateHandler() http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		method := r.Method
		status := "0"
		if sw, ok := w.(*statusWriter); ok {
			status = fmt.Sprint(sw.status)
		}
		uri := r.RequestURI
		h.collector.WithLabelValues(status, uri, method).Inc()
	}
}<commit_msg>:construction: Ignoring the /metrics path<commit_after>package thetis

import (
	"fmt"
	"net/http"

	"github.com/prometheus/client_golang/prometheus"
)

type httpMetric struct {
	collector *prometheus.CounterVec
}

//GetCollector returns the default collector to be registered
//for the Handler
func (h *httpMetric) GetCollector() prometheus.Collector {
	responses := prometheus.NewCounterVec(prometheus.CounterOpts{
		Name: "http_status",
		Help: "HTTP Status per request",
	}, []string{"code", "route", "method"},
	)
	h.collector = responses
	return responses
}

func (h *httpMetric) CreateHandler() http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		uri := r.RequestURI
		//ignoring the metrics route by default
		if uri == "/metrics" {
			return
		}
		method := r.Method
		status := "0"
		if sw, ok := w.(*statusWriter); ok {
			status = fmt.Sprint(sw.status)
		}
		h.collector.WithLabelValues(status, uri, method).Inc()
	}
}
{'fraction_non_alphanumeric': 0.13706666666666667, 'fraction_numerical': 0.0010666666666666667, 'mean_word_length': 4.421965317919075, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6222870', 'n_tokens_mistral': 679, 'n_tokens_neox': 627, 'n_words': 153}