metrics

package
v0.0.0-...-2803a0f Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const MaxPayloadSize = 1_000_000 // 1MB in bytes

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	SendMetric(name string, metricType string, value float64, additionalTags map[string]string) error
}

MetricsClient defines the interface for a metrics collector client.

type CollectorClient

type CollectorClient struct {
	APIClient     apiclient.ClientInterface
	APIEndpoint   string
	DefaultTags   map[string]string
	JobID         string
	MetricsBuffer []map[string]interface{}
	BufferMutex   sync.Mutex
	MaxBufferSize int
	FlushTicker   *time.Ticker
	// contains filtered or unexported fields
}

func New

Returns the instance of CollectorClient

func (*CollectorClient) SendMetric

func (c *CollectorClient) SendMetric(name string, metricType string, value float64, additionalTags map[string]string) error

func (*CollectorClient) StopBatchProcess

func (c *CollectorClient) StopBatchProcess()

Method to stop the batch process

type Handler

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

Handler records request metrics

func NewHandler

func NewHandler(client Client) *Handler

NewHandler returns a new MetricsHandler

func (*Handler) HandleRequest

func (h *Handler) HandleRequest(req *http.Request, ctx *goproxy.ProxyCtx) (*http.Request, *http.Response)

HandleRequest sets up a request for metrics

func (*Handler) HandleResponse

func (h *Handler) HandleResponse(rsp *http.Response, ctx *goproxy.ProxyCtx) *http.Response

HandleResponse records metrics for a response

Jump to

Keyboard shortcuts

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