Documentation
¶
Index ¶
- Variables
- func Caller(ctx context.Context) string
- func GetResponseBody(resp *http.Response) ([]byte, error)
- func Handler(w http.ResponseWriter, r *http.Request, user, pass string)
- func IncAuthFailure(integration string)
- func IncRateLimit(integration string)
- func IncRequest(integration string)
- func OnRequest(integration string, r *http.Request)
- func OnResponse(integration, caller string, r *http.Request, resp *http.Response)
- func RecordDuration(integration string, d time.Duration)
- func RecordStatus(integration string, status int)
- func Register(p Plugin)
- func Reset()
- func WithCaller(ctx context.Context, caller string) context.Context
- func WriteProm(w http.ResponseWriter)
- type Plugin
Constants ¶
This section is empty.
Variables ¶
var (
LastReloadTime = expvar.NewString("authtranslator_last_reload")
)
Functions ¶
func GetResponseBody ¶ added in v0.2.0
GetResponseBody returns the response body bytes and resets resp.Body so it can be read again. It closes the original body to allow connection reuse.
func Handler ¶
func Handler(w http.ResponseWriter, r *http.Request, user, pass string)
Handler writes Prometheus metrics to w enforcing optional basic auth.
func IncAuthFailure ¶
func IncAuthFailure(integration string)
IncAuthFailure increments the auth failure counter for the integration.
func IncRateLimit ¶
func IncRateLimit(integration string)
IncRateLimit increments the rate limit counter for the integration.
func IncRequest ¶
func IncRequest(integration string)
IncRequest increments the request counter for the integration.
func OnResponse ¶
OnResponse triggers all registered plugins for a completed response.
func RecordDuration ¶
RecordDuration records the upstream request duration.
func RecordStatus ¶
RecordStatus records the upstream status code for the integration.
func WithCaller ¶
WithCaller returns a new context with the caller ID stored.
func WriteProm ¶
func WriteProm(w http.ResponseWriter)
WriteProm emits all Prometheus metrics to w in text format.