Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(tapd): add more log when converting unicode #8164

Merged
merged 2 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion backend/plugins/tapd/tasks/bug_changelog_extractor.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ var ExtractBugChangelogMeta = plugin.SubTaskMeta{

func ExtractBugChangelog(taskCtx plugin.SubTaskContext) errors.Error {
rawDataSubTaskArgs, data := CreateRawDataSubTaskArgs(taskCtx, RAW_BUG_CHANGELOG_TABLE)
logger := taskCtx.GetLogger()
extractor, err := api.NewApiExtractor(api.ApiExtractorArgs{
RawDataSubTaskArgs: *rawDataSubTaskArgs,
Extract: func(row *api.RawData) ([]interface{}, errors.Error) {
Expand All @@ -47,6 +48,7 @@ func ExtractBugChangelog(taskCtx plugin.SubTaskContext) errors.Error {
}
err := errors.Convert(json.Unmarshal(row.Data, &bugChangelogBody))
if err != nil {
logger.Error(err, "unmarshal: %s, err: %s", row.Data, err)
return nil, err
}
bugChangelog := bugChangelogBody.BugChange
Expand All @@ -62,11 +64,12 @@ func ExtractBugChangelog(taskCtx plugin.SubTaskContext) errors.Error {
}
err = convertUnicode(item)
if err != nil {
return nil, err
logger.Error(err, "convert unicode: %s, err: %s", item, err)
}
if item.Field == "iteration_id" {
iterationFrom, iterationTo, err := parseIterationChangelog(taskCtx, item.ValueBeforeParsed, item.ValueAfterParsed)
if err != nil {
logger.Error(err, "parseIterationChangelog: %s, err: %s", item, err)
return nil, err
}
item.IterationIdFrom = iterationFrom
Expand Down
5 changes: 3 additions & 2 deletions backend/plugins/tapd/tasks/story_changelog_extractor.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ var ExtractStoryChangelogMeta = plugin.SubTaskMeta{
}

func ExtractStoryChangelog(taskCtx plugin.SubTaskContext) errors.Error {
logger := taskCtx.GetLogger()
rawDataSubTaskArgs, data := CreateRawDataSubTaskArgs(taskCtx, RAW_STORY_CHANGELOG_TABLE)
extractor, err := api.NewApiExtractor(api.ApiExtractorArgs{
RawDataSubTaskArgs: *rawDataSubTaskArgs,
Expand Down Expand Up @@ -89,7 +90,7 @@ func ExtractStoryChangelog(taskCtx plugin.SubTaskContext) errors.Error {
}
err = convertUnicode(&item)
if err != nil {
return nil, err
logger.Error(err, "convert unicode: %s, err: %s", item, err)
}
results = append(results, &item)
}
Expand All @@ -103,7 +104,7 @@ func ExtractStoryChangelog(taskCtx plugin.SubTaskContext) errors.Error {
}
err = convertUnicode(&item)
if err != nil {
return nil, err
logger.Error(err, "convert unicode: %s, err: %s", item, err)
}
if item.Field == "iteration_id" {
// some users' tapd will not return iteration_id_from/iteration_id_to
Expand Down
5 changes: 3 additions & 2 deletions backend/plugins/tapd/tasks/task_changelog_extractor.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ var ExtractTaskChangelogMeta = plugin.SubTaskMeta{

func ExtractTaskChangelog(taskCtx plugin.SubTaskContext) errors.Error {
rawDataSubTaskArgs, data := CreateRawDataSubTaskArgs(taskCtx, RAW_TASK_CHANGELOG_TABLE)
logger := taskCtx.GetLogger()
extractor, err := api.NewApiExtractor(api.ApiExtractorArgs{
RawDataSubTaskArgs: *rawDataSubTaskArgs,
Extract: func(row *api.RawData) ([]interface{}, errors.Error) {
Expand Down Expand Up @@ -92,7 +93,7 @@ func ExtractTaskChangelog(taskCtx plugin.SubTaskContext) errors.Error {
}
err = convertUnicode(&item)
if err != nil {
return nil, err
logger.Error(err, "convert unicode: %s, err: %s", item, err)
}
default:
item.ConnectionId = data.Options.ConnectionId
Expand All @@ -103,7 +104,7 @@ func ExtractTaskChangelog(taskCtx plugin.SubTaskContext) errors.Error {
}
err = convertUnicode(&item)
if err != nil {
return nil, err
logger.Error(err, "convert unicode: %s, err: %s", item, err)
}
if item.Field == "iteration_id" {
iterationFrom, iterationTo, err := parseIterationChangelog(taskCtx, item.ValueBeforeParsed, item.ValueAfterParsed)
Expand Down
Loading