| 1 |
// Code generated by mdatagen. DO NOT EDIT. |
| 2 |
|
| 3 |
package metadatatest |
| 4 |
|
| 5 |
import ( |
| 6 |
"testing" |
| 7 |
|
| 8 |
"github.com/stretchr/testify/require" |
| 9 |
"go.opentelemetry.io/otel/sdk/metric/metricdata" |
| 10 |
"go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" |
| 11 |
|
| 12 |
"go.opentelemetry.io/collector/component" |
| 13 |
"go.opentelemetry.io/collector/component/componenttest" |
| 14 |
"go.opentelemetry.io/collector/processor" |
| 15 |
"go.opentelemetry.io/collector/processor/processortest" |
| 16 |
) |
| 17 |
|
| 18 |
func NewSettings(tt *componenttest.Telemetry) processor.Settings { |
| 19 |
set := processortest.NewNopSettings(processortest.NopType) |
| 20 |
set.ID = component.NewID(component.MustNewType("batch")) |
| 21 |
set.TelemetrySettings = tt.NewTelemetrySettings() |
| 22 |
return set |
| 23 |
} |
| 24 |
|
| 25 |
func AssertEqualProcessorBatchBatchSendSize(t *testing.T, tt *componenttest.Telemetry, dps []metricdata.HistogramDataPoint[int64], opts ...metricdatatest.Option) { |
| 26 |
want := metricdata.Metrics{ |
| 27 |
Name: "otelcol_processor_batch_batch_send_size", |
| 28 |
Description: "Number of units in the batch [Development]", |
| 29 |
Unit: "{units}", |
| 30 |
Data: metricdata.Histogram[int64]{ |
| 31 |
Temporality: metricdata.CumulativeTemporality, |
| 32 |
DataPoints: dps, |
| 33 |
}, |
| 34 |
} |
| 35 |
got, err := tt.GetMetric("otelcol_processor_batch_batch_send_size") |
| 36 |
require.NoError(t, err) |
| 37 |
metricdatatest.AssertEqual(t, want, got, opts...) |
| 38 |
} |
| 39 |
|
| 40 |
func AssertEqualProcessorBatchBatchSendSizeBytes(t *testing.T, tt *componenttest.Telemetry, dps []metricdata.HistogramDataPoint[int64], opts ...metricdatatest.Option) { |
| 41 |
want := metricdata.Metrics{ |
| 42 |
Name: "otelcol_processor_batch_batch_send_size_bytes", |
| 43 |
Description: "Number of bytes in batch that was sent. Only available on detailed level. [Development]", |
| 44 |
Unit: "By", |
| 45 |
Data: metricdata.Histogram[int64]{ |
| 46 |
Temporality: metricdata.CumulativeTemporality, |
| 47 |
DataPoints: dps, |
| 48 |
}, |
| 49 |
} |
| 50 |
got, err := tt.GetMetric("otelcol_processor_batch_batch_send_size_bytes") |
| 51 |
require.NoError(t, err) |
| 52 |
metricdatatest.AssertEqual(t, want, got, opts...) |
| 53 |
} |
| 54 |
|
| 55 |
func AssertEqualProcessorBatchBatchSizeTriggerSend(t *testing.T, tt *componenttest.Telemetry, dps []metricdata.DataPoint[int64], opts ...metricdatatest.Option) { |
| 56 |
want := metricdata.Metrics{ |
| 57 |
Name: "otelcol_processor_batch_batch_size_trigger_send", |
| 58 |
Description: "Number of times the batch was sent due to a size trigger [Development]", |
| 59 |
Unit: "{times}", |
| 60 |
Data: metricdata.Sum[int64]{ |
| 61 |
Temporality: metricdata.CumulativeTemporality, |
| 62 |
IsMonotonic: true, |
| 63 |
DataPoints: dps, |
| 64 |
}, |
| 65 |
} |
| 66 |
got, err := tt.GetMetric("otelcol_processor_batch_batch_size_trigger_send") |
| 67 |
require.NoError(t, err) |
| 68 |
metricdatatest.AssertEqual(t, want, got, opts...) |
| 69 |
} |
| 70 |
|
| 71 |
func AssertEqualProcessorBatchMetadataCardinality(t *testing.T, tt *componenttest.Telemetry, dps []metricdata.DataPoint[int64], opts ...metricdatatest.Option) { |
| 72 |
want := metricdata.Metrics{ |
| 73 |
Name: "otelcol_processor_batch_metadata_cardinality", |
| 74 |
Description: "Number of distinct metadata value combinations being processed [Development]", |
| 75 |
Unit: "{combinations}", |
| 76 |
Data: metricdata.Sum[int64]{ |
| 77 |
Temporality: metricdata.CumulativeTemporality, |
| 78 |
IsMonotonic: false, |
| 79 |
DataPoints: dps, |
| 80 |
}, |
| 81 |
} |
| 82 |
got, err := tt.GetMetric("otelcol_processor_batch_metadata_cardinality") |
| 83 |
require.NoError(t, err) |
| 84 |
metricdatatest.AssertEqual(t, want, got, opts...) |
| 85 |
} |
| 86 |
|
| 87 |
func AssertEqualProcessorBatchTimeoutTriggerSend(t *testing.T, tt *componenttest.Telemetry, dps []metricdata.DataPoint[int64], opts ...metricdatatest.Option) { |
| 88 |
want := metricdata.Metrics{ |
| 89 |
Name: "otelcol_processor_batch_timeout_trigger_send", |
| 90 |
Description: "Number of times the batch was sent due to a timeout trigger [Development]", |
| 91 |
Unit: "{times}", |
| 92 |
Data: metricdata.Sum[int64]{ |
| 93 |
Temporality: metricdata.CumulativeTemporality, |
| 94 |
IsMonotonic: true, |
| 95 |
DataPoints: dps, |
| 96 |
}, |
| 97 |
} |
| 98 |
got, err := tt.GetMetric("otelcol_processor_batch_timeout_trigger_send") |
| 99 |
require.NoError(t, err) |
| 100 |
metricdatatest.AssertEqual(t, want, got, opts...) |
| 101 |
} |