Documentation ¶
Overview ¶
Package consumertest defines types and functions used to help test packages implementing the consumer package interfaces.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Consumer ¶ added in v0.24.0
type Consumer interface { // Capabilities to implement the base consumer functionality. Capabilities() consumer.Capabilities // ConsumeTraces to implement the consumer.Traces. ConsumeTraces(context.Context, pdata.Traces) error // ConsumeMetrics to implement the consumer.Metrics. ConsumeMetrics(context.Context, pdata.Metrics) error // ConsumeLogs to implement the consumer.Logs. ConsumeLogs(context.Context, pdata.Logs) error // contains filtered or unexported methods }
Consumer is a convenience interface that implements all consumer interfaces. It has a private function on it to forbid external users to implement it, to allow us to add extra functions without breaking compatibility because nobody else implements this interface.
type LogsSink ¶
type LogsSink struct {
// contains filtered or unexported fields
}
LogsSink is a consumer.Logs that acts like a sink that stores all logs and allows querying them for testing.
func (LogsSink) Capabilities ¶ added in v0.27.0
func (bc LogsSink) Capabilities() consumer.Capabilities
func (*LogsSink) ConsumeLogs ¶
ConsumeLogs stores logs to this sink.
func (*LogsSink) LogRecordsCount ¶
LogRecordsCount return the number of log records stored by this sink since last Reset.
type MetricsSink ¶
type MetricsSink struct {
// contains filtered or unexported fields
}
MetricsSink is a consumer.Metrics that acts like a sink that stores all metrics and allows querying them for testing.
func (*MetricsSink) AllMetrics ¶
func (sme *MetricsSink) AllMetrics() []pdata.Metrics
AllMetrics returns the metrics stored by this sink since last Reset.
func (MetricsSink) Capabilities ¶ added in v0.27.0
func (bc MetricsSink) Capabilities() consumer.Capabilities
func (*MetricsSink) ConsumeMetrics ¶
ConsumeMetrics stores metrics to this sink.
func (*MetricsSink) MetricsCount ¶
func (sme *MetricsSink) MetricsCount() int
MetricsCount return the number of metrics stored by this sink since last Reset.
type TracesSink ¶
type TracesSink struct {
// contains filtered or unexported fields
}
TracesSink is a consumer.Traces that acts like a sink that stores all traces and allows querying them for testing.
func (*TracesSink) AllTraces ¶
func (ste *TracesSink) AllTraces() []pdata.Traces
AllTraces returns the traces stored by this sink since last Reset.
func (TracesSink) Capabilities ¶ added in v0.27.0
func (bc TracesSink) Capabilities() consumer.Capabilities
func (*TracesSink) ConsumeTraces ¶
ConsumeTraces stores traces to this sink.
func (*TracesSink) SpansCount ¶
func (ste *TracesSink) SpansCount() int
SpansCount return the number of spans sent to this sink.