20
20
import io .opentelemetry .api .OpenTelemetry ;
21
21
import io .opentelemetry .api .common .AttributeKey ;
22
22
import io .opentelemetry .api .common .Attributes ;
23
+ import io .opentelemetry .api .common .AttributesBuilder ;
23
24
import io .opentelemetry .api .trace .StatusCode ;
24
25
import io .opentelemetry .context .propagation .ContextPropagators ;
25
26
import io .opentelemetry .context .propagation .DefaultContextPropagators ;
@@ -84,7 +85,7 @@ public void shouldBeAbleToCreateATracer() {
84
85
85
86
assertThat (values ).hasSize (1 );
86
87
assertThat (values ).element (0 )
87
- .extracting (SpanData ::getStatus ).extracting (SpanData .Status ::getCanonicalCode ).isEqualTo (
88
+ .extracting (SpanData ::getStatus ).extracting (SpanData .Status ::getStatusCode ).isEqualTo (
88
89
StatusCode .ERROR );
89
90
assertThat (values ).element (0 )
90
91
.extracting (el -> el .getAttributes ().get (AttributeKey .stringKey ("cheese" ))).isEqualTo ("gouda" );
@@ -196,7 +197,7 @@ public void canCreateASpanEventWithBooleanAttribute() {
196
197
String event = "Test event" ;
197
198
String attribute = "testBoolean" ;
198
199
199
- Attributes . Builder attributes = Attributes .builder ();
200
+ AttributesBuilder attributes = Attributes .builder ();
200
201
attributes .put (attribute , false );
201
202
202
203
try (Span span = tracer .getCurrentContext ().createSpan ("parent" )) {
@@ -218,9 +219,9 @@ public void canCreateASpanEventWithBooleanArrayAttributes() {
218
219
String event = "Test event" ;
219
220
String arrayKey = "booleanArray" ;
220
221
String varArgsKey = "booleanVarArgs" ;
221
- Boolean [] booleanArray = new Boolean []{true , false };
222
+ boolean [] booleanArray = new boolean []{true , false };
222
223
223
- Attributes . Builder attributes = Attributes .builder ();
224
+ AttributesBuilder attributes = Attributes .builder ();
224
225
attributes .put (arrayKey , booleanArray );
225
226
attributes .put (varArgsKey , true , false , true );
226
227
@@ -245,7 +246,7 @@ public void canCreateASpanEventWithDoubleAttribute() {
245
246
String attribute = "testDouble" ;
246
247
Double attributeValue = 1.1 ;
247
248
248
- Attributes . Builder attributes = Attributes .builder ();
249
+ AttributesBuilder attributes = Attributes .builder ();
249
250
attributes .put (attribute , attributeValue );
250
251
251
252
try (Span span = tracer .getCurrentContext ().createSpan ("parent" )) {
@@ -267,9 +268,9 @@ public void canCreateASpanEventWithDoubleArrayAttributes() {
267
268
String event = "Test event" ;
268
269
String arrayKey = "doubleArray" ;
269
270
String varArgsKey = "doubleVarArgs" ;
270
- Double [] doubleArray = new Double []{4.5 , 2.5 };
271
+ double [] doubleArray = new double []{4.5 , 2.5 };
271
272
272
- Attributes . Builder attributes = Attributes .builder ();
273
+ AttributesBuilder attributes = Attributes .builder ();
273
274
attributes .put (arrayKey , doubleArray );
274
275
attributes .put (varArgsKey , 2.2 , 5.3 );
275
276
@@ -294,7 +295,7 @@ public void canCreateASpanEventWithLongAttribute() {
294
295
String attribute = "testLong" ;
295
296
Long attributeValue = 500L ;
296
297
297
- Attributes . Builder attributes = Attributes .builder ();
298
+ AttributesBuilder attributes = Attributes .builder ();
298
299
attributes .put (attribute , attributeValue );
299
300
300
301
try (Span span = tracer .getCurrentContext ().createSpan ("parent" )) {
@@ -316,9 +317,9 @@ public void canCreateASpanEventWithLongArrayAttributes() {
316
317
String event = "Test event" ;
317
318
String arrayKey = "longArray" ;
318
319
String varArgsKey = "longVarArgs" ;
319
- Long [] longArray = new Long []{400L , 200L };
320
+ long [] longArray = new long []{400L , 200L };
320
321
321
- Attributes . Builder attributes = Attributes .builder ();
322
+ AttributesBuilder attributes = Attributes .builder ();
322
323
attributes .put (arrayKey , longArray );
323
324
attributes .put (varArgsKey , 250L , 5L );
324
325
@@ -343,7 +344,7 @@ public void canCreateASpanEventWithStringAttribute() {
343
344
String attribute = "testString" ;
344
345
String attributeValue = "attributeValue" ;
345
346
346
- Attributes . Builder attributes = Attributes .builder ();
347
+ AttributesBuilder attributes = Attributes .builder ();
347
348
attributes .put (attribute , attributeValue );
348
349
349
350
try (Span span = tracer .getCurrentContext ().createSpan ("parent" )) {
@@ -367,7 +368,7 @@ public void canCreateASpanEventWithStringArrayAttributes() {
367
368
String varArgsKey = "strVarArgs" ;
368
369
String [] strArray = new String []{"hey" , "hello" };
369
370
370
- Attributes . Builder attributes = Attributes .builder ();
371
+ AttributesBuilder attributes = Attributes .builder ();
371
372
attributes .put (arrayKey , strArray );
372
373
attributes .put (varArgsKey , "hi" , "hola" );
373
374
@@ -392,7 +393,7 @@ public void canCreateASpanEventWithSameAttributeType() {
392
393
String attribute = "testString" ;
393
394
String attributeValue = "Hey" ;
394
395
395
- Attributes . Builder attributes = Attributes .builder ();
396
+ AttributesBuilder attributes = Attributes .builder ();
396
397
attributes .put (attribute , attributeValue );
397
398
attributes .put (attribute , attributeValue );
398
399
@@ -415,11 +416,9 @@ public void canCreateASpanEventWithMultipleAttributeTypes() {
415
416
Tracer tracer = createTracer (allSpans );
416
417
String event = "Test event" ;
417
418
String [] stringArray = new String []{"Hey" , "Hello" };
418
- Long [] longArray = new Long []{10L , 5L };
419
- Double [] doubleArray = new Double []{4.5 , 2.5 };
420
- Boolean [] booleanArray = new Boolean []{true , false };
419
+ boolean [] booleanArray = new boolean []{true , false };
421
420
422
- Attributes . Builder attributes = Attributes .builder ();
421
+ AttributesBuilder attributes = Attributes .builder ();
423
422
attributes .put ("testFloat" , 5.5f );
424
423
attributes .put ("testInt" , 10 );
425
424
attributes .put ("testStringArray" , stringArray );
0 commit comments