Documentation ¶
Index ¶
Constants ¶
const ( // DefaultMaxMetrics is the default maximum of metrics kept in memory // by the handler. DefaultMaxMetrics = 5000 // DefaultFlushInterval is the default interval to flush the metrics // to the OpenTelemetry destination. // // Metrics will be flushed to the destination when DefaultFlushInterval or // DefaultMaxMetrics are reached, whichever comes first. DefaultFlushInterval = 10 * time.Second )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface {
Handle(context.Context, *colmetricpb.ExportMetricsServiceRequest) error
}
type HTTPClient ¶
type HTTPClient struct {
// contains filtered or unexported fields
}
HTTPClient implements the Client interface and is used to export metrics to an OpenTelemetry Collector through the HTTP interface.
The current implementation is a fire and forget approach where we do not retry or buffer any failed-to-flush data on the client.
func NewHTTPClient ¶
func NewHTTPClient(endpoint string) *HTTPClient
func (*HTTPClient) Handle ¶
func (c *HTTPClient) Handle(ctx context.Context, request *colmetricpb.ExportMetricsServiceRequest) error
type Handler ¶
type Handler struct { Client Client Context context.Context FlushInterval time.Duration MaxMetrics int // contains filtered or unexported fields }
Status: Alpha. This Handler is still in heavy development phase.
Do not use in production.
Handler implements stats.Handler to be used to forward metrics to an OpenTelemetry destination. Usually an OpenTelemetry Collector.
With the current implementation this Handler is targeting a Prometheus based backend or any backend expecting cumulative values.
This Handler leverages a doubly linked list with a map to implement a ring buffer with a lookup to ensure a low memory usage.
func NewHandler ¶
NewHandler return an instance of Handler with the default client, flush interval and in-memory metrics limit.