This commit is contained in:
lingxin 2026-04-07 16:46:14 +08:00
parent 7fdeb1f666
commit 905ef68fb4
2 changed files with 15 additions and 2 deletions

15
.idea/git_toolbox_prj.xml generated Normal file
View 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>

View File

@ -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)