x
This commit is contained in:
parent
7fdeb1f666
commit
905ef68fb4
15
.idea/git_toolbox_prj.xml
generated
Normal file
15
.idea/git_toolbox_prj.xml
generated
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GitToolBoxProjectSettings">
|
||||
<option name="commitMessageIssueKeyValidationOverride">
|
||||
<BoolValueOverride>
|
||||
<option name="enabled" value="true" />
|
||||
</BoolValueOverride>
|
||||
</option>
|
||||
<option name="commitMessageValidationEnabledOverride">
|
||||
<BoolValueOverride>
|
||||
<option name="enabled" value="true" />
|
||||
</BoolValueOverride>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
@ -91,13 +91,11 @@ func GinLogger() gin.HandlerFunc {
|
||||
|
||||
// 1. 先从 header 取
|
||||
spanIDStr := c.GetHeader("TraceId")
|
||||
|
||||
var spanID string
|
||||
if spanIDStr == "" {
|
||||
// 2. 没有就生成
|
||||
spanID = cast.ToString(NewUUID())
|
||||
}
|
||||
|
||||
// 4. 放进 context(后续 handler 可用)
|
||||
c.Set("X-Span-ID", spanID)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user