This repository was archived by the owner on Jan 21, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -180,6 +180,10 @@ export class StackdriverTracer implements Tracer {
180180 parsedContext = util . parseContextFromHeader ( options . traceContext ) ;
181181 }
182182 if ( parsedContext ) {
183+ if ( parsedContext . options === undefined ) {
184+ // If there are no incoming option flags, default to 0x1.
185+ parsedContext . options = 1 ;
186+ }
183187 Object . assign ( incomingTraceContext , parsedContext ) ;
184188 } else if (
185189 this . config ! . contextHeaderBehavior ===
Original file line number Diff line number Diff line change @@ -275,6 +275,17 @@ describe('Trace Interface', () => {
275275 testTraceModule . getSpans ( span => span . name === 'root3' ) . length , 0 ) ;
276276 } ) ;
277277
278+ it ( 'should trace if no option flags are provided' , ( ) => {
279+ createTraceAgent ( { enhancedDatabaseReporting : false } )
280+ . runInRootSpan (
281+ { name : 'root' , traceContext : '123456/667' } , ( rootSpan ) => {
282+ rootSpan . endSpan ( ) ;
283+ } ) ;
284+ const foundTrace =
285+ testTraceModule . getOneTrace ( trace => trace . traceId === '123456' ) ;
286+ assert . strictEqual ( foundTrace . spans . length , 1 ) ;
287+ } ) ;
288+
278289 describe ( 'getting response trace context' , ( ) => {
279290 it ( 'should behave as expected' , ( ) => {
280291 const fakeTraceId = 'ffeeddccbbaa99887766554433221100' ;
You can’t perform that action at this time.
0 commit comments