metrics

package
v2.0.7 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2022 License: MIT Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrServerIsNotSet = fmt.Errorf("traking object is not set")
)

Functions

func UnaryClientInterceptor

func UnaryClientInterceptor() func(
	ctx context.Context, method string, req, reply interface{},
	cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption,
) error

func UnaryServerInterceptor

func UnaryServerInterceptor() func(
	ctx context.Context,
	req interface{},
	info *grpc.UnaryServerInfo,
	handler grpc.UnaryHandler,
) (interface{}, error)

Types

type HTTPStatusResponseWriter

type HTTPStatusResponseWriter struct {
	http.ResponseWriter
	Status int

	Response []byte
}

func NewHTTPStatusResponseWriter

func NewHTTPStatusResponseWriter(in http.ResponseWriter) *HTTPStatusResponseWriter

func (*HTTPStatusResponseWriter) Write

func (r *HTTPStatusResponseWriter) Write(in []byte) (int, error)

func (*HTTPStatusResponseWriter) WriteHeader

func (r *HTTPStatusResponseWriter) WriteHeader(statusCode int)

type HTTPTracker

type HTTPTracker interface {
	MetricTracker

	SetPathRetriever(PathRetriever)

	// server mw
	NewHTTPMiddlewareWithOption() func(next http.Handler) http.Handler

	// client mw
	Do(c httpClient, req *http.Request) (*http.Response, error)
}

func NewHTTPMetric

func NewHTTPMetric(pr PathRetriever) HTTPTracker

type MetricTracker

type MetricTracker interface {
	SetUp() error
}

func NewDatabaseTracker

func NewDatabaseTracker(db *sql.DB) MetricTracker

func NewGrpcClientTracker

func NewGrpcClientTracker() MetricTracker

func NewGrpcTracker

func NewGrpcTracker(server *grpc.Server) MetricTracker

type PathRetriever

type PathRetriever interface {
	GetPath(req *http.Request) string
}

func DefaultHTTPPathRetriever

func DefaultHTTPPathRetriever() PathRetriever

type Reader

type Reader interface {
	AddReaderTopicsInUse() Reader
	RmReaderTopicsInUse() Reader
	AddReaderTopicFatalError(topic string, code int) Reader
	AddReaderTopicProcessError(topic string) Reader
	AddReaderTopicReadEvents(topic string, num int) Reader
	AddReaderTopicCommitEvents(topic string, num int) Reader
	AddReaderTopicDecodeEvents(topic string, num int) Reader
	AddReaderTopicSkippedEvents(topic string, num int) Reader
	AddReaderTopicErrorEvents(topic string, num int) Reader
	AddReaderTopicHandlingTime(topic string, duration time.Duration) Reader

	AddGarbageRecords(num int) Reader
}

func NewCollectorMetricsReader

func NewCollectorMetricsReader() Reader

Jump to

Keyboard shortcuts

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