Documentation ¶
Index ¶
- func EmitWithContext(ev Event, ctx context.Context)
- func EmitWithCredentials(ev Event, creds authenticator.Credentials)
- func GetStatusCounters() (total, errors uint64)
- func NewMeteringMiddleware(next http.Handler, metering Metering, source, kind string, ...) http.Handler
- func NewMeteringMiddlewareFunc(metering Metering, source, kind string) func(http.Handler) http.Handler
- func NewMeteringMiddlewareFuncWithOptions(metering Metering, source, kind string, ...) func(http.Handler) http.Handler
- func Register(name string, factory FactoryFunc)
- func SetDefaultMeter(m Metering)
- func WaitToFlush()
- type Event
- type FactoryFunc
- type Metering
- type MeteringMiddleware
- type MeteringResponseWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EmitWithContext ¶
func EmitWithCredentials ¶
func EmitWithCredentials(ev Event, creds authenticator.Credentials)
func GetStatusCounters ¶
func GetStatusCounters() (total, errors uint64)
func NewMeteringMiddleware ¶
func Register ¶
func Register(name string, factory FactoryFunc)
func SetDefaultMeter ¶
func SetDefaultMeter(m Metering)
func WaitToFlush ¶
func WaitToFlush()
Types ¶
type Event ¶
type Event struct { Source string `json:"source"` Kind string `json:"kind"` Method string `json:"method"` RequestsCount int64 `json:"requests_count,omitempty"` ResponsesCount int64 `json:"responses_count,omitempty"` IngressBytes int64 `json:"ingress_bytes,omitempty"` EgressBytes int64 `json:"egress_bytes,omitempty"` IdleTime int64 `json:"idle_time,omitempty"` RateLimitHitCount int64 `json:"rate_limit_hit_count,omitempty"` }
Event represents a metering event that needs to be recorded
type FactoryFunc ¶
type Metering ¶
type Metering interface { EmitWithContext(ev Event, ctx context.Context) EmitWithCredentials(ev Event, creds authenticator.Credentials) GetStatusCounters() (total, errors uint64) WaitToFlush() }
type MeteringMiddleware ¶
type MeteringMiddleware struct {
// contains filtered or unexported fields
}
func (*MeteringMiddleware) ServeHTTP ¶
func (m *MeteringMiddleware) ServeHTTP(w http.ResponseWriter, r *http.Request)
type MeteringResponseWriter ¶
type MeteringResponseWriter struct { http.ResponseWriter // contains filtered or unexported fields }
Click to show internal directories.
Click to hide internal directories.