Skip to content

Store bug reports in separate directories#3150

Merged
dbkr merged 2 commits intodevelopfrom
kegan/dir-per-bug
Feb 7, 2017
Merged

Store bug reports in separate directories#3150
dbkr merged 2 commits intodevelopfrom
kegan/dir-per-bug

Conversation

@kegsay
Copy link
Copy Markdown
Contributor

@kegsay kegsay commented Feb 6, 2017

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

Copy link
Copy Markdown
Member

@dbkr dbkr left a comment

Choose a reason for hiding this comment

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

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.

Comment thread scripts/rageshake.go

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

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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) {
  // ...
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

That's... terrible, but ok.

Comment thread scripts/rageshake.go
}
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 {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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
Copy link
Copy Markdown
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
Copy link
Copy Markdown
Member

@dbkr dbkr left a comment

Choose a reason for hiding this comment

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

Fair enough

@dbkr dbkr merged commit be71da5 into develop Feb 7, 2017
@t3chguy t3chguy deleted the kegan/dir-per-bug branch May 12, 2022 08:56
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