This PR is based on the need to exclude certain high-cardinality labels from the prometheus handler when collecting stats.
In our specific use case, we needed to filter out the http_req_path label (from github.com/segmentio/stats/httpstats) because many of our URIs contain UUIDs and the like.
Usage:
// create prometheus handler
handler := &prometheus.Handler{
TrimPrefix: "my_service_name",
}
// set HC tags
handler.IgnoreLabels([]string{"http_req_path"})
TL;DR:
This PR is based on the need to exclude certain high-cardinality labels from the prometheus handler when collecting stats.
In our specific use case, we needed to filter out the
http_req_path
label (from github.com/segmentio/stats/httpstats) because many of our URIs contain UUIDs and the like.Usage:
Benchmarks:
go test -bench BenchmarkHandleMetric -benchmem
current master
:this branch
: