1717
1818import io .github .microcks .event .TraceEvent ;
1919import io .opentelemetry .api .common .AttributeKey ;
20- import io .opentelemetry .sdk .trace .ReadableSpan ;
2120import io .opentelemetry .sdk .trace .data .EventData ;
21+ import io .opentelemetry .sdk .trace .data .SpanData ;
2222
2323import java .util .List ;
2424import java .util .Map ;
@@ -89,7 +89,7 @@ && matchesWildcard(operationName, traceEvent.operation())
8989 * @param spans the list of spans
9090 * @return the TraceEvent
9191 */
92- public static TraceEvent extractTraceEvent (String traceId , List <ReadableSpan > spans ) {
92+ public static TraceEvent extractTraceEvent (String traceId , List <SpanData > spans ) {
9393 if (spans == null || spans .isEmpty ()) {
9494 return null ;
9595 }
@@ -98,9 +98,9 @@ public static TraceEvent extractTraceEvent(String traceId, List<ReadableSpan> sp
9898 String operation = null ;
9999 String clientAddress = null ;
100100
101- for (ReadableSpan s : spans ) {
101+ for (SpanData s : spans ) {
102102 if (isValidSpan (s )) {
103- Map <AttributeKey <?>, Object > attributes = s .toSpanData (). getAttributes ().asMap ();
103+ Map <AttributeKey <?>, Object > attributes = s .getAttributes ().asMap ();
104104
105105 service = extractAttributeIfPresent (attributes , CommonAttributes .SERVICE_NAME , service );
106106 operation = extractAttributeIfPresent (attributes , CommonAttributes .OPERATION_NAME , operation );
@@ -115,8 +115,8 @@ public static TraceEvent extractTraceEvent(String traceId, List<ReadableSpan> sp
115115 return new TraceEvent (traceId , service , operation , clientAddress );
116116 }
117117
118- private static boolean isValidSpan (ReadableSpan span ) {
119- return span != null && span . toSpanData () != null ;
118+ private static boolean isValidSpan (SpanData span ) {
119+ return span != null ;
120120 }
121121
122122 private static String extractAttributeIfPresent (Map <AttributeKey <?>, Object > attributes , AttributeKey <String > key ,
@@ -125,8 +125,8 @@ private static String extractAttributeIfPresent(Map<AttributeKey<?>, Object> att
125125 return attributeValue != null ? attributeValue : currentValue ;
126126 }
127127
128- private static String extractClientAddress (ReadableSpan span , String currentClientAddress ) {
129- Optional <EventData > invocationReceivedEvent = span .toSpanData (). getEvents ().stream ()
128+ private static String extractClientAddress (SpanData span , String currentClientAddress ) {
129+ Optional <EventData > invocationReceivedEvent = span .getEvents ().stream ()
130130 .filter (e -> CommonEvents .INVOCATION_RECEIVED .getEventName ().equals (e .getName ())).findFirst ();
131131
132132 if (invocationReceivedEvent .isPresent ()) {
0 commit comments