8
8
"github.com/stretchr/testify/assert"
9
9
"github.com/stretchr/testify/require"
10
10
11
- "go.opentelemetry.io/otel"
12
11
"go.opentelemetry.io/otel/attribute"
13
12
"go.opentelemetry.io/otel/metric"
14
13
"go.opentelemetry.io/otel/sdk/instrumentation"
@@ -26,8 +25,8 @@ var instrumentationScope = instrumentation.Scope{
26
25
func setupMetrics (conf * config ) (* sdkmetric.ManualReader , * redis.Client ) {
27
26
reader := sdkmetric .NewManualReader ()
28
27
mp := sdkmetric .NewMeterProvider (sdkmetric .WithReader (reader ))
29
- otel . SetMeterProvider ( mp )
30
-
28
+ conf . mp = mp
29
+
31
30
rdb := redis .NewClient (& redis.Options {
32
31
Addr : ":6379" ,
33
32
})
@@ -43,7 +42,7 @@ func setupMetrics(conf *config) (*sdkmetric.ManualReader, *redis.Client) {
43
42
44
43
func TestMetrics (t * testing.T ) {
45
44
reader , rdb := setupMetrics (newConfig ())
46
- rdb .Get (context .Background (), "key" )
45
+ rdb .Ping (context .Background ())
47
46
48
47
want := metricdata.ScopeMetrics {
49
48
Scope : instrumentationScope ,
@@ -99,7 +98,7 @@ func TestCustomAttributes(t *testing.T) {
99
98
config := newConfig (WithAttributesFunc (customAttrFn ))
100
99
reader , rdb := setupMetrics (config )
101
100
102
- rdb .Get (context .Background (), "key" )
101
+ rdb .Ping (context .Background ())
103
102
104
103
want := metricdata.ScopeMetrics {
105
104
Scope : instrumentationScope ,
0 commit comments