feat: add support for request ID tracking across services

- Implemented request ID handling in various services and handlers to improve traceability of requests.
- Added new AuthOptions endpoint to expose WxWork and OIDC configuration options.
- Updated message and event logging to include request ID for better debugging.
- Enhanced login form to dynamically show available authentication options based on server configuration.
- Introduced utility functions for normalizing and ensuring valid request IDs.
- Updated tests to verify request ID functionality in message sending and event logging.
This commit is contained in:
mlogclub
2026-05-27 22:18:43 +08:00
parent 498932de61
commit c246b85a9e
30 changed files with 504 additions and 59 deletions
+13
View File
@@ -3,6 +3,7 @@ package httpx
import (
"cs-agent/internal/pkg/httpx/params"
"cs-agent/internal/pkg/openidentity"
"cs-agent/internal/pkg/tracex"
"github.com/gin-gonic/gin"
"github.com/mlogclub/simple/common/strs"
@@ -31,3 +32,15 @@ func GetChannelID(ctx *gin.Context) string {
}
return ""
}
func GetRequestID(ctx *gin.Context) string {
if ctx == nil {
return ""
}
if value, ok := ctx.Get(tracex.GinRequestIDKey); ok {
if requestID, ok := value.(string); ok {
return tracex.NormalizeRequestID(requestID)
}
}
return tracex.NormalizeRequestID(ctx.GetHeader(tracex.RequestIDHeader))
}