Documentation ¶
Index ¶
- Constants
- func Zero[T any]() T
- type BasicAuth
- type Callback
- type CallbackHook
- type CategoryStats
- type ConnectionConfig
- type Data
- type DataHandle
- type Datum
- type FileFormat
- type FileStorage
- type Mailbox
- type Marshaller
- type MetadataDatum
- type MetricDatum
- type NetworkClient
- type NetworkStats
- type PrometheusMarshaller
- type PrometheusSerializer
- type Serializer
- type SerializerConfig
- type SerializerStats
- type SyncMailbox
- type Type
- type Unmarshaller
Constants ¶
const AlloyFileVersionV1 = FileFormat("alloy.metrics.queue.v1")
const AlloyFileVersionV2 = FileFormat("alloy.metrics.queue.v2")
const PrometheusMetadataV1 = Type("prometheus.metadata.v1")
PrometheusMetadataV1 corresponds to prompb.MetricMetadata byte format.
const PrometheusMetricV1 = Type("prometheus.metric.v1")
PrometheusMetricV1 corresponds to prompb.TimeSeries byte format.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CallbackHook ¶
type CategoryStats ¶
type ConnectionConfig ¶
type ConnectionConfig struct { // URL is the URL of the Prometheus server. URL string // BasicAuth holds the username and password for basic HTTP authentication. BasicAuth *BasicAuth // BearerToken is the bearer token for the Prometheus server. BearerToken string // UserAgent is the User-Agent header sent to the Prometheus server. UserAgent string // Timeout specifies the duration for which the connection will wait for a response before timing out. Timeout time.Duration // RetryBackoff is the duration between retries when a network request fails. // The next retry will happen after RetryBackoff + (RetryBackoff * attempt number). RetryBackoff time.Duration // MaxRetryAttempts specifies the maximum number of times a request will be retried // if it fails. The next retry will happen after RetryBackoff + (RetryBackoff * attempt number). // If this is set to 0, no retries are attempted. MaxRetryAttempts uint // BatchCount is the number of time series to batch together before sending to the network. BatchCount int // FlushInterval specifies the duration between each flush of the network // buffer. If no data is available, the buffer is not flushed. FlushInterval time.Duration // ExternalLabels specifies the external labels to be added to all samples // sent to the Prometheus server. ExternalLabels map[string]string // Connections is the number of concurrent connections to use for sending data. Connections uint // TLSCert is the PEM-encoded certificate string for TLS client authentication TLSCert string // TLSKey is the PEM-encoded private key string for TLS client authentication TLSKey string // TLSCACert is the PEM-encoded CA certificate string for server verification TLSCACert string // InsecureSkipVerify controls whether the client verifies the server's certificate chain and host name InsecureSkipVerify bool // UseRoundRobin UseRoundRobin bool }
ConnectionConfig holds configuration details for network connections. It includes various options such as authentication, timeouts, retry policies, batching, and connection management settings.
func (ConnectionConfig) Equals ¶
func (cc ConnectionConfig) Equals(bb ConnectionConfig) bool
func (ConnectionConfig) ToPrometheusConfig ¶
func (cc ConnectionConfig) ToPrometheusConfig() config.HTTPClientConfig
ToPrometheusConfig converts a ConnectionConfig to a config.HTTPClientConfig
type DataHandle ¶
type Datum ¶
type Datum interface { // Bytes represents the underlying data and should only be used in conjuction with the type. Bytes() []byte Type() Type FileFormat() FileFormat // Free: datums are often pooled and this should be called when the datum is no longer needed. Free() }
Datum represent one item of data.
type FileFormat ¶
type FileFormat string
type FileStorage ¶
type Mailbox ¶
type Mailbox[T any] struct { // contains filtered or unexported fields }
Mailbox is a backwards compatible implemention of the actor mailbox. It uses chann underneath the hood that mimics the behavior of actor mailboxes.
type Marshaller ¶
type Marshaller interface { // Marshal handler passes in the buffer to be written. The buffer is only valid for the lifecycle of the function call. // Metadata is passed via the map and should be encoded into the underlying storage. The same keys and values should be returned // on Deserialize. Marshal(handle func(map[string]string, []byte) error) error }
Marshaller provides the ability to write for a given schema defined by the FileFormat. These are NOT threadsafe.
type MetadataDatum ¶
type MetricDatum ¶
type NetworkClient ¶
type NetworkClient interface { Start(ctx context.Context) Stop() // SendSeries will block if the network caches are full. SendSeries(ctx context.Context, d MetricDatum) error // SendMetadata will block if the network caches are full. SendMetadata(ctx context.Context, d MetadataDatum) error // UpdateConfig is a synchronous call and will only return once the config // is applied or an error occurs. UpdateConfig(ctx context.Context, cfg ConnectionConfig) (bool, error) }
type NetworkStats ¶
type NetworkStats struct { Series CategoryStats Histogram CategoryStats Metadata CategoryStats SendDuration time.Duration NewestTimestampSeconds int64 SeriesBytes int MetadataBytes int }
func (NetworkStats) Total429 ¶
func (ns NetworkStats) Total429() int
func (NetworkStats) Total5XX ¶
func (ns NetworkStats) Total5XX() int
func (NetworkStats) TotalFailed ¶
func (ns NetworkStats) TotalFailed() int
func (NetworkStats) TotalRetried ¶
func (ns NetworkStats) TotalRetried() int
func (NetworkStats) TotalSent ¶
func (ns NetworkStats) TotalSent() int
type PrometheusMarshaller ¶
type PrometheusMarshaller interface { Marshaller // AddPrometheusMetric adds a metric to the list of metrics. External Labels are passed in and added to the raw byte representation. // They are not added to lbls since that array may not be owned by the caller. Metric labels will override external labels. AddPrometheusMetric(ts int64, value float64, lbls labels.Labels, h *histogram.Histogram, fh *histogram.FloatHistogram, externalLabels map[string]string) error AddPrometheusMetadata(name string, unit string, help string, pType string) error }
type PrometheusSerializer ¶
type PrometheusSerializer interface { Serializer SendMetric(ctx context.Context, l labels.Labels, t int64, v float64, h *histogram.Histogram, fh *histogram.FloatHistogram, externalLabels map[string]string) error SendMetadata(ctx context.Context, name string, unit string, help string, pType string) error }
type Serializer ¶
type Serializer interface { Start(ctx context.Context) error Stop() UpdateConfig(ctx context.Context, cfg SerializerConfig) (bool, error) }
Serializer handles converting a set of signals into a binary representation to be written to storage.
type SerializerConfig ¶
type SerializerStats ¶
type SyncMailbox ¶
type SyncMailbox[T, R any] struct { // contains filtered or unexported fields }
SyncMailbox is used to synchronously send data, and wait for it to process before returning.
func NewSyncMailbox ¶
func NewSyncMailbox[T, R any](opts ...actor.MailboxOption) *SyncMailbox[T, R]
func (*SyncMailbox[T, R]) ReceiveC ¶
func (sm *SyncMailbox[T, R]) ReceiveC() <-chan *Callback[T, R]
func (*SyncMailbox[T, R]) Send ¶
func (sm *SyncMailbox[T, R]) Send(ctx gocontext.Context, value T) (R, error)
func (*SyncMailbox[T, R]) Start ¶
func (sm *SyncMailbox[T, R]) Start()
func (*SyncMailbox[T, R]) Stop ¶
func (sm *SyncMailbox[T, R]) Stop()
type Unmarshaller ¶
type Unmarshaller interface { // Unmarshal is called to create a list of datums. // Metadata will be passed via the map. // The buffer passed in is SAFE for reuse/unsafe strings. Unmarshal(map[string]string, []byte) (items []Datum, err error) }
Unmarshaller allows reading of a given FileFormat.