receivertest

package module
v0.118.0 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2025 License: Apache-2.0 Imports: 23 Imported by: 14

Documentation

Index

Constants

View Source
const UniqueIDAttrName = "test_id"

UniqueIDAttrName is the attribute name that is used in log records/spans/datapoints as the unique identifier.

Variables

This section is empty.

Functions

func CheckConsumeContract

func CheckConsumeContract(params CheckConsumeContractParams)

CheckConsumeContract checks the contract between the receiver and its next consumer. For the contract description see ../doc.go. The checker will detect violations of contract on different scenarios: on success, on permanent and non-permanent errors and mix of error types.

func CreateExponentialHistogramMetricWithID

func CreateExponentialHistogramMetricWithID(id UniqueIDAttrVal) pmetric.Metrics

func CreateGaugeMetricWithID

func CreateGaugeMetricWithID(id UniqueIDAttrVal) pmetric.Metrics

func CreateHistogramMetricWithID

func CreateHistogramMetricWithID(id UniqueIDAttrVal) pmetric.Metrics

func CreateOneLogWithID

func CreateOneLogWithID(id UniqueIDAttrVal) plog.Logs

func CreateOneSpanWithID

func CreateOneSpanWithID(id UniqueIDAttrVal) ptrace.Traces

func CreateSumMetricWithID

func CreateSumMetricWithID(id UniqueIDAttrVal) pmetric.Metrics

func CreateSummaryMetricWithID

func CreateSummaryMetricWithID(id UniqueIDAttrVal) pmetric.Metrics

func NewNopFactory

func NewNopFactory() receiver.Factory

NewNopFactory returns a receiver.Factory that constructs nop receivers supporting all data types.

func NewNopSettings

func NewNopSettings() receiver.Settings

NewNopSettings returns a new nop settings for Create*Receiver functions.

Types

type CheckConsumeContractParams

type CheckConsumeContractParams struct {
	T *testing.T
	// Factory that allows to create a receiver.
	Factory receiver.Factory
	Signal  pipeline.Signal
	// Config of the receiver to use.
	Config component.Config
	// Generator that can send data to the receiver.
	Generator Generator
	// GenerateCount specifies the number of times to call the generator.Generate()
	// for each test scenario.
	GenerateCount int
}

type Generator

type Generator interface {
	// Start the generator and prepare to generate. Will be followed by calls to Generate().
	// Start() may be called again after Stop() is called to begin a new test scenario.
	Start()

	// Stop generating. There will be no more calls to Generate() until Start() is called again.
	Stop()

	// Generate must generate and send at least one data element (span, log record or metric data point)
	// to the receiver and return a copy of generated element ids.
	// The generated data must contain uniquely identifiable elements, each with a
	// different value of attribute named UniqueIDAttrName.
	// CreateOneLogWithID() can be used a helper to create such logs.
	// May be called concurrently from multiple goroutines.
	Generate() []UniqueIDAttrVal
}

type UniqueIDAttrVal

type UniqueIDAttrVal string

UniqueIDAttrVal is the value type of the UniqueIDAttrName.

Jump to

Keyboard shortcuts

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