Skip to content
This repository has been archived by the owner on Oct 3, 2019. It is now read-only.

Commit

Permalink
Show .pprof dir, enable profile debug output
Browse files Browse the repository at this point in the history
  • Loading branch information
csstaub committed Aug 16, 2016
1 parent 6b77bba commit 634d70b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ func (kwfs KeywhizFs) metricsJSON() []byte {

func (kwfs KeywhizFs) profile(name string) []byte {
var b bytes.Buffer
err := pprof.Lookup(name).WriteTo(&b, 0)
// Set "1" to enable human-readable debug output
err := pprof.Lookup(name).WriteTo(&b, 1)
if err != nil {
kwfs.Warnf("Error writing profile: %v", err)
}
Expand Down Expand Up @@ -332,6 +333,7 @@ func (kwfs KeywhizFs) openDir(name string, context *fuse.Context) (stream []fuse
entries = kwfs.secretsDirListing(
fuse.DirEntry{Name: ".clear_cache", Mode: fuse.S_IFREG},
fuse.DirEntry{Name: ".json", Mode: fuse.S_IFDIR},
fuse.DirEntry{Name: ".pprof", Mode: fuse.S_IFDIR},
fuse.DirEntry{Name: ".running", Mode: fuse.S_IFREG},
fuse.DirEntry{Name: ".version", Mode: fuse.S_IFREG})
case ".json":
Expand Down
2 changes: 2 additions & 0 deletions fs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ func (suite *FsTestSuite) TestSpecialFileAttrs() {
{".running", -1, 0444 | fuse.S_IFREG, true},
{".clear_cache", 0, 0440 | fuse.S_IFREG, false},
{".json", 4096, 0700 | fuse.S_IFDIR, false},
{".pprof", 4096, 0700 | fuse.S_IFDIR, false},
{".json/secret", 4096, 0700 | fuse.S_IFDIR, false},
{".json/secrets", -1, 0400 | fuse.S_IFREG, true},
}
Expand Down Expand Up @@ -250,6 +251,7 @@ func (suite *FsTestSuite) TestOpenDir() {
".running": true,
".clear_cache": true,
".json": false,
".pprof": false,
"General_Password..0be68f903f8b7d86": true,
"Nobody_PgPass": true,
},
Expand Down

0 comments on commit 634d70b

Please sign in to comment.