metrics

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2021 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 MetricsReader

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

	AddGarbageRecords(num int) MetricsReader
}

func NewCollectorMetricsReader

func NewCollectorMetricsReader() MetricsReader

type PathRetriever

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

func DefaultHTTPPathRetriever

func DefaultHTTPPathRetriever() PathRetriever

Jump to

Keyboard shortcuts

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