utils

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRemoteWriteServer

func NewRemoteWriteServer(receivedChan chan RemoteWriteRequest, status int) *httptest.Server

NewRemoteWriteServer creates and starts a new httpserver.Server that can handle remote write request. When a request is handled, the received entries are written to receivedChan, and status is responded.

func ToLabelSet

func ToLabelSet(in map[string]string) model.LabelSet

ToLabelSet converts a map of strings to a prometheus LabelSet.

Types

type RemoteWriteRequest

type RemoteWriteRequest struct {
	TenantID string
	Request  logproto.PushRequest
}

RemoteWriteRequest wraps the received logs remote write request that is received.

type SyncSlice

type SyncSlice[T any] struct {
	// contains filtered or unexported fields
}

SyncSlice is a concurrent slice implementation.

func NewSyncSlice

func NewSyncSlice[T any]() *SyncSlice[T]

func (*SyncSlice[T]) Append

func (ss *SyncSlice[T]) Append(el T)

func (*SyncSlice[T]) DoneIterate

func (ss *SyncSlice[T]) DoneIterate()

DoneIterate releases the internal read-lock.

func (*SyncSlice[T]) Length

func (ss *SyncSlice[T]) Length() int

func (*SyncSlice[T]) Reset

func (ss *SyncSlice[T]) Reset()

Reset resets the slice to have zero elements. If used during benchmarks, this will probably make new appends more efficient since the underlying array has more room.

func (*SyncSlice[T]) StartIterate

func (ss *SyncSlice[T]) StartIterate() []T

StartIterate returns the internal slice, after read-locking the internal lock. Once the iteration is finished, DoneIterate should be called to release the lock.

Jump to

Keyboard shortcuts

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