receivermock

package
v0.0.0-...-2b985cc Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Labels

type Labels map[string]string

Labels represent a key value mapping of labels names and their values. An empty label value indicates that we're interested in a label being present but we don't care about it's value.

func (Labels) Match

func (labels Labels) Match(label, value string) bool

func (Labels) MatchAll

func (labels Labels) MatchAll(requested Labels) bool

MatchAll matches returns whether all the requested labels are present and (if a corresponding value has been provided) that all values match matching is done via regex if the value is a valid regex, otherwise via strict equality the special value "" matches everything for historical reasons

func (Labels) MatchRegex

func (labels Labels) MatchRegex(label string, re *regexp.Regexp) bool

type LogsCountResponse

type LogsCountResponse struct {
	Count uint
}

type MetadataFilters

type MetadataFilters map[string]string

type MetricCounts

type MetricCounts map[string]int

Mapping of metric names to the number of times the metric was observed

type MetricSample

type MetricSample struct {
	Metric    string  `json:"metric,omitempty"`
	Value     float64 `json:"value,omitempty"`
	Labels    Labels  `json:"labels,omitempty"`
	Timestamp uint64  `json:"timestamp,omitempty"`
}

type MetricsSamplesByTime

type MetricsSamplesByTime []MetricSample

func (MetricsSamplesByTime) Len

func (m MetricsSamplesByTime) Len() int

func (MetricsSamplesByTime) Less

func (m MetricsSamplesByTime) Less(i, j int) bool

func (MetricsSamplesByTime) Swap

func (m MetricsSamplesByTime) Swap(i, j int)

type ReceiverMockClient

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

A HTTP client for the receiver-mock API

func NewClient

func NewClient(t *testing.T, baseUrl url.URL) *ReceiverMockClient

func NewClientWithK8sTunnel

func NewClientWithK8sTunnel(
	ctx context.Context,
	t *testing.T,
) (*ReceiverMockClient, func())

NewClientWithK8sTunnel creates a client for receiver-mock. It return the client itself and a tunnel teardown func which should be called by the caller when they're done with it.

func (*ReceiverMockClient) GetLogsCount

func (client *ReceiverMockClient) GetLogsCount(t *testing.T, metadataFilters MetadataFilters) (uint, error)

GetLogsCount returns the numbers of logs received by receiver-mock that pass the provided metadata filter. Note that in the filter semantics, empty strings match any value

func (*ReceiverMockClient) GetMetricCounts

func (client *ReceiverMockClient) GetMetricCounts(t *testing.T) (MetricCounts, error)

GetMetricCounts returns the number of times each metric was received by receiver-mock

func (*ReceiverMockClient) GetMetricsSamples

func (client *ReceiverMockClient) GetMetricsSamples(
	metadataFilters MetadataFilters,
) ([]MetricSample, error)

GetMetricSamples returns metric samples received by receiver-mock that pass the provided metadata filter. Note that in the filter semantics, empty strings match any value

func (*ReceiverMockClient) GetSpansCount

func (client *ReceiverMockClient) GetSpansCount(t *testing.T, metadataFilters MetadataFilters) (uint, error)

func (*ReceiverMockClient) GetTracesCounts

func (client *ReceiverMockClient) GetTracesCounts(t *testing.T, metadataFilters MetadataFilters) ([]uint, error)

type Span

type Span struct {
	Name         string  `json:"name,omitempty"`
	Id           SpanId  `json:"id,omitempty"`
	TraceId      TraceId `json:"trace_id,omitempty"`
	ParentSpanId SpanId  `json:"parent_span_id,omitempty"`
	Labels       Labels  `json:"attributes,omitempty"`
}

type SpanId

type SpanId string

type TraceId

type TraceId string

Jump to

Keyboard shortcuts

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