telemetry

package
v0.29.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 11, 2024 License: BSD-3-Clause Imports: 18 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountManagerMetrics added in v0.28.8

type AccountManagerMetrics struct {
	// contains filtered or unexported fields
}

AccountManagerMetrics represents all metrics related to the AccountManager

func NewAccountManagerMetrics added in v0.28.8

func NewAccountManagerMetrics(ctx context.Context, meter metric.Meter) (*AccountManagerMetrics, error)

NewAccountManagerMetrics creates an instance of AccountManagerMetrics

func (*AccountManagerMetrics) CountGetPeerNetworkMapDuration added in v0.28.8

func (metrics *AccountManagerMetrics) CountGetPeerNetworkMapDuration(duration time.Duration)

CountGetPeerNetworkMapDuration counts the duration of getting the peer network map

func (*AccountManagerMetrics) CountNetworkMapObjects added in v0.28.8

func (metrics *AccountManagerMetrics) CountNetworkMapObjects(count int64)

CountNetworkMapObjects counts the number of network map objects

func (*AccountManagerMetrics) CountUpdateAccountPeersDuration added in v0.28.8

func (metrics *AccountManagerMetrics) CountUpdateAccountPeersDuration(duration time.Duration)

CountUpdateAccountPeersDuration counts the duration of updating account peers

type AppMetrics

type AppMetrics interface {
	GetMeter() metric2.Meter
	Close() error
	Expose(ctx context.Context, port int, endpoint string) error
	IDPMetrics() *IDPMetrics
	HTTPMiddleware() *HTTPMiddleware
	GRPCMetrics() *GRPCMetrics
	StoreMetrics() *StoreMetrics
	UpdateChannelMetrics() *UpdateChannelMetrics
	AccountManagerMetrics() *AccountManagerMetrics
}

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

func NewGRPCMetrics(ctx context.Context, meter metric.Meter) (*GRPCMetrics, error)

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

func NewMetricsMiddleware(ctx context.Context, meter metric.Meter) (*HTTPMiddleware, error)

NewMetricsMiddleware creates a new HTTPMiddleware

func (*HTTPMiddleware) Handler

func (m *HTTPMiddleware) Handler(h http.Handler) http.Handler

Handler logs every request and response and adds the, to metrics.

type IDPMetrics

type IDPMetrics struct {
	// contains filtered or unexported fields
}

IDPMetrics is common IdP metrics

func NewIDPMetrics

func NewIDPMetrics(ctx context.Context, meter metric.Meter) (*IDPMetrics, error)

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(ctx context.Context, port int, endpoint string) error
	IDPMetricsFunc               func() *IDPMetrics
	HTTPMiddlewareFunc           func() *HTTPMiddleware
	GRPCMetricsFunc              func() *GRPCMetrics
	StoreMetricsFunc             func() *StoreMetrics
	UpdateChannelMetricsFunc     func() *UpdateChannelMetrics
	AddAccountManagerMetricsFunc func() *AccountManagerMetrics
}

MockAppMetrics mocks the AppMetrics interface

func (*MockAppMetrics) AccountManagerMetrics added in v0.28.8

func (mock *MockAppMetrics) AccountManagerMetrics() *AccountManagerMetrics

AccountManagerMetrics mocks the MockAppMetrics function of the AccountManagerMetrics 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(ctx context.Context, 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

func NewStoreMetrics(ctx context.Context, meter metric.Meter) (*StoreMetrics, error)

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL