@@ -176,7 +176,7 @@ static void format_event(cfl_sds_t *buf, struct ctrace_span_event *event, int le
176
176
177
177
}
178
178
179
- static void format_span (cfl_sds_t * buf , struct ctrace * ctx , struct ctrace_span * span , int level )
179
+ static void format_span (cfl_sds_t * buf , struct ctrace * ctx , int id , struct ctrace_span * span , int level )
180
180
{
181
181
int min ;
182
182
int off = 1 + (level * 4 );
@@ -188,7 +188,7 @@ static void format_span(cfl_sds_t *buf, struct ctrace *ctx, struct ctrace_span *
188
188
189
189
min = off + 4 ;
190
190
191
- snprintf (tmp , sizeof (tmp ) - 1 , "%*s[span '%s']\n" , off , "" , span -> name );
191
+ snprintf (tmp , sizeof (tmp ) - 1 , "%*s[span #%i '%s']\n" , off , "" , id , span -> name );
192
192
sds_cat_safe (buf , tmp );
193
193
194
194
/* trace_id */
@@ -244,14 +244,29 @@ static void format_span(cfl_sds_t *buf, struct ctrace *ctx, struct ctrace_span *
244
244
span -> dropped_events_count );
245
245
sds_cat_safe (buf , tmp );
246
246
247
+ snprintf (tmp , sizeof (tmp ) - 1 , "%*s- dropped_links_count : %" PRIu32 "\n" , min , "" ,
248
+ span -> dropped_links_count );
249
+ sds_cat_safe (buf , tmp );
250
+
251
+ /* trace_state */
252
+ snprintf (tmp , sizeof (tmp ) - 1 , "%*s- trace_state : %s\n" , min , "" , span -> trace_state );
253
+ sds_cat_safe (buf , tmp );
254
+
255
+ /* schema_url */
256
+ if (span -> schema_url ) {
257
+ snprintf (tmp , sizeof (tmp ) - 1 , "%*s- schema_url : %s\n" , min , "" , span -> schema_url );
258
+ sds_cat_safe (buf , tmp );
259
+ }
260
+
247
261
/* Status */
248
262
snprintf (tmp , sizeof (tmp ) - 1 , "%*s- status:\n" , min , "" );
249
263
sds_cat_safe (buf , tmp );
250
- snprintf (tmp , sizeof (tmp ) - 1 , "%*s- code : %i\n" , min + 4 , "" , span -> status .code );
264
+ snprintf (tmp , sizeof (tmp ) - 1 , "%*s- code : %i\n" , min + 4 , "" , span -> status .code );
251
265
sds_cat_safe (buf , tmp );
252
266
253
267
if (span -> status .message ) {
254
268
snprintf (tmp , sizeof (tmp ) - 1 , "%*s- message : '%s'\n" , min + 4 , "" , span -> status .message );
269
+ sds_cat_safe (buf , tmp );
255
270
}
256
271
257
272
/* span attributes */
@@ -330,13 +345,14 @@ static void format_span(cfl_sds_t *buf, struct ctrace *ctx, struct ctrace_span *
330
345
else {
331
346
snprintf (tmp , sizeof (tmp ) - 1 , "%*s- attributes : " , off , "" );
332
347
sds_cat_safe (buf , tmp );
333
- format_attributes (buf , span -> attr -> kv , off );
348
+ format_attributes (buf , link -> attr -> kv , off );
334
349
}
335
350
}
336
351
}
337
352
338
353
static void format_spans (cfl_sds_t * buf , struct ctrace * ctx , struct cfl_list * spans )
339
354
{
355
+ int id = 0 ;
340
356
struct cfl_list * head ;
341
357
struct ctrace_span * span ;
342
358
@@ -347,7 +363,8 @@ static void format_spans(cfl_sds_t *buf, struct ctrace *ctx, struct cfl_list *sp
347
363
span = cfl_list_entry (head , struct ctrace_span , _head );
348
364
349
365
/* skip resource if there is no match */
350
- format_span (buf , ctx , span , 2 );
366
+ format_span (buf , ctx , id , span , 2 );
367
+ id ++ ;
351
368
}
352
369
}
353
370
@@ -360,7 +377,7 @@ static void format_instrumentation_scope(cfl_sds_t *buf,
360
377
cfl_sds_printf (buf , " - dropped_attributes_count: %i\n" , scope -> dropped_attr_count );
361
378
362
379
if (scope -> attr ) {
363
- cfl_sds_printf (buf , " - attributes:\n " );
380
+ cfl_sds_printf (buf , " - attributes:" );
364
381
format_attributes (buf , scope -> attr -> kv , 8 );
365
382
}
366
383
else {
@@ -430,10 +447,10 @@ cfl_sds_t ctr_encode_text_create(struct ctrace *ctx)
430
447
431
448
/* schema_url */
432
449
if (resource_span -> schema_url ) {
433
- cfl_sds_printf (& buf , " schema_url: %s\n" , resource_span -> schema_url );
450
+ cfl_sds_printf (& buf , " - schema_url: %s\n" , resource_span -> schema_url );
434
451
}
435
452
else {
436
- cfl_sds_printf (& buf , " schema_url: \"\"\n" );
453
+ cfl_sds_printf (& buf , " - schema_url: \"\"\n" );
437
454
}
438
455
439
456
/* scope spans */
0 commit comments