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: log storage and visualization #297

Merged
merged 1 commit into from
Sep 4, 2024

Conversation

wwcchh0123
Copy link
Contributor

No description provided.

Copy link

netlify bot commented Aug 30, 2024

Deploy Preview for reviewbot-x canceled.

Name Link
🔨 Latest commit 6ba6c64
🔍 Latest deploy log https://app.netlify.com/sites/reviewbot-x/deploys/66d6b9820f95e60008a30455

Copy link

codecov bot commented Aug 30, 2024

Codecov Report

Attention: Patch coverage is 0% with 73 lines in your changes missing coverage. Please review.

Project coverage is 36.17%. Comparing base (c0ebeab) to head (39abe89).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
internal/storage/local.go 0.00% 29 Missing ⚠️
server.go 0.00% 14 Missing ⚠️
main.go 0.00% 10 Missing ⚠️
internal/linters/linters.go 0.00% 6 Missing and 1 partial ⚠️
internal/storage/aws.go 0.00% 6 Missing ⚠️
internal/storage/git.go 0.00% 6 Missing ⚠️
internal/linters/github.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #297      +/-   ##
==========================================
- Coverage   37.60%   36.17%   -1.44%     
==========================================
  Files          23       26       +3     
  Lines        1819     1891      +72     
==========================================
  Hits          684      684              
- Misses       1053     1124      +71     
- Partials       82       83       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@wwcchh0123 wwcchh0123 force-pushed the feat/logstorage_v2 branch 3 times, most recently from 8855b50 to 39abe89 Compare August 30, 2024 09:35
internal/storage/aws.go Outdated Show resolved Hide resolved
internal/storage/local.go Outdated Show resolved Hide resolved
@wwcchh0123 wwcchh0123 force-pushed the feat/logstorage_v2 branch 2 times, most recently from a114940 to c3850bf Compare September 3, 2024 07:00
return nil, fmt.Errorf("file does not exist: %s", filePath)
}

g.mu.Lock()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

应该不用加锁?

defer file.Close()

select {
case <-ctx.Done():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不支持cancel应该还好吧?

@@ -149,6 +151,7 @@ func main() {

mux := http.NewServeMux()
mux.Handle("/", s)
mux.Handle("/view/", HandleView(storage.NewLocalStorage()))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

storage 应该是Server的一部分

Comment on lines +263 to +283
logStorageConfig := s.config.LogStorageConfig
if len(logStorageConfig.CustomRemoteConfigs) == 0 {
agent.LogStorage = storage.NewLocalStorage()
} else {
for remoteName, storageConfig := range logStorageConfig.CustomRemoteConfigs {
switch remoteName {
case "github":
agent.LogStorage = storage.NewGitubStorage(storageConfig.(config.GithubConfig))
default:
log.Warnf("%s was wrong storageType", remoteName)
}
}
}

agent.LinterUuid = uuid.New().String()
agent.LinterLogStoragePath = fmt.Sprintf("linter-logs/%s/%d/%s/log-build.txt", *agent.PullRequestEvent.Repo.Name, *agent.PullRequestEvent.Number, agent.LinterUuid)
agent.LinterLogViewUrl = "http://" + s.config.ServerAddr + "/view/" + agent.LinterLogStoragePath

// s.config.ServerAddr = "localhost:8888"
// log.Debugf("---------LinterLogViewUrl--------- : %s", agent.LinterLogViewUrl)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

跟主逻辑的交互太多了,感觉解耦的不够

@CarlJi CarlJi merged commit 87a43a5 into qiniu:master Sep 4, 2024
5 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants