-
Notifications
You must be signed in to change notification settings - Fork 626
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(frontend): adds ability to export to flamegraph.com (#799)
* feat(frontend) adds ability to export to flamegraph.com * fests fix * adds flamegraph.com export to comparison view as well
- Loading branch information
1 parent
c687f83
commit a3828bc
Showing
5 changed files
with
117 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package server | ||
|
||
import ( | ||
"fmt" | ||
"io" | ||
"net/http" | ||
) | ||
|
||
type Payload struct { | ||
Name string | ||
Profile string | ||
Type string | ||
} | ||
|
||
func (ctrl *Controller) exportHandler(w http.ResponseWriter, r *http.Request) { | ||
resp, err := http.Post("https://flamegraph.com/api/upload/v1", "application/json", r.Body) | ||
if err != nil { | ||
ctrl.writeError(w, 500, err, fmt.Sprintf("could not upload profile: %v", err)) | ||
return | ||
} | ||
defer resp.Body.Close() | ||
w.Header().Set("Content-Type", "application/json") | ||
w.WriteHeader(200) | ||
io.Copy(w, resp.Body) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,6 +51,7 @@ function PyroscopeApp(props) { | |
exportJSON | ||
exportPprof | ||
exportHTML | ||
exportFlamegraphDotCom | ||
/> | ||
} | ||
/> | ||
|