Documentation

Overview

    Package metrics contains functionality for testing an otelcol pipeline end to end for metric correctness. Partly because of how Prometheus works (being pull-based) metrics correctness works differently than the performance testbed in the parent directory. Whereas performance testing sends a relatively large number of data-points into the collector, this package sends metrics in one at a time, and only sends the next datapoint when the previous datapoint has been processed and compared to the original.

    Mostly similar to the performance testing pipeline, this pipeline looks like the following: [testbed exporter] -> [otelcol receiver] -> [otelcol exporter] -> [testbed receiver] -> [test harness]

    the difference being the testHarness, which is connected to [testbed receiver] as its metrics consumer, listening for data-points. To start the process, one datapoint is sent into the testbed exporter, it goes through the pipeline, and arrives at the testbed receiver, which passes it along to the test harness. The test harness compares the received datapoint to the original datapoint it sent, and saves any diffs it found in a diffAccumulator instance. Then it sends the next datapoint. This continues until there are no more data-points. The simple diagram above should have a loop, where [test harness] connects back to [testbed exporter].

    Data-points are supplied to the testHarness by a metricSupplier, which receives all of the metrics it needs upfront. Those metrics are in turn generated by a metricGenerator, which receives its config from a PICT generated file, as the trace correctness functionality does.

    Index

    Constants

    This section is empty.

    Variables

    This section is empty.

    Functions

    This section is empty.

    Types

    type MetricDiff

    type MetricDiff struct {
    	ExpectedValue interface{}
    	ActualValue   interface{}
    	Msg           string
    }

      MetricDiff is intended to support producing human-readable diffs between two MetricData structs during testing. Two MetricDatas, when compared, could produce a list of MetricDiffs containing all of their differences, which could be used to correct the differences between the expected and actual values.

      func DiffMetric

      func DiffMetric(diffs []*MetricDiff, expected pdata.Metric, actual pdata.Metric) []*MetricDiff

      func (MetricDiff) String

      func (mf MetricDiff) String() string