This is an automated email from the ASF dual-hosted git repository.
warren pushed a commit to branch feat/q-dev-logging-dashboard-enrichment
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to
refs/heads/feat/q-dev-logging-dashboard-enrichment by this push:
new 84556cbc7 fix(q-dev): normalize logging user IDs to match CSV short
UUID format
84556cbc7 is described below
commit 84556cbc7260c65d1f84a84a8591537bf6b58526
Author: warren <[email protected]>
AuthorDate: Sun Mar 15 11:31:05 2026 +0800
fix(q-dev): normalize logging user IDs to match CSV short UUID format
Logging data uses "d-{directoryId}.{UUID}" format while CSV user-report
uses plain "{UUID}". Strip the "d-xxx." prefix so the same user maps to
one user_id across both data sources.
---
backend/plugins/q_dev/tasks/s3_logging_extractor.go | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/backend/plugins/q_dev/tasks/s3_logging_extractor.go
b/backend/plugins/q_dev/tasks/s3_logging_extractor.go
index f25cc9659..9a782fd80 100644
--- a/backend/plugins/q_dev/tasks/s3_logging_extractor.go
+++ b/backend/plugins/q_dev/tasks/s3_logging_extractor.go
@@ -196,12 +196,13 @@ func processChatRecord(taskCtx plugin.SubTaskContext, db
dal.Dal, raw json.RawMe
ts = time.Now()
}
+ userId := normalizeUserId(record.Request.UserID)
chatLog := &models.QDevChatLog{
ConnectionId: fileMeta.ConnectionId,
ScopeId: fileMeta.ScopeId,
RequestId: record.Response.RequestID,
- UserId: record.Request.UserID,
- DisplayName: resolveDisplayName(taskCtx.GetLogger(),
record.Request.UserID, identityClient),
+ UserId: userId,
+ DisplayName: resolveDisplayName(taskCtx.GetLogger(),
userId, identityClient),
Timestamp: ts,
ChatTriggerType: record.Request.ChatTriggerType,
HasCustomization: record.Request.CustomizationArn != nil &&
*record.Request.CustomizationArn != "",
@@ -282,12 +283,13 @@ func processCompletionRecord(taskCtx
plugin.SubTaskContext, db dal.Dal, raw json
ts = time.Now()
}
+ userId := normalizeUserId(record.Request.UserID)
completionLog := &models.QDevCompletionLog{
ConnectionId: fileMeta.ConnectionId,
ScopeId: fileMeta.ScopeId,
RequestId: record.Response.RequestID,
- UserId: record.Request.UserID,
- DisplayName: resolveDisplayName(taskCtx.GetLogger(),
record.Request.UserID, identityClient),
+ UserId: userId,
+ DisplayName: resolveDisplayName(taskCtx.GetLogger(),
userId, identityClient),
Timestamp: ts,
FileName: record.Request.FileName,
FileExtension: filepath.Ext(record.Request.FileName),
@@ -298,6 +300,16 @@ func processCompletionRecord(taskCtx
plugin.SubTaskContext, db dal.Dal, raw json
return errors.Default.Wrap(db.CreateOrUpdate(completionLog), "failed to
save completion log")
}
+// normalizeUserId strips the "d-{directoryId}." prefix from Identity Center
user IDs
+// so that logging user IDs match the short UUID format used in user-report
CSVs.
+// e.g. "d-9067deb161.6478a4a8-60a1-70d9-37bc-6aae85f6746a" →
"6478a4a8-60a1-70d9-37bc-6aae85f6746a"
+func normalizeUserId(userId string) string {
+ if idx := strings.LastIndex(userId, "."); idx != -1 &&
strings.HasPrefix(userId, "d-") {
+ return userId[idx+1:]
+ }
+ return userId
+}
+
var ExtractQDevLoggingDataMeta = plugin.SubTaskMeta{
Name: "extractQDevLoggingData",
EntryPoint: ExtractQDevLoggingData,