@@ -20,12 +20,14 @@ import (
20
20
21
21
"go.opentelemetry.io/otel/attribute"
22
22
"go.opentelemetry.io/otel/metric"
23
+ "go.opentelemetry.io/otel/metric/instrument"
23
24
"go.opentelemetry.io/otel/sdk/instrumentation"
24
25
controller "go.opentelemetry.io/otel/sdk/metric/controller/basic"
25
26
"go.opentelemetry.io/otel/sdk/metric/export"
26
27
"go.opentelemetry.io/otel/sdk/metric/export/aggregation"
27
28
"go.opentelemetry.io/otel/sdk/metric/number"
28
29
processor "go.opentelemetry.io/otel/sdk/metric/processor/basic"
30
+ "go.opentelemetry.io/otel/sdk/metric/sdkapi"
29
31
selector "go.opentelemetry.io/otel/sdk/metric/selector/simple"
30
32
)
31
33
@@ -62,6 +64,14 @@ func NewTestMeterProvider(opts ...Option) (metric.MeterProvider, *Exporter) {
62
64
return c , exp
63
65
}
64
66
67
+ // Library is the same as "sdk/instrumentation".Library but there is
68
+ // a package cycle to use it so it is redeclared here.
69
+ type Library struct {
70
+ InstrumentationName string
71
+ InstrumentationVersion string
72
+ SchemaURL string
73
+ }
74
+
65
75
// ExportRecord represents one collected datapoint from the Exporter.
66
76
type ExportRecord struct {
67
77
InstrumentName string
@@ -178,3 +188,10 @@ func subSet(attributesA, attributesB []attribute.KeyValue) bool {
178
188
}
179
189
return true
180
190
}
191
+
192
+ // NewDescriptor is a test helper for constructing test metric
193
+ // descriptors using standard options.
194
+ func NewDescriptor (name string , ikind sdkapi.InstrumentKind , nkind number.Kind , opts ... instrument.Option ) sdkapi.Descriptor {
195
+ cfg := instrument .NewConfig (opts ... )
196
+ return sdkapi .NewDescriptor (name , ikind , nkind , cfg .Description (), cfg .Unit ())
197
+ }
0 commit comments