refactor: Update tenant ID handling across the application

This commit is contained in:
wizardchen
2025-11-25 16:30:54 +08:00
parent 9f6f5f5773
commit 64c44c9e27
78 changed files with 437 additions and 601 deletions
+1 -1
View File
@@ -104,7 +104,7 @@ func Auth(tenantService interfaces.TenantService, userService interfaces.UserSer
// Verify API key validity (matches the one in database)
t, err := tenantService.GetTenantByID(c.Request.Context(), tenantID)
if err != nil {
log.Printf("Error getting tenant by ID: %v, tenantID: %d, apiKey: %s", err, tenantID, apiKey)
log.Printf("Error getting tenant by ID: %v, tenantID: %d", err, tenantID)
c.JSON(http.StatusUnauthorized, gin.H{
"error": "Unauthorized: invalid API key",
})
-7
View File
@@ -11,7 +11,6 @@ import (
"go.opentelemetry.io/otel/codes"
"github.com/Tencent/WeKnora/internal/tracing"
"github.com/Tencent/WeKnora/internal/types"
)
// Custom ResponseWriter to capture response content
@@ -36,12 +35,6 @@ func TracingMiddleware() gin.HandlerFunc {
return
}
// Get request ID as Span ID
requestID := c.GetString(string(types.RequestIDContextKey))
if requestID == "" {
requestID = c.GetHeader("X-Request-ID")
}
// Create new span
spanName := fmt.Sprintf("%s %s", c.Request.Method, c.FullPath())
ctx, span := tracing.ContextWithSpan(c.Request.Context(), spanName)