mirror of
https://github.com/hanzoai/telemetry.git
synced 2026-10-30 20:01:49 +00:00
#### Description This is to align the metric units with [OTel specification](https://opentelemetry.io/docs/specs/semconv/general/metrics/#instrument-units): > All non-units that use curly braces to annotate a quantity need to match the grammatical number of the quantity it represent. For example if measuring the number of individual requests to a process the unit would be **{request}, not {requests}**. #### Link to tracking issue Part of https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/45270 ❓ Is there a way for this change to surface to users as a breaking change? --------- Co-authored-by: Pablo Baeyens <[email protected]>
222 lines
8.4 KiB
Go
222 lines
8.4 KiB
Go
// Code generated by mdatagen. DO NOT EDIT.
|
|
|
|
package metadatatest
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
"go.opentelemetry.io/otel/sdk/metric/metricdata"
|
|
"go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest"
|
|
|
|
"go.opentelemetry.io/collector/component/componenttest"
|
|
)
|
|
|
|
func AssertEqualReceiverAcceptedLogRecords(t *testing.T, tt *componenttest.Telemetry, dps []metricdata.DataPoint[int64], opts ...metricdatatest.Option) {
|
|
want := metricdata.Metrics{
|
|
Name: "otelcol_receiver_accepted_log_records",
|
|
Description: "Number of log records successfully pushed into the pipeline. [Alpha]",
|
|
Unit: "{record}",
|
|
Data: metricdata.Sum[int64]{
|
|
Temporality: metricdata.CumulativeTemporality,
|
|
IsMonotonic: true,
|
|
DataPoints: dps,
|
|
},
|
|
}
|
|
got, err := tt.GetMetric("otelcol_receiver_accepted_log_records")
|
|
require.NoError(t, err)
|
|
metricdatatest.AssertEqual(t, want, got, opts...)
|
|
}
|
|
|
|
func AssertEqualReceiverAcceptedMetricPoints(t *testing.T, tt *componenttest.Telemetry, dps []metricdata.DataPoint[int64], opts ...metricdatatest.Option) {
|
|
want := metricdata.Metrics{
|
|
Name: "otelcol_receiver_accepted_metric_points",
|
|
Description: "Number of metric points successfully pushed into the pipeline. [Alpha]",
|
|
Unit: "{datapoint}",
|
|
Data: metricdata.Sum[int64]{
|
|
Temporality: metricdata.CumulativeTemporality,
|
|
IsMonotonic: true,
|
|
DataPoints: dps,
|
|
},
|
|
}
|
|
got, err := tt.GetMetric("otelcol_receiver_accepted_metric_points")
|
|
require.NoError(t, err)
|
|
metricdatatest.AssertEqual(t, want, got, opts...)
|
|
}
|
|
|
|
func AssertEqualReceiverAcceptedProfileSamples(t *testing.T, tt *componenttest.Telemetry, dps []metricdata.DataPoint[int64], opts ...metricdatatest.Option) {
|
|
want := metricdata.Metrics{
|
|
Name: "otelcol_receiver_accepted_profile_samples",
|
|
Description: "Number of profile samples successfully pushed into the pipeline. [Alpha]",
|
|
Unit: "{sample}",
|
|
Data: metricdata.Sum[int64]{
|
|
Temporality: metricdata.CumulativeTemporality,
|
|
IsMonotonic: true,
|
|
DataPoints: dps,
|
|
},
|
|
}
|
|
got, err := tt.GetMetric("otelcol_receiver_accepted_profile_samples")
|
|
require.NoError(t, err)
|
|
metricdatatest.AssertEqual(t, want, got, opts...)
|
|
}
|
|
|
|
func AssertEqualReceiverAcceptedSpans(t *testing.T, tt *componenttest.Telemetry, dps []metricdata.DataPoint[int64], opts ...metricdatatest.Option) {
|
|
want := metricdata.Metrics{
|
|
Name: "otelcol_receiver_accepted_spans",
|
|
Description: "Number of spans successfully pushed into the pipeline. [Alpha]",
|
|
Unit: "{span}",
|
|
Data: metricdata.Sum[int64]{
|
|
Temporality: metricdata.CumulativeTemporality,
|
|
IsMonotonic: true,
|
|
DataPoints: dps,
|
|
},
|
|
}
|
|
got, err := tt.GetMetric("otelcol_receiver_accepted_spans")
|
|
require.NoError(t, err)
|
|
metricdatatest.AssertEqual(t, want, got, opts...)
|
|
}
|
|
|
|
func AssertEqualReceiverFailedLogRecords(t *testing.T, tt *componenttest.Telemetry, dps []metricdata.DataPoint[int64], opts ...metricdatatest.Option) {
|
|
want := metricdata.Metrics{
|
|
Name: "otelcol_receiver_failed_log_records",
|
|
Description: "The number of log records that failed to be processed by the receiver due to internal errors. [Alpha]",
|
|
Unit: "{record}",
|
|
Data: metricdata.Sum[int64]{
|
|
Temporality: metricdata.CumulativeTemporality,
|
|
IsMonotonic: true,
|
|
DataPoints: dps,
|
|
},
|
|
}
|
|
got, err := tt.GetMetric("otelcol_receiver_failed_log_records")
|
|
require.NoError(t, err)
|
|
metricdatatest.AssertEqual(t, want, got, opts...)
|
|
}
|
|
|
|
func AssertEqualReceiverFailedMetricPoints(t *testing.T, tt *componenttest.Telemetry, dps []metricdata.DataPoint[int64], opts ...metricdatatest.Option) {
|
|
want := metricdata.Metrics{
|
|
Name: "otelcol_receiver_failed_metric_points",
|
|
Description: "The number of metric points that failed to be processed by the receiver due to internal errors. [Alpha]",
|
|
Unit: "{datapoint}",
|
|
Data: metricdata.Sum[int64]{
|
|
Temporality: metricdata.CumulativeTemporality,
|
|
IsMonotonic: true,
|
|
DataPoints: dps,
|
|
},
|
|
}
|
|
got, err := tt.GetMetric("otelcol_receiver_failed_metric_points")
|
|
require.NoError(t, err)
|
|
metricdatatest.AssertEqual(t, want, got, opts...)
|
|
}
|
|
|
|
func AssertEqualReceiverFailedProfileSamples(t *testing.T, tt *componenttest.Telemetry, dps []metricdata.DataPoint[int64], opts ...metricdatatest.Option) {
|
|
want := metricdata.Metrics{
|
|
Name: "otelcol_receiver_failed_profile_samples",
|
|
Description: "The number of profile samples that failed to be processed by the receiver due to internal errors. [Alpha]",
|
|
Unit: "{sample}",
|
|
Data: metricdata.Sum[int64]{
|
|
Temporality: metricdata.CumulativeTemporality,
|
|
IsMonotonic: true,
|
|
DataPoints: dps,
|
|
},
|
|
}
|
|
got, err := tt.GetMetric("otelcol_receiver_failed_profile_samples")
|
|
require.NoError(t, err)
|
|
metricdatatest.AssertEqual(t, want, got, opts...)
|
|
}
|
|
|
|
func AssertEqualReceiverFailedSpans(t *testing.T, tt *componenttest.Telemetry, dps []metricdata.DataPoint[int64], opts ...metricdatatest.Option) {
|
|
want := metricdata.Metrics{
|
|
Name: "otelcol_receiver_failed_spans",
|
|
Description: "The number of spans that failed to be processed by the receiver due to internal errors. [Alpha]",
|
|
Unit: "{span}",
|
|
Data: metricdata.Sum[int64]{
|
|
Temporality: metricdata.CumulativeTemporality,
|
|
IsMonotonic: true,
|
|
DataPoints: dps,
|
|
},
|
|
}
|
|
got, err := tt.GetMetric("otelcol_receiver_failed_spans")
|
|
require.NoError(t, err)
|
|
metricdatatest.AssertEqual(t, want, got, opts...)
|
|
}
|
|
|
|
func AssertEqualReceiverRefusedLogRecords(t *testing.T, tt *componenttest.Telemetry, dps []metricdata.DataPoint[int64], opts ...metricdatatest.Option) {
|
|
want := metricdata.Metrics{
|
|
Name: "otelcol_receiver_refused_log_records",
|
|
Description: "Number of log records that could not be pushed into the pipeline. [Alpha]",
|
|
Unit: "{record}",
|
|
Data: metricdata.Sum[int64]{
|
|
Temporality: metricdata.CumulativeTemporality,
|
|
IsMonotonic: true,
|
|
DataPoints: dps,
|
|
},
|
|
}
|
|
got, err := tt.GetMetric("otelcol_receiver_refused_log_records")
|
|
require.NoError(t, err)
|
|
metricdatatest.AssertEqual(t, want, got, opts...)
|
|
}
|
|
|
|
func AssertEqualReceiverRefusedMetricPoints(t *testing.T, tt *componenttest.Telemetry, dps []metricdata.DataPoint[int64], opts ...metricdatatest.Option) {
|
|
want := metricdata.Metrics{
|
|
Name: "otelcol_receiver_refused_metric_points",
|
|
Description: "Number of metric points that could not be pushed into the pipeline. [Alpha]",
|
|
Unit: "{datapoint}",
|
|
Data: metricdata.Sum[int64]{
|
|
Temporality: metricdata.CumulativeTemporality,
|
|
IsMonotonic: true,
|
|
DataPoints: dps,
|
|
},
|
|
}
|
|
got, err := tt.GetMetric("otelcol_receiver_refused_metric_points")
|
|
require.NoError(t, err)
|
|
metricdatatest.AssertEqual(t, want, got, opts...)
|
|
}
|
|
|
|
func AssertEqualReceiverRefusedProfileSamples(t *testing.T, tt *componenttest.Telemetry, dps []metricdata.DataPoint[int64], opts ...metricdatatest.Option) {
|
|
want := metricdata.Metrics{
|
|
Name: "otelcol_receiver_refused_profile_samples",
|
|
Description: "Number of profile samples that could not be pushed into the pipeline. [Alpha]",
|
|
Unit: "{sample}",
|
|
Data: metricdata.Sum[int64]{
|
|
Temporality: metricdata.CumulativeTemporality,
|
|
IsMonotonic: true,
|
|
DataPoints: dps,
|
|
},
|
|
}
|
|
got, err := tt.GetMetric("otelcol_receiver_refused_profile_samples")
|
|
require.NoError(t, err)
|
|
metricdatatest.AssertEqual(t, want, got, opts...)
|
|
}
|
|
|
|
func AssertEqualReceiverRefusedSpans(t *testing.T, tt *componenttest.Telemetry, dps []metricdata.DataPoint[int64], opts ...metricdatatest.Option) {
|
|
want := metricdata.Metrics{
|
|
Name: "otelcol_receiver_refused_spans",
|
|
Description: "Number of spans that could not be pushed into the pipeline. [Alpha]",
|
|
Unit: "{span}",
|
|
Data: metricdata.Sum[int64]{
|
|
Temporality: metricdata.CumulativeTemporality,
|
|
IsMonotonic: true,
|
|
DataPoints: dps,
|
|
},
|
|
}
|
|
got, err := tt.GetMetric("otelcol_receiver_refused_spans")
|
|
require.NoError(t, err)
|
|
metricdatatest.AssertEqual(t, want, got, opts...)
|
|
}
|
|
|
|
func AssertEqualReceiverRequests(t *testing.T, tt *componenttest.Telemetry, dps []metricdata.DataPoint[int64], opts ...metricdatatest.Option) {
|
|
want := metricdata.Metrics{
|
|
Name: "otelcol_receiver_requests",
|
|
Description: "The number of requests performed. [Alpha]",
|
|
Unit: "{request}",
|
|
Data: metricdata.Sum[int64]{
|
|
Temporality: metricdata.CumulativeTemporality,
|
|
IsMonotonic: true,
|
|
DataPoints: dps,
|
|
},
|
|
}
|
|
got, err := tt.GetMetric("otelcol_receiver_requests")
|
|
require.NoError(t, err)
|
|
metricdatatest.AssertEqual(t, want, got, opts...)
|
|
}
|