@@ -5,11 +5,13 @@ package ottlfuncs
5
5
6
6
import (
7
7
"context"
8
- "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl"
8
+ "testing"
9
+
9
10
"github.com/stretchr/testify/assert"
10
11
"go.opentelemetry.io/collector/pdata/pcommon"
11
12
"go.opentelemetry.io/collector/pdata/pmetric"
12
- "testing"
13
+
14
+ "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl"
13
15
)
14
16
15
17
func TestScale (t * testing.T ) {
@@ -28,7 +30,7 @@ func TestScale(t *testing.T) {
28
30
name : "scale float value" ,
29
31
args : args {
30
32
value : & ottl.StandardGetSetter [any ]{
31
- Getter : func (ctx context.Context , tCtx any ) (any , error ) {
33
+ Getter : func (_ context.Context , _ any ) (any , error ) {
32
34
return 1.05 , nil
33
35
},
34
36
},
@@ -43,7 +45,7 @@ func TestScale(t *testing.T) {
43
45
name : "scale int value" ,
44
46
args : args {
45
47
value : & ottl.StandardGetSetter [any ]{
46
- Getter : func (ctx context.Context , tCtx any ) (any , error ) {
48
+ Getter : func (_ context.Context , _ any ) (any , error ) {
47
49
return int64 (1 ), nil
48
50
},
49
51
},
@@ -58,7 +60,7 @@ func TestScale(t *testing.T) {
58
60
name : "unsupported data type" ,
59
61
args : args {
60
62
value : & ottl.StandardGetSetter [any ]{
61
- Getter : func (ctx context.Context , tCtx any ) (any , error ) {
63
+ Getter : func (_ context.Context , _ any ) (any , error ) {
62
64
return "foo" , nil
63
65
},
64
66
},
@@ -73,7 +75,7 @@ func TestScale(t *testing.T) {
73
75
name : "scale gauge float metric" ,
74
76
args : args {
75
77
value : & ottl.StandardGetSetter [any ]{
76
- Getter : func (ctx context.Context , tCtx any ) (any , error ) {
78
+ Getter : func (_ context.Context , _ any ) (any , error ) {
77
79
metric := pmetric .NewMetric ()
78
80
metric .SetName ("test-metric" )
79
81
metric .SetEmptyGauge ()
@@ -98,7 +100,7 @@ func TestScale(t *testing.T) {
98
100
name : "scale gauge int metric" ,
99
101
args : args {
100
102
value : & ottl.StandardGetSetter [any ]{
101
- Getter : func (ctx context.Context , tCtx any ) (any , error ) {
103
+ Getter : func (_ context.Context , _ any ) (any , error ) {
102
104
metric := pmetric .NewMetric ()
103
105
metric .SetName ("test-metric" )
104
106
metric .SetEmptyGauge ()
@@ -123,7 +125,7 @@ func TestScale(t *testing.T) {
123
125
name : "scale sum metric" ,
124
126
args : args {
125
127
value : & ottl.StandardGetSetter [any ]{
126
- Getter : func (ctx context.Context , tCtx any ) (any , error ) {
128
+ Getter : func (_ context.Context , _ any ) (any , error ) {
127
129
metric := pmetric .NewMetric ()
128
130
metric .SetName ("test-metric" )
129
131
metric .SetEmptySum ()
@@ -148,7 +150,7 @@ func TestScale(t *testing.T) {
148
150
name : "scale histogram metric" ,
149
151
args : args {
150
152
value : & ottl.StandardGetSetter [any ]{
151
- Getter : func (ctx context.Context , tCtx any ) (any , error ) {
153
+ Getter : func (_ context.Context , _ any ) (any , error ) {
152
154
metric := getTestHistogramMetric (1 , 4 , 1 , 3 , []float64 {1 , 10 }, []uint64 {1 , 2 }, []float64 {1.0 }, 1 , 1 )
153
155
return metric .Histogram ().DataPoints (), nil
154
156
@@ -166,7 +168,7 @@ func TestScale(t *testing.T) {
166
168
name : "scale SummaryDataPointValueAtQuantileSlice" ,
167
169
args : args {
168
170
value : & ottl.StandardGetSetter [any ]{
169
- Getter : func (ctx context.Context , tCtx any ) (any , error ) {
171
+ Getter : func (_ context.Context , _ any ) (any , error ) {
170
172
metric := pmetric .NewSummaryDataPointValueAtQuantileSlice ()
171
173
metric .AppendEmpty ().SetValue (1.0 )
172
174
return metric , nil
@@ -186,7 +188,7 @@ func TestScale(t *testing.T) {
186
188
name : "scale ExemplarSlice" ,
187
189
args : args {
188
190
value : & ottl.StandardGetSetter [any ]{
189
- Getter : func (ctx context.Context , tCtx any ) (any , error ) {
191
+ Getter : func (_ context.Context , _ any ) (any , error ) {
190
192
metric := pmetric .NewExemplarSlice ()
191
193
metric .AppendEmpty ().SetDoubleValue (1.0 )
192
194
return metric , nil
@@ -205,7 +207,7 @@ func TestScale(t *testing.T) {
205
207
name : "unsupported: exponential histogram metric" ,
206
208
args : args {
207
209
value : & ottl.StandardGetSetter [any ]{
208
- Getter : func (ctx context.Context , tCtx any ) (any , error ) {
210
+ Getter : func (_ context.Context , _ any ) (any , error ) {
209
211
return pmetric .NewExponentialHistogramDataPointSlice (), nil
210
212
211
213
},
0 commit comments