-
Notifications
You must be signed in to change notification settings - Fork 15
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
Conversation
✅ Deploy Preview for reviewbot-x canceled.
|
Codecov ReportAttention: Patch coverage is
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. |
8855b50
to
39abe89
Compare
a114940
to
c3850bf
Compare
c3850bf
to
6ba6c64
Compare
return nil, fmt.Errorf("file does not exist: %s", filePath) | ||
} | ||
|
||
g.mu.Lock() |
There was a problem hiding this comment.
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(): |
There was a problem hiding this comment.
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())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
storage 应该是Server的一部分
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) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
跟主逻辑的交互太多了,感觉解耦的不够
No description provided.