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

Store bug reports in separate directories #3150

Merged
merged 2 commits into from Feb 7, 2017

Conversation

@Kegsay
Copy link
Contributor

Kegsay commented Feb 6, 2017

And remove the long filenames now that there is a directory above them.

Copy link
Member

dbkr left a comment

Admittedly I'm not familiar with Go and its norms, but I find this quite difficult to understand, especially lines like if _, err := os.Stat(fpath); err == nil which has an awful lot going on for a single line.

@@ -37,8 +37,9 @@ func respond(code int, w http.ResponseWriter) {
w.Write([]byte("{}"))
}

func gzipAndSave(data []byte, fpath string) error {
fpath = filepath.Join("bugs", fpath)
func gzipAndSave(data []byte, dirname, fpath string) error {

This comment has been minimized.

Copy link
@dbkr

dbkr Feb 6, 2017

Member

Unclear about what is the norm with Go, but does dirname not get a type?

This comment has been minimized.

Copy link
@Kegsay

Kegsay Feb 6, 2017

Author Contributor

It does. Go allows you to omit types on function declarations if subsequent ones are the same type. E.g:

func foo(a int, b, c string) {
  // ...
}

Is the same as:

func foo(a int, b string, c string) {
  // ...
}

This comment has been minimized.

Copy link
@dbkr

dbkr Feb 7, 2017

Member

That's... terrible, but ok.

respond(500, w)
return
}
for i, log := range p.Logs {
if err := gzipAndSave([]byte(log.Lines), fmt.Sprintf("%s-%d.log.gz", prefix, i)); err != nil {
if err := gzipAndSave([]byte(log.Lines), prefix, fmt.Sprintf("logs-%d.log.gz", i)); err != nil {

This comment has been minimized.

Copy link
@dbkr

dbkr Feb 6, 2017

Member

What's the reason for saving each one as a separate file rather than concatenating them all together (perhaps even with a separator)? Do the logs have timestamps?

This comment has been minimized.

Copy link
@dbkr

dbkr Feb 6, 2017

Member

Also I would suggest some level of slightly deeper nesting, like at least YYYY-MM-DD/HHMMSS/ otherwise you're going to find that before long, the directory kills your terminal if you type ls.

This comment has been minimized.

Copy link
@dbkr

dbkr Feb 6, 2017

Member

(and you already know my view on using timestamps as IDs, and not particularly fine-grained timestamps at that)

This comment has been minimized.

Copy link
@Kegsay

Kegsay Feb 6, 2017

Author Contributor

What's the reason for saving each one as a separate file rather than concatenating them all together (perhaps even with a separator)? Do the logs have timestamps?

The logs have timestamps. We cannot concatenate all the files together as that breaks causality. The number of files corresponds to the number of sessions where a session is effectively a browser tab. vdh wants to be able to see logs for each browser tab side-by-side rather than muxxed together. A session's position in the list of files is governed by the most-recent log timestamp.

Also I would suggest some level of slightly deeper nesting, like at least YYYY-MM-DD/HHMMSS/ otherwise you're going to find that before long, the directory kills your terminal if you type ls.

Good idea 👍

(and you already know my view on using timestamps as IDs, and not particularly fine-grained timestamps at that)

Well given we are now representing timestamps as directories, I don't mind having a monotonically increasing integer as part of the filename, though it might be weird to see 2 bug reports in the same directory?

This comment has been minimized.

Copy link
@dbkr

dbkr Feb 7, 2017

Member

Yep, I'm assuming you'd put the monotonically increasing integer in the last directory name. Good point about multiple sessions.

@dbkr dbkr assigned Kegsay and unassigned dbkr Feb 6, 2017
@Kegsay

This comment has been minimized.

Copy link
Contributor Author

Kegsay commented Feb 7, 2017

Now nested as bugs/2017-02-07/163412

@Kegsay Kegsay assigned dbkr and unassigned Kegsay Feb 7, 2017
@dbkr
dbkr approved these changes Feb 7, 2017
Copy link
Member

dbkr left a comment

Fair enough

@dbkr dbkr merged commit be71da5 into develop Feb 7, 2017
1 of 2 checks passed
1 of 2 checks passed
continuous-integration/travis-ci/push The Travis CI build failed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.