mirror of
https://github.com/pomerium/pomerium.git
synced 2025-05-02 03:46:29 +02:00
- authorize: build whitelist from policy's URLs instead of strings. - internal/httputil: merged httputil and https package. - internal/config: merged config and policy packages. - internal/metrics: removed unused measure struct. - proxy/clients: refactor Addr fields to be urls. - proxy: remove unused extend deadline function. - proxy: use handler middleware for reverse proxy leg. - proxy: change the way websocket requests are made (route based). General improvements - omitted value from range in several cases where for loop could be simplified. - added error checking to many tests. - standardize url parsing. - remove unnecessary return statements. - proxy: add self-signed certificate support. #179 - proxy: add skip tls certificate verification. #179 - proxy: Refactor websocket support to be route based. #204
30 lines
940 B
Go
30 lines
940 B
Go
package metrics // import "github.com/pomerium/pomerium/internal/metrics"
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
ocProm "contrib.go.opencensus.io/exporter/prometheus"
|
|
prom "github.com/prometheus/client_golang/prometheus"
|
|
"go.opencensus.io/stats/view"
|
|
)
|
|
|
|
//NewPromHTTPListener creates a prometheus exporter on ListenAddr
|
|
func NewPromHTTPListener(ListenAddr string) error {
|
|
return http.ListenAndServe(ListenAddr, newPromHTTPHandler())
|
|
}
|
|
|
|
// newPromHTTPHandler creates a new prometheus exporter handler for /metrics
|
|
func newPromHTTPHandler() http.Handler {
|
|
// TODO this is a cheap way to get thorough go process
|
|
// stats. It will not work with additional exporters.
|
|
// It should turn into an FR to the OC framework
|
|
reg := prom.DefaultRegisterer.(*prom.Registry)
|
|
pe, _ := ocProm.NewExporter(ocProm.Options{
|
|
Namespace: "pomerium",
|
|
Registry: reg,
|
|
})
|
|
view.RegisterExporter(pe)
|
|
mux := http.NewServeMux()
|
|
mux.Handle("/metrics", pe)
|
|
return mux
|
|
}
|