metric_supplier.go 634 B

1234567891011121314151617181920212223242526
  1. // Copyright The OpenTelemetry Authors
  2. // SPDX-License-Identifier: Apache-2.0
  3. package metrics // import "github.com/open-telemetry/opentelemetry-collector-contrib/testbed/correctnesstests/metrics"
  4. import (
  5. "go.opentelemetry.io/collector/pdata/pmetric"
  6. )
  7. type metricSupplier struct {
  8. pdms []pmetric.Metrics
  9. currIdx int
  10. }
  11. func newMetricSupplier(pdms []pmetric.Metrics) *metricSupplier {
  12. return &metricSupplier{pdms: pdms}
  13. }
  14. func (p *metricSupplier) nextMetrics() (pdm pmetric.Metrics, done bool) {
  15. if p.currIdx == len(p.pdms) {
  16. return pmetric.Metrics{}, true
  17. }
  18. pdm = p.pdms[p.currIdx]
  19. p.currIdx++
  20. return pdm, false
  21. }