Documentation ¶
Index ¶
- type AppMetrics
- type GRPCMetrics
- func (grpcMetrics *GRPCMetrics) CountGetKeyRequest()
- func (grpcMetrics *GRPCMetrics) CountLoginRequest()
- func (grpcMetrics *GRPCMetrics) CountLoginRequestDuration(duration time.Duration)
- func (grpcMetrics *GRPCMetrics) CountSyncRequest()
- func (grpcMetrics *GRPCMetrics) CountSyncRequestDuration(duration time.Duration)
- func (grpcMetrics *GRPCMetrics) RegisterConnectedStreams(producer func() int64) error
- type HTTPMiddleware
- type IDPMetrics
- func (idpMetrics *IDPMetrics) CountAuthenticate()
- func (idpMetrics *IDPMetrics) CountCreateUser()
- func (idpMetrics *IDPMetrics) CountGetAccount()
- func (idpMetrics *IDPMetrics) CountGetAllAccounts()
- func (idpMetrics *IDPMetrics) CountGetUserByEmail()
- func (idpMetrics *IDPMetrics) CountGetUserDataByID()
- func (idpMetrics *IDPMetrics) CountRequestError()
- func (idpMetrics *IDPMetrics) CountRequestStatusError()
- func (idpMetrics *IDPMetrics) CountUpdateUserAppMetadata()
- type MockAppMetrics
- func (mock *MockAppMetrics) Close() error
- func (mock *MockAppMetrics) Expose(port int, endpoint string) error
- func (mock *MockAppMetrics) GRPCMetrics() *GRPCMetrics
- func (mock *MockAppMetrics) GetMeter() metric2.Meter
- func (mock *MockAppMetrics) HTTPMiddleware() *HTTPMiddleware
- func (mock *MockAppMetrics) IDPMetrics() *IDPMetrics
- func (mock *MockAppMetrics) StoreMetrics() *StoreMetrics
- type StoreMetrics
- type WrappedResponseWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppMetrics ¶
type AppMetrics interface { GetMeter() metric2.Meter Close() error Expose(port int, endpoint string) error IDPMetrics() *IDPMetrics HTTPMiddleware() *HTTPMiddleware GRPCMetrics() *GRPCMetrics StoreMetrics() *StoreMetrics }
AppMetrics is metrics interface
func NewDefaultAppMetrics ¶
func NewDefaultAppMetrics(ctx context.Context) (AppMetrics, error)
NewDefaultAppMetrics and expose them via defaultEndpoint on a given HTTP port
type GRPCMetrics ¶
type GRPCMetrics struct {
// contains filtered or unexported fields
}
GRPCMetrics are gRPC server metrics
func NewGRPCMetrics ¶
NewGRPCMetrics creates new GRPCMetrics struct and registers common metrics of the gRPC server
func (*GRPCMetrics) CountGetKeyRequest ¶
func (grpcMetrics *GRPCMetrics) CountGetKeyRequest()
CountGetKeyRequest counts the number of gRPC get server key requests coming to the gRPC API
func (*GRPCMetrics) CountLoginRequest ¶
func (grpcMetrics *GRPCMetrics) CountLoginRequest()
CountLoginRequest counts the number of gRPC login requests coming to the gRPC API
func (*GRPCMetrics) CountLoginRequestDuration ¶ added in v0.20.3
func (grpcMetrics *GRPCMetrics) CountLoginRequestDuration(duration time.Duration)
CountLoginRequestDuration counts the duration of the login gRPC requests
func (*GRPCMetrics) CountSyncRequest ¶
func (grpcMetrics *GRPCMetrics) CountSyncRequest()
CountSyncRequest counts the number of gRPC sync requests coming to the gRPC API
func (*GRPCMetrics) CountSyncRequestDuration ¶ added in v0.20.3
func (grpcMetrics *GRPCMetrics) CountSyncRequestDuration(duration time.Duration)
CountSyncRequestDuration counts the duration of the sync gRPC requests
func (*GRPCMetrics) RegisterConnectedStreams ¶
func (grpcMetrics *GRPCMetrics) RegisterConnectedStreams(producer func() int64) error
RegisterConnectedStreams registers a function that collects number of active streams and feeds it to the metrics gauge.
type HTTPMiddleware ¶
type HTTPMiddleware struct {
// contains filtered or unexported fields
}
HTTPMiddleware handler used to collect metrics of every request/response coming to the API. Also adds request tracing (logging).
func NewMetricsMiddleware ¶
NewMetricsMiddleware creates a new HTTPMiddleware
func (*HTTPMiddleware) AddHTTPRequestResponseCounter ¶
func (m *HTTPMiddleware) AddHTTPRequestResponseCounter(endpoint string, method string) error
AddHTTPRequestResponseCounter adds a new meter for an HTTP defaultEndpoint and Method (GET, POST, etc) Creates one request counter and multiple response counters (one per http response status code).
type IDPMetrics ¶
type IDPMetrics struct {
// contains filtered or unexported fields
}
IDPMetrics is common IdP metrics
func NewIDPMetrics ¶
NewIDPMetrics creates new IDPMetrics struct and registers common
func (*IDPMetrics) CountAuthenticate ¶
func (idpMetrics *IDPMetrics) CountAuthenticate()
CountAuthenticate ...
func (*IDPMetrics) CountCreateUser ¶
func (idpMetrics *IDPMetrics) CountCreateUser()
CountCreateUser ...
func (*IDPMetrics) CountGetAccount ¶
func (idpMetrics *IDPMetrics) CountGetAccount()
CountGetAccount ...
func (*IDPMetrics) CountGetAllAccounts ¶
func (idpMetrics *IDPMetrics) CountGetAllAccounts()
CountGetAllAccounts ...
func (*IDPMetrics) CountGetUserByEmail ¶
func (idpMetrics *IDPMetrics) CountGetUserByEmail()
CountGetUserByEmail ...
func (*IDPMetrics) CountGetUserDataByID ¶
func (idpMetrics *IDPMetrics) CountGetUserDataByID()
CountGetUserDataByID ...
func (*IDPMetrics) CountRequestError ¶
func (idpMetrics *IDPMetrics) CountRequestError()
CountRequestError counts number of error that happened when doing http request (httpClient.Do)
func (*IDPMetrics) CountRequestStatusError ¶
func (idpMetrics *IDPMetrics) CountRequestStatusError()
CountRequestStatusError counts number of responses that came from IdP with non success status code
func (*IDPMetrics) CountUpdateUserAppMetadata ¶
func (idpMetrics *IDPMetrics) CountUpdateUserAppMetadata()
CountUpdateUserAppMetadata ...
type MockAppMetrics ¶
type MockAppMetrics struct { GetMeterFunc func() metric2.Meter CloseFunc func() error ExposeFunc func(port int, endpoint string) error IDPMetricsFunc func() *IDPMetrics HTTPMiddlewareFunc func() *HTTPMiddleware GRPCMetricsFunc func() *GRPCMetrics StoreMetricsFunc func() *StoreMetrics }
MockAppMetrics mocks the AppMetrics interface
func (*MockAppMetrics) Close ¶
func (mock *MockAppMetrics) Close() error
Close mocks the Close function of the AppMetrics interface
func (*MockAppMetrics) Expose ¶
func (mock *MockAppMetrics) Expose(port int, endpoint string) error
Expose mocks the Expose function of the AppMetrics interface
func (*MockAppMetrics) GRPCMetrics ¶
func (mock *MockAppMetrics) GRPCMetrics() *GRPCMetrics
GRPCMetrics mocks the GRPCMetrics function of the IDPMetrics interface
func (*MockAppMetrics) GetMeter ¶
func (mock *MockAppMetrics) GetMeter() metric2.Meter
GetMeter mocks the GetMeter function of the AppMetrics interface
func (*MockAppMetrics) HTTPMiddleware ¶
func (mock *MockAppMetrics) HTTPMiddleware() *HTTPMiddleware
HTTPMiddleware mocks the HTTPMiddleware function of the IDPMetrics interface
func (*MockAppMetrics) IDPMetrics ¶
func (mock *MockAppMetrics) IDPMetrics() *IDPMetrics
IDPMetrics mocks the IDPMetrics function of the IDPMetrics interface
func (*MockAppMetrics) StoreMetrics ¶ added in v0.20.3
func (mock *MockAppMetrics) StoreMetrics() *StoreMetrics
StoreMetrics mocks the MockAppMetrics function of the StoreMetrics interface
type StoreMetrics ¶ added in v0.20.3
type StoreMetrics struct {
// contains filtered or unexported fields
}
StoreMetrics represents all metrics related to the FileStore
func NewStoreMetrics ¶ added in v0.20.3
NewStoreMetrics creates an instance of StoreMetrics
func (*StoreMetrics) CountGlobalLockAcquisitionDuration ¶ added in v0.20.3
func (metrics *StoreMetrics) CountGlobalLockAcquisitionDuration(duration time.Duration)
CountGlobalLockAcquisitionDuration counts the duration of the global lock acquisition
func (*StoreMetrics) CountPersistenceDuration ¶ added in v0.20.3
func (metrics *StoreMetrics) CountPersistenceDuration(duration time.Duration)
CountPersistenceDuration counts the duration of a store persistence operation
type WrappedResponseWriter ¶
type WrappedResponseWriter struct { http.ResponseWriter // contains filtered or unexported fields }
WrappedResponseWriter is a wrapper for http.ResponseWriter that allows the written HTTP status code to be captured for metrics reporting or logging purposes.
func WrapResponseWriter ¶
func WrapResponseWriter(w http.ResponseWriter) *WrappedResponseWriter
WrapResponseWriter wraps original http.ResponseWriter
func (*WrappedResponseWriter) Status ¶
func (rw *WrappedResponseWriter) Status() int
Status returns response status
func (*WrappedResponseWriter) WriteHeader ¶
func (rw *WrappedResponseWriter) WriteHeader(code int)
WriteHeader wraps http.ResponseWriter.WriteHeader method