Documentation
¶
Overview ¶
Package consumertest defines types and functions used to help test packages implementing the consumer package interfaces.
Index ¶
- type Consumer
- type LogsSink
- type MetricsSink
- func (sme *MetricsSink) AllMetrics() []pmetric.Metrics
- func (bc MetricsSink) Capabilities() consumer.Capabilities
- func (sme *MetricsSink) ConsumeMetrics(ctx context.Context, md pmetric.Metrics) error
- func (sme *MetricsSink) Contexts() []context.Context
- func (sme *MetricsSink) DataPointCount() int
- func (sme *MetricsSink) Reset()
- type ProfilesSink
- func (ste *ProfilesSink) AllProfiles() []pprofile.Profiles
- func (bc ProfilesSink) Capabilities() consumer.Capabilities
- func (ste *ProfilesSink) ConsumeProfiles(ctx context.Context, td pprofile.Profiles) error
- func (ste *ProfilesSink) Contexts() []context.Context
- func (ste *ProfilesSink) ProfileCount() int
- func (ste *ProfilesSink) Reset()
- func (ste *ProfilesSink) SampleCount() int
- type TracesSink
- func (ste *TracesSink) AllTraces() []ptrace.Traces
- func (bc TracesSink) Capabilities() consumer.Capabilities
- func (ste *TracesSink) ConsumeTraces(ctx context.Context, td ptrace.Traces) error
- func (ste *TracesSink) Contexts() []context.Context
- func (ste *TracesSink) Reset()
- func (ste *TracesSink) SpanCount() int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Consumer ¶
type Consumer interface {
// Capabilities to implement the base consumer functionality.
Capabilities() consumer.Capabilities
// ConsumeTraces to implement the consumer.Traces.
ConsumeTraces(context.Context, ptrace.Traces) error
// ConsumeMetrics to implement the consumer.Metrics.
ConsumeMetrics(context.Context, pmetric.Metrics) error
// ConsumeLogs to implement the consumer.Logs.
ConsumeLogs(context.Context, plog.Logs) error
// ConsumeProfiles to implement the xconsumer.Profiles.
ConsumeProfiles(context.Context, pprofile.Profiles) 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 from implementing it and, as a result, to allow us to add extra functions without breaking compatibility.
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 ¶
func (bc LogsSink) Capabilities() consumer.Capabilities
Capabilities returns the base consumer capabilities.
func (*LogsSink) ConsumeLogs ¶
ConsumeLogs stores logs to this sink.
func (*LogsSink) Contexts ¶ added in v0.127.0
Contexts returns the contexts stored by this sink since last Reset.
func (*LogsSink) LogRecordCount ¶
LogRecordCount returns 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() []pmetric.Metrics
AllMetrics returns the metrics stored by this sink since last Reset.
func (MetricsSink) Capabilities ¶
func (bc MetricsSink) Capabilities() consumer.Capabilities
Capabilities returns the base consumer capabilities.
func (*MetricsSink) ConsumeMetrics ¶
ConsumeMetrics stores metrics to this sink.
func (*MetricsSink) Contexts ¶ added in v0.127.0
func (sme *MetricsSink) Contexts() []context.Context
Contexts returns the contexts stored by this sink since last Reset.
func (*MetricsSink) DataPointCount ¶
func (sme *MetricsSink) DataPointCount() int
DataPointCount returns the number of metrics stored by this sink since last Reset.
type ProfilesSink ¶
type ProfilesSink struct {
// contains filtered or unexported fields
}
ProfilesSink is a xconsumer.Profiles that acts like a sink that stores all profiles and allows querying them for testing.
func (*ProfilesSink) AllProfiles ¶
func (ste *ProfilesSink) AllProfiles() []pprofile.Profiles
AllProfiles returns the profiles stored by this sink since last Reset.
func (ProfilesSink) Capabilities ¶
func (bc ProfilesSink) Capabilities() consumer.Capabilities
Capabilities returns the base consumer capabilities.
func (*ProfilesSink) ConsumeProfiles ¶
ConsumeProfiles stores profiles to this sink.
func (*ProfilesSink) Contexts ¶ added in v0.127.0
func (ste *ProfilesSink) Contexts() []context.Context
Contexts returns the contexts stored by this sink since last Reset.
func (*ProfilesSink) ProfileCount ¶ added in v0.144.0
func (ste *ProfilesSink) ProfileCount() int
ProfileCount returns the number of profiles stored by this sink since last Reset.
func (*ProfilesSink) SampleCount ¶ added in v0.110.0
func (ste *ProfilesSink) SampleCount() int
SampleCount returns the number of samples 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() []ptrace.Traces
AllTraces returns the traces stored by this sink since last Reset.
func (TracesSink) Capabilities ¶
func (bc TracesSink) Capabilities() consumer.Capabilities
Capabilities returns the base consumer capabilities.
func (*TracesSink) ConsumeTraces ¶
ConsumeTraces stores traces to this sink.
func (*TracesSink) Contexts ¶ added in v0.127.0
func (ste *TracesSink) Contexts() []context.Context
Contexts returns the contexts stored by this sink since last Reset.
func (*TracesSink) SpanCount ¶
func (ste *TracesSink) SpanCount() int
SpanCount returns the number of spans sent to this sink.