@@ -47,14 +47,12 @@ describe('getModifiedData', () => {
47
47
const sampleUint8Arr = new Uint8Array ( Buffer . from ( sampleText ) ) ;
48
48
const expectedExecutionContext = {
49
49
executionId : 'testExecutionId' ,
50
- traceId : 'testTraceId' ,
51
50
spanId : 'testSpanId' ,
52
51
} ;
53
52
const expectedMetadata = {
54
53
'logging.googleapis.com/labels' : {
55
54
execution_id : 'testExecutionId' ,
56
55
} ,
57
- 'logging.googleapis.com/trace' : 'testTraceId' ,
58
56
'logging.googleapis.com/spanId' : 'testSpanId' ,
59
57
} ;
60
58
const expectedTextOutput =
@@ -102,13 +100,31 @@ describe('getModifiedData', () => {
102
100
user_label_1 : 'value_1' ,
103
101
execution_id : 'testExecutionId' ,
104
102
} ,
105
- 'logging.googleapis.com/trace' : 'testTraceId' ,
106
103
'logging.googleapis.com/spanId' : 'testSpanId' ,
107
104
} ) + '\n' ;
108
105
const modifiedData = getModifiedData ( data ) ;
109
106
assert . equal ( modifiedData , expectedOutput ) ;
110
107
} ) ;
111
108
109
+ it ( 'json with user span id' , ( ) => {
110
+ const data = JSON . stringify ( {
111
+ text : 'default text.' ,
112
+ component : 'arbitrary-property' ,
113
+ 'logging.googleapis.com/spanId' : 'mySpanId' ,
114
+ } ) ;
115
+ const expectedOutput =
116
+ JSON . stringify ( {
117
+ text : 'default text.' ,
118
+ component : 'arbitrary-property' ,
119
+ 'logging.googleapis.com/spanId' : 'mySpanId' ,
120
+ 'logging.googleapis.com/labels' : {
121
+ execution_id : 'testExecutionId' ,
122
+ } ,
123
+ } ) + '\n' ;
124
+ const modifiedData = getModifiedData ( data ) ;
125
+ assert . equal ( modifiedData , expectedOutput ) ;
126
+ } ) ;
127
+
112
128
it ( 'uint8array' , ( ) => {
113
129
const modifiedData = getModifiedData ( sampleUint8Arr ) ;
114
130
assert . equal ( modifiedData , expectedTextOutput ) ;
0 commit comments