@@ -76,6 +76,7 @@ func contextWithRootTraceContext(ctx context.Context, ev json.RawMessage, mergeX
76
76
mergedTraceContext := TraceContext {}
77
77
mergedTraceContext [traceIDHeader ] = datadogTraceContext [traceIDHeader ]
78
78
mergedTraceContext [samplingPriorityHeader ] = datadogTraceContext [samplingPriorityHeader ]
79
+ fmt .Printf ("[DEBUG] [context.go] [contextWithRootTraceContext()] Sampling priority: %s\n " , datadogTraceContext [samplingPriorityHeader ])
79
80
mergedTraceContext [parentIDHeader ] = xrayTraceContext [parentIDHeader ]
80
81
return context .WithValue (ctx , traceContextKey , mergedTraceContext ), nil
81
82
}
@@ -97,6 +98,7 @@ func ConvertCurrentXrayTraceContext(ctx context.Context) TraceContext {
97
98
newTraceContext := map [string ]string {}
98
99
newTraceContext [traceIDHeader ] = xrayTraceContext [traceIDHeader ]
99
100
newTraceContext [samplingPriorityHeader ] = xrayTraceContext [samplingPriorityHeader ]
101
+ fmt .Printf ("[DEBUG] [context.go] [ConvertCurrentXrayTraceContext()] Sampling priority: %s\n " , xrayTraceContext [samplingPriorityHeader ])
100
102
newTraceContext [parentIDHeader ] = parentID
101
103
102
104
return newTraceContext
@@ -113,6 +115,7 @@ func createDummySubsegmentForXrayConverter(ctx context.Context, traceCtx TraceCo
113
115
traceID := traceCtx [traceIDHeader ]
114
116
parentID := traceCtx [parentIDHeader ]
115
117
sampled := traceCtx [samplingPriorityHeader ]
118
+ fmt .Printf ("[DEBUG] [context.go] [createDummySubsegmentForXrayConverter()] Sampling priority: %s\n " , sampled )
116
119
metadata := map [string ]string {
117
120
"trace-id" : traceID ,
118
121
"parent-id" : parentID ,
@@ -151,13 +154,16 @@ func getTraceContext(ctx context.Context, headers map[string]string) (TraceConte
151
154
}
152
155
153
156
samplingPriority := headers [samplingPriorityHeader ]
157
+ fmt .Printf ("[DEBUG] [context.go] [getTraceContext() 1] Sampling priority: %s\n " , samplingPriority )
154
158
if samplingPriority == "" {
155
159
if val , ok := ctx .Value (extension .DdSamplingPriority ).(string ); ok {
156
160
samplingPriority = val
161
+ fmt .Printf ("[DEBUG] [context.go] [getTraceContext() 2] Sampling priority: %s\n " , samplingPriority )
157
162
}
158
163
}
159
164
if samplingPriority == "" {
160
165
samplingPriority = "1" //sampler-keep
166
+ fmt .Printf ("[DEBUG] [context.go] [getTraceContext() 3] Sampling priority empty, keeping.\n " )
161
167
}
162
168
163
169
tc [samplingPriorityHeader ] = samplingPriority
@@ -205,6 +211,7 @@ func convertXrayTraceContextFromLambdaContext(ctx context.Context) (TraceContext
205
211
return traceCtx , fmt .Errorf ("Couldn't read parent id from X-Ray: %v" , err )
206
212
}
207
213
samplingPriority := convertXRaySamplingDecision (header .SamplingDecision )
214
+ fmt .Printf ("[DEBUG] [context.go] [convertXrayTraceContextFromLambdaContext()] Sampling priority: %s\n " , samplingPriority )
208
215
209
216
traceCtx [traceIDHeader ] = traceID
210
217
traceCtx [parentIDHeader ] = parentID
0 commit comments