@@ -139,19 +139,14 @@ func TestMeterProviderOptions(t *testing.T) {
139139 require .NoError (t , err )
140140
141141 res := resource .NewSchemaless (attribute .String ("foo" , "bar" ))
142- // TODO: re-enable this once NewSDK is added
143- // sdk, err := NewSDK(
144- // WithOpenTelemetryConfiguration(cfg),
145- // WithMeterProviderOptions(sdkmetric.WithReader(sdkmetric.NewPeriodicReader(stdoutmetricExporter))),
146- // WithMeterProviderOptions(sdkmetric.WithResource(res)),
147- // )
148- mp , shutdown , err := meterProvider (configOptions {
149- opentelemetryConfig : cfg ,
150- meterProviderOptions : []sdkmetric.Option {sdkmetric .WithReader (sdkmetric .NewPeriodicReader (stdoutmetricExporter ))},
151- }, res )
142+ sdk , err := NewSDK (
143+ WithOpenTelemetryConfiguration (cfg ),
144+ WithMeterProviderOptions (sdkmetric .WithReader (sdkmetric .NewPeriodicReader (stdoutmetricExporter ))),
145+ WithMeterProviderOptions (sdkmetric .WithResource (res )),
146+ )
152147 require .NoError (t , err )
153148 defer func () {
154- assert .NoError (t , shutdown (t .Context ()))
149+ assert .NoError (t , sdk . Shutdown (t .Context ()))
155150 // The exporter, which we passed in as an extra option to NewSDK,
156151 // should be wired up to the provider in addition to the
157152 // configuration-based OTLP exporter.
@@ -161,11 +156,10 @@ func TestMeterProviderOptions(t *testing.T) {
161156 // Options provided by WithMeterProviderOptions may be overridden
162157 // by configuration, e.g. the resource is always defined via
163158 // configuration.
164- // TODO: re-enable this once NewSDK is added
165- // assert.NotContains(t, buf.String(), "foo")
159+ assert .NotContains (t , buf .String (), "foo" )
166160 }()
167161
168- counter , _ := mp .Meter ("test" ).Int64Counter ("counter" )
162+ counter , _ := sdk . MeterProvider () .Meter ("test" ).Int64Counter ("counter" )
169163 counter .Add (t .Context (), 1 )
170164}
171165
0 commit comments