x
This commit is contained in:
parent
7fdeb1f666
commit
0e56b70f33
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 取
|
// 1. 先从 header 取
|
||||||
spanIDStr := c.GetHeader("TraceId")
|
spanIDStr := c.GetHeader("TraceId")
|
||||||
|
|
||||||
var spanID string
|
var spanID string
|
||||||
if spanIDStr == "" {
|
if spanIDStr == "" {
|
||||||
// 2. 没有就生成
|
// 2. 没有就生成
|
||||||
spanID = cast.ToString(NewUUID())
|
spanID = cast.ToString(NewUUID())
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4. 放进 context(后续 handler 可用)
|
// 4. 放进 context(后续 handler 可用)
|
||||||
c.Set("X-Span-ID", spanID)
|
c.Set("X-Span-ID", spanID)
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user