@@ -56,9 +56,6 @@ struct span {
5656 /* Our own id */
5757 u64 id ;
5858
59- /* 0 if we have no parent. */
60- u64 parent_id ;
61-
6259 /* The trace_id for this span and all its children. */
6360 u64 trace_id_hi , trace_id_lo ;
6461
@@ -73,12 +70,6 @@ struct span {
7370 const char * name ;
7471
7572 bool suspended ;
76- /* Indicate whether this is a remote span, i.e., it was
77- inherited by some other process, which is in charge of
78- emitting the span. This just means that we don't emit this
79- span ourselves, but we want to add child spans to the remote
80- span. */
81- bool remote ;
8273};
8374
8475static struct span * active_spans = NULL ;
@@ -104,7 +95,6 @@ static void init_span(struct span *s,
10495 s -> trace_id_hi = pseudorand_u64 ();
10596 s -> trace_id_lo = pseudorand_u64 ();
10697 } else {
107- s -> parent_id = current -> id ;
10898 s -> trace_id_hi = current -> trace_id_hi ;
10999 s -> trace_id_lo = current -> trace_id_lo ;
110100 }
@@ -134,7 +124,6 @@ static void trace_inject_traceparent(void)
134124 assert (current );
135125
136126 init_span (current , trace_key (active_spans ), "" , NULL );
137- current -> remote = true;
138127 assert (current && !current -> parent );
139128
140129 if (!hex_decode (traceparent + 3 , 16 , & trace_hi , sizeof (trace_hi ))
@@ -271,12 +260,6 @@ static void trace_emit(struct span *s)
271260 char buffer [MAX_BUF_SIZE + 1 ];
272261 size_t len ;
273262
274- /* If this is a remote span it's not up to us to emit it. Make
275- * this a no-op. `trace_span_end` will take care of cleaning
276- * the in-memory span up. */
277- if (s -> remote )
278- return ;
279-
280263 snprintf (span_id , sizeof (span_id ), "%016" PRIx64 , s -> id );
281264 len = snprintf (buffer , MAX_BUF_SIZE ,
282265 "[{\"id\":\"%s\",\"name\":\"%s\","
@@ -287,7 +270,7 @@ static void trace_emit(struct span *s)
287270 if (s -> parent != NULL ) {
288271 len += snprintf (buffer + len , MAX_BUF_SIZE - len ,
289272 "\"parentId\":\"%016" PRIx64 "\"," ,
290- s -> parent_id );
273+ s -> parent -> id );
291274 if (len > MAX_BUF_SIZE )
292275 len = MAX_BUF_SIZE ;
293276 }
0 commit comments