Documentation ¶
Overview ¶
Package componenttest define types and functions used to help test packages implementing the component package interfaces.
Index ¶
- func CheckConfigStruct(config any) error
- func NewNopHost() component.Host
- func NewNopTelemetrySettings() component.TelemetrySettings
- type TestTelemetry
- func (tts *TestTelemetry) CheckExporterEnqueueFailedLogs(enqueueFailed int64) error
- func (tts *TestTelemetry) CheckExporterEnqueueFailedMetrics(enqueueFailed int64) error
- func (tts *TestTelemetry) CheckExporterEnqueueFailedTraces(enqueueFailed int64) error
- func (tts *TestTelemetry) CheckExporterLogs(sentLogRecords, sendFailedLogRecords int64) error
- func (tts *TestTelemetry) CheckExporterMetricGauge(metric string, val int64, extraAttrs ...attribute.KeyValue) error
- func (tts *TestTelemetry) CheckExporterMetrics(sentMetricsPoints, sendFailedMetricsPoints int64) error
- func (tts *TestTelemetry) CheckExporterTraces(sentSpans, sendFailedSpans int64) error
- func (tts *TestTelemetry) CheckReceiverLogs(protocol string, acceptedLogRecords, droppedLogRecords int64) error
- func (tts *TestTelemetry) CheckReceiverMetrics(protocol string, acceptedMetricPoints, droppedMetricPoints int64) error
- func (tts *TestTelemetry) CheckReceiverTraces(protocol string, acceptedSpans, droppedSpans int64) error
- func (tts *TestTelemetry) CheckScraperMetrics(receiver component.ID, scraper component.ID, ...) errordeprecated
- func (tts *TestTelemetry) Shutdown(ctx context.Context) error
- func (tts *TestTelemetry) TelemetrySettings() component.TelemetrySettings
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckConfigStruct ¶
CheckConfigStruct enforces that given configuration object is following the patterns used by the collector. This ensures consistency between different implementations of components and extensions. It is recommended for implementers of components to call this function on their tests passing the default configuration of the component factory.
func NewNopHost ¶
NewNopHost returns a new instance of nopHost with proper defaults for most tests.
func NewNopTelemetrySettings ¶
func NewNopTelemetrySettings() component.TelemetrySettings
NewNopTelemetrySettings returns a new nop telemetry settings for Create* functions.
Types ¶
type TestTelemetry ¶
type TestTelemetry struct { SpanRecorder *tracetest.SpanRecorder // contains filtered or unexported fields }
func SetupTelemetry ¶
func SetupTelemetry(id component.ID) (TestTelemetry, error)
SetupTelemetry sets up the testing environment to check the metrics recorded by receivers, producers, or exporters. The caller must pass the ID of the component being tested. The ID will be used by the CreateSettings and Check methods. The caller must defer a call to `Shutdown` on the returned TestTelemetry.
func (*TestTelemetry) CheckExporterEnqueueFailedLogs ¶
func (tts *TestTelemetry) CheckExporterEnqueueFailedLogs(enqueueFailed int64) error
func (*TestTelemetry) CheckExporterEnqueueFailedMetrics ¶
func (tts *TestTelemetry) CheckExporterEnqueueFailedMetrics(enqueueFailed int64) error
func (*TestTelemetry) CheckExporterEnqueueFailedTraces ¶
func (tts *TestTelemetry) CheckExporterEnqueueFailedTraces(enqueueFailed int64) error
func (*TestTelemetry) CheckExporterLogs ¶
func (tts *TestTelemetry) CheckExporterLogs(sentLogRecords, sendFailedLogRecords int64) error
CheckExporterLogs checks that for the current exported values for logs exporter metrics match given values.
func (*TestTelemetry) CheckExporterMetricGauge ¶
func (*TestTelemetry) CheckExporterMetrics ¶
func (tts *TestTelemetry) CheckExporterMetrics(sentMetricsPoints, sendFailedMetricsPoints int64) error
CheckExporterMetrics checks that for the current exported values for metrics exporter metrics match given values.
func (*TestTelemetry) CheckExporterTraces ¶
func (tts *TestTelemetry) CheckExporterTraces(sentSpans, sendFailedSpans int64) error
CheckExporterTraces checks that for the current exported values for trace exporter metrics match given values.
func (*TestTelemetry) CheckReceiverLogs ¶
func (tts *TestTelemetry) CheckReceiverLogs(protocol string, acceptedLogRecords, droppedLogRecords int64) error
CheckReceiverLogs checks that for the current exported values for logs receiver metrics match given values.
func (*TestTelemetry) CheckReceiverMetrics ¶
func (tts *TestTelemetry) CheckReceiverMetrics(protocol string, acceptedMetricPoints, droppedMetricPoints int64) error
CheckReceiverMetrics checks that for the current exported values for metrics receiver metrics match given values.
func (*TestTelemetry) CheckReceiverTraces ¶
func (tts *TestTelemetry) CheckReceiverTraces(protocol string, acceptedSpans, droppedSpans int64) error
CheckReceiverTraces checks that for the current exported values for trace receiver metrics match given values.
func (*TestTelemetry) CheckScraperMetrics
deprecated
func (tts *TestTelemetry) CheckScraperMetrics(receiver component.ID, scraper component.ID, scrapedMetricPoints, erroredMetricPoints int64) error
Deprecated: [v0.118.0] use metadatatest.AssertMetrics instead. CheckScraperMetrics checks that for the current exported values for metrics scraper metrics match given values.
func (*TestTelemetry) Shutdown ¶
func (tts *TestTelemetry) Shutdown(ctx context.Context) error
Shutdown unregisters any views and shuts down the SpanRecorder
func (*TestTelemetry) TelemetrySettings ¶
func (tts *TestTelemetry) TelemetrySettings() component.TelemetrySettings
TelemetrySettings returns the TestTelemetry's TelemetrySettings