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]>
78 lines
2.7 KiB
Go
78 lines
2.7 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 AssertEqualScraperErroredLogRecords(t *testing.T, tt *componenttest.Telemetry, dps []metricdata.DataPoint[int64], opts ...metricdatatest.Option) {
|
|
want := metricdata.Metrics{
|
|
Name: "otelcol_scraper_errored_log_records",
|
|
Description: "Number of log records that were unable to be scraped. [Alpha]",
|
|
Unit: "{datapoint}",
|
|
Data: metricdata.Sum[int64]{
|
|
Temporality: metricdata.CumulativeTemporality,
|
|
IsMonotonic: true,
|
|
DataPoints: dps,
|
|
},
|
|
}
|
|
got, err := tt.GetMetric("otelcol_scraper_errored_log_records")
|
|
require.NoError(t, err)
|
|
metricdatatest.AssertEqual(t, want, got, opts...)
|
|
}
|
|
|
|
func AssertEqualScraperErroredMetricPoints(t *testing.T, tt *componenttest.Telemetry, dps []metricdata.DataPoint[int64], opts ...metricdatatest.Option) {
|
|
want := metricdata.Metrics{
|
|
Name: "otelcol_scraper_errored_metric_points",
|
|
Description: "Number of metric points that were unable to be scraped. [Alpha]",
|
|
Unit: "{datapoint}",
|
|
Data: metricdata.Sum[int64]{
|
|
Temporality: metricdata.CumulativeTemporality,
|
|
IsMonotonic: true,
|
|
DataPoints: dps,
|
|
},
|
|
}
|
|
got, err := tt.GetMetric("otelcol_scraper_errored_metric_points")
|
|
require.NoError(t, err)
|
|
metricdatatest.AssertEqual(t, want, got, opts...)
|
|
}
|
|
|
|
func AssertEqualScraperScrapedLogRecords(t *testing.T, tt *componenttest.Telemetry, dps []metricdata.DataPoint[int64], opts ...metricdatatest.Option) {
|
|
want := metricdata.Metrics{
|
|
Name: "otelcol_scraper_scraped_log_records",
|
|
Description: "Number of log records successfully scraped. [Alpha]",
|
|
Unit: "{datapoint}",
|
|
Data: metricdata.Sum[int64]{
|
|
Temporality: metricdata.CumulativeTemporality,
|
|
IsMonotonic: true,
|
|
DataPoints: dps,
|
|
},
|
|
}
|
|
got, err := tt.GetMetric("otelcol_scraper_scraped_log_records")
|
|
require.NoError(t, err)
|
|
metricdatatest.AssertEqual(t, want, got, opts...)
|
|
}
|
|
|
|
func AssertEqualScraperScrapedMetricPoints(t *testing.T, tt *componenttest.Telemetry, dps []metricdata.DataPoint[int64], opts ...metricdatatest.Option) {
|
|
want := metricdata.Metrics{
|
|
Name: "otelcol_scraper_scraped_metric_points",
|
|
Description: "Number of metric points successfully scraped. [Alpha]",
|
|
Unit: "{datapoint}",
|
|
Data: metricdata.Sum[int64]{
|
|
Temporality: metricdata.CumulativeTemporality,
|
|
IsMonotonic: true,
|
|
DataPoints: dps,
|
|
},
|
|
}
|
|
got, err := tt.GetMetric("otelcol_scraper_scraped_metric_points")
|
|
require.NoError(t, err)
|
|
metricdatatest.AssertEqual(t, want, got, opts...)
|
|
}
|