1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2026-06-03 18:35:08 +02:00

Deprecate metric/unit and use a string for units in the metric API/SDK (#3776)

* Replace Unit from metric/unit with string

Deprecate the units package. This package will not be included in the
metric GA.

* Add changes to changelog
This commit is contained in:
Tyler Yahn
2023-02-27 08:10:56 -08:00
committed by GitHub
parent 17e5d0f549
commit fe6856e804
31 changed files with 148 additions and 212 deletions
+1 -2
View File
@@ -18,7 +18,6 @@ import (
"time"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/metric/unit"
"go.opentelemetry.io/otel/sdk/instrumentation"
"go.opentelemetry.io/otel/sdk/resource"
)
@@ -47,7 +46,7 @@ type Metrics struct {
// Description is the description of the Instrument, which can be used in documentation.
Description string
// Unit is the unit in which the Instrument reports.
Unit unit.Unit
Unit string
// Data is the aggregated data from an Instrument.
Data Aggregation
}
@@ -21,7 +21,6 @@ import (
"github.com/stretchr/testify/assert"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/metric/unit"
"go.opentelemetry.io/otel/sdk/instrumentation"
"go.opentelemetry.io/otel/sdk/metric/metricdata"
"go.opentelemetry.io/otel/sdk/resource"
@@ -175,19 +174,19 @@ var (
metricsA = metricdata.Metrics{
Name: "A",
Description: "A desc",
Unit: unit.Dimensionless,
Unit: "1",
Data: sumInt64A,
}
metricsB = metricdata.Metrics{
Name: "B",
Description: "B desc",
Unit: unit.Bytes,
Unit: "By",
Data: gaugeFloat64B,
}
metricsC = metricdata.Metrics{
Name: "A",
Description: "A desc",
Unit: unit.Dimensionless,
Unit: "1",
Data: sumInt64C,
}