88 "github.com/stretchr/testify/assert"
99 "github.com/stretchr/testify/require"
1010
11- "go.opentelemetry.io/otel"
1211 "go.opentelemetry.io/otel/attribute"
1312 "go.opentelemetry.io/otel/metric"
1413 "go.opentelemetry.io/otel/sdk/instrumentation"
@@ -26,8 +25,8 @@ var instrumentationScope = instrumentation.Scope{
2625func setupMetrics (conf * config ) (* sdkmetric.ManualReader , * redis.Client ) {
2726 reader := sdkmetric .NewManualReader ()
2827 mp := sdkmetric .NewMeterProvider (sdkmetric .WithReader (reader ))
29- otel . SetMeterProvider ( mp )
30-
28+ conf . mp = mp
29+
3130 rdb := redis .NewClient (& redis.Options {
3231 Addr : ":6379" ,
3332 })
@@ -43,7 +42,7 @@ func setupMetrics(conf *config) (*sdkmetric.ManualReader, *redis.Client) {
4342
4443func TestMetrics (t * testing.T ) {
4544 reader , rdb := setupMetrics (newConfig ())
46- rdb .Get (context .Background (), "key" )
45+ rdb .Ping (context .Background ())
4746
4847 want := metricdata.ScopeMetrics {
4948 Scope : instrumentationScope ,
@@ -99,7 +98,7 @@ func TestCustomAttributes(t *testing.T) {
9998 config := newConfig (WithAttributesFunc (customAttrFn ))
10099 reader , rdb := setupMetrics (config )
101100
102- rdb .Get (context .Background (), "key" )
101+ rdb .Ping (context .Background ())
103102
104103 want := metricdata.ScopeMetrics {
105104 Scope : instrumentationScope ,
0 commit comments