@@ -57,6 +57,20 @@ func TestProcess(t *testing.T) {
57
57
td .ResourceMetrics ().At (0 ).ScopeMetrics ().At (0 ).Metrics ().At (3 ).Summary ().DataPoints ().At (0 ).Attributes ().PutString ("test" , "pass" )
58
58
},
59
59
},
60
+ {
61
+ statements : []string {`set(attributes["int_value"], Int("2")) where metric.name == "operationA"` },
62
+ want : func (td pmetric.Metrics ) {
63
+ td .ResourceMetrics ().At (0 ).ScopeMetrics ().At (0 ).Metrics ().At (0 ).Sum ().DataPoints ().At (0 ).Attributes ().PutInt ("int_value" , 2 )
64
+ td .ResourceMetrics ().At (0 ).ScopeMetrics ().At (0 ).Metrics ().At (0 ).Sum ().DataPoints ().At (1 ).Attributes ().PutInt ("int_value" , 2 )
65
+ },
66
+ },
67
+ {
68
+ statements : []string {`set(attributes["int_value"], Int(value_double)) where metric.name == "operationA"` },
69
+ want : func (td pmetric.Metrics ) {
70
+ td .ResourceMetrics ().At (0 ).ScopeMetrics ().At (0 ).Metrics ().At (0 ).Sum ().DataPoints ().At (0 ).Attributes ().PutInt ("int_value" , 1 )
71
+ td .ResourceMetrics ().At (0 ).ScopeMetrics ().At (0 ).Metrics ().At (0 ).Sum ().DataPoints ().At (1 ).Attributes ().PutInt ("int_value" , 3 )
72
+ },
73
+ },
60
74
{
61
75
statements : []string {`keep_keys(attributes, "attr2") where metric.name == "operationA"` },
62
76
want : func (td pmetric.Metrics ) {
@@ -355,6 +369,7 @@ func fillMetricOne(m pmetric.Metric) {
355
369
356
370
dataPoint1 := m .Sum ().DataPoints ().AppendEmpty ()
357
371
dataPoint1 .SetStartTimestamp (StartTimestamp )
372
+ dataPoint1 .SetDoubleValue (3.7 )
358
373
dataPoint1 .Attributes ().PutString ("attr1" , "test1" )
359
374
dataPoint1 .Attributes ().PutString ("attr2" , "test2" )
360
375
dataPoint1 .Attributes ().PutString ("attr3" , "test3" )
0 commit comments