Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MetricData ¶
MetricData represents a metric measurement for testing.
type TestExporter ¶
type TestExporter struct {
// contains filtered or unexported fields
}
TestExporter captures and validates OpenTelemetry metrics in tests.
func NewTestExporter ¶
func NewTestExporter() (*TestExporter, error)
NewTestExporter creates a new test exporter with a fresh OpenTelemetry setup. This function initializes a new meter provider and all metric instruments for testing purposes. It returns an error if initialization fails.
func (*TestExporter) ClearMetrics ¶
func (e *TestExporter) ClearMetrics()
ClearMetrics clears all collected metrics for this test exporter.
func (*TestExporter) CollectMetrics ¶
func (e *TestExporter) CollectMetrics(ctx context.Context) error
CollectMetrics collects all OpenTelemetry metrics and stores them in a simple format.
func (*TestExporter) GetMetrics ¶
func (e *TestExporter) GetMetrics() []MetricData
GetMetrics returns all collected metrics.
func (*TestExporter) ValidateMetrics ¶
func (e *TestExporter) ValidateMetrics(expected []MetricData) string
ValidateMetrics compares collected metrics with expected values.
Click to show internal directories.
Click to hide internal directories.