@@ -111,7 +111,7 @@ describe('log-request plugin', () => {
111111 expect ( requestLogLine ) . not . toContain ( '"request_id"' )
112112 } )
113113
114- it ( 'threads traceId from a valid traceparent header into the request log data' , async ( ) => {
114+ it ( 'threads traceId and spanId from a valid traceparent header into the request log data' , async ( ) => {
115115 const response = await app . inject ( {
116116 method : 'GET' ,
117117 url : '/request-log' ,
@@ -127,10 +127,12 @@ describe('log-request plugin', () => {
127127
128128 const requestLog = JSON . parse ( requestLogLine ?? '{}' )
129129 expect ( requestLog . traceId ) . toBe ( '4bf92f3577b34da6a3ce929d0e0e4736' )
130+ expect ( requestLog . spanId ) . toBe ( '00f067aa0ba902b7' )
130131 expect ( requestLog ) . not . toHaveProperty ( 'trace_id' )
132+ expect ( requestLog ) . not . toHaveProperty ( 'span_id' )
131133 } )
132134
133- it ( 'logs an empty traceId when traceparent is malformed' , async ( ) => {
135+ it ( 'logs empty traceId and spanId values when traceparent is malformed' , async ( ) => {
134136 const response = await app . inject ( {
135137 method : 'GET' ,
136138 url : '/request-log' ,
@@ -146,10 +148,12 @@ describe('log-request plugin', () => {
146148
147149 const requestLog = JSON . parse ( requestLogLine ?? '{}' )
148150 expect ( requestLog . traceId ) . toBe ( '' )
151+ expect ( requestLog . spanId ) . toBe ( '' )
149152 expect ( requestLog ) . not . toHaveProperty ( 'trace_id' )
153+ expect ( requestLog ) . not . toHaveProperty ( 'span_id' )
150154 } )
151155
152- it ( 'logs an empty traceId when traceparent is missing' , async ( ) => {
156+ it ( 'logs empty traceId and spanId values when traceparent is missing' , async ( ) => {
153157 const response = await app . inject ( {
154158 method : 'GET' ,
155159 url : '/request-log' ,
@@ -162,7 +166,9 @@ describe('log-request plugin', () => {
162166
163167 const requestLog = JSON . parse ( requestLogLine ?? '{}' )
164168 expect ( requestLog . traceId ) . toBe ( '' )
169+ expect ( requestLog . spanId ) . toBe ( '' )
165170 expect ( requestLog ) . not . toHaveProperty ( 'trace_id' )
171+ expect ( requestLog ) . not . toHaveProperty ( 'span_id' )
166172 } )
167173
168174 it ( 'threads tenant context into the request log data' , async ( ) => {
0 commit comments