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
- func (metrics *GRPCMetrics) UpdateChannelQueueLength(length int)
- type HTTPMiddleware
- type IDPMetrics
- func (idpMetrics *IDPMetrics) CountAuthenticate()
- func (idpMetrics *IDPMetrics) CountCreateUser()
- func (idpMetrics *IDPMetrics) CountDeleteUser()
- 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
- func (mock *MockAppMetrics) UpdateChannelMetrics() *UpdateChannelMetrics
- type StoreMetrics
- type UpdateChannelMetrics
- func (metrics *UpdateChannelMetrics) CountCloseChannelDuration(duration time.Duration)
- func (metrics *UpdateChannelMetrics) CountCloseChannelsDuration(duration time.Duration, channels int)
- func (metrics *UpdateChannelMetrics) CountCreateChannelDuration(duration time.Duration, closed bool)
- func (metrics *UpdateChannelMetrics) CountGetAllConnectedPeersDuration(duration time.Duration, peers int)
- func (metrics *UpdateChannelMetrics) CountHasChannelDuration(duration time.Duration)
- func (metrics *UpdateChannelMetrics) CountSendUpdateDuration(duration time.Duration, found, dropped bool)
- 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 UpdateChannelMetrics() *UpdateChannelMetrics }
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.
func (*GRPCMetrics) UpdateChannelQueueLength ¶ added in v0.23.5
func (metrics *GRPCMetrics) UpdateChannelQueueLength(length int)
UpdateChannelQueueLength update the histogram that keep distribution of the update messages channel queue
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) CountDeleteUser ¶ added in v0.23.2
func (idpMetrics *IDPMetrics) CountDeleteUser()
CountDeleteUser ...
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 UpdateChannelMetricsFunc func() *UpdateChannelMetrics }
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
func (*MockAppMetrics) UpdateChannelMetrics ¶ added in v0.24.3
func (mock *MockAppMetrics) UpdateChannelMetrics() *UpdateChannelMetrics
UpdateChannelMetrics mocks the MockAppMetrics function of the UpdateChannelMetrics interface
type StoreMetrics ¶ added in v0.20.3
type StoreMetrics struct {
// contains filtered or unexported fields
}
StoreMetrics represents all metrics related to the Store
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 UpdateChannelMetrics ¶ added in v0.24.3
type UpdateChannelMetrics struct {
// contains filtered or unexported fields
}
UpdateChannelMetrics represents all metrics related to the UpdateChannel
func NewUpdateChannelMetrics ¶ added in v0.24.3
func NewUpdateChannelMetrics(ctx context.Context, meter metric.Meter) (*UpdateChannelMetrics, error)
NewUpdateChannelMetrics creates an instance of UpdateChannel
func (*UpdateChannelMetrics) CountCloseChannelDuration ¶ added in v0.24.3
func (metrics *UpdateChannelMetrics) CountCloseChannelDuration(duration time.Duration)
CountCloseChannelDuration counts the duration of the CloseChannel method
func (*UpdateChannelMetrics) CountCloseChannelsDuration ¶ added in v0.24.3
func (metrics *UpdateChannelMetrics) CountCloseChannelsDuration(duration time.Duration, channels int)
CountCloseChannelsDuration counts the duration of the CloseChannels method and the number of channels have been closed
func (*UpdateChannelMetrics) CountCreateChannelDuration ¶ added in v0.24.3
func (metrics *UpdateChannelMetrics) CountCreateChannelDuration(duration time.Duration, closed bool)
CountCreateChannelDuration counts the duration of the CreateChannel method, closed indicates if existing channel was closed before creation of a new one
func (*UpdateChannelMetrics) CountGetAllConnectedPeersDuration ¶ added in v0.24.3
func (metrics *UpdateChannelMetrics) CountGetAllConnectedPeersDuration(duration time.Duration, peers int)
CountGetAllConnectedPeersDuration counts the duration of the GetAllConnectedPeers method and the number of peers have been returned
func (*UpdateChannelMetrics) CountHasChannelDuration ¶ added in v0.24.4
func (metrics *UpdateChannelMetrics) CountHasChannelDuration(duration time.Duration)
CountHasChannelDuration counts the duration of the HasChannel method
func (*UpdateChannelMetrics) CountSendUpdateDuration ¶ added in v0.24.3
func (metrics *UpdateChannelMetrics) CountSendUpdateDuration(duration time.Duration, found, dropped bool)
CountSendUpdateDuration counts the duration of the SendUpdate method found indicates if peer had channel, dropped indicates if the message was dropped due channel buffer overload
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