-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Code to support react based UI for diagnostics: * pprof, prometheus and diagnistics rationalized to use a single router (i.e. they can all run in the same port) * support_cmd updated to support node routing (was only first node) * Multi content support in router tunnel (application/octet-stream & appliaction/json) * Routing requests changed from using http forms to rest + query params * REST query requests can now be made against erigon base port and diagnostics with the same url format/params --------- Co-authored-by: dvovk <[email protected]> Co-authored-by: Mark Holt <[email protected]>
- Loading branch information
1 parent
5641b52
commit f794438
Showing
32 changed files
with
945 additions
and
403 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
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
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
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 |
---|---|---|
@@ -1,22 +1,29 @@ | ||
package diagnostics | ||
|
||
import ( | ||
"fmt" | ||
"io" | ||
"net/http" | ||
"os" | ||
"strconv" | ||
"strings" | ||
) | ||
|
||
func SetupCmdLineAccess(metricsMux *http.ServeMux) { | ||
metricsMux.HandleFunc("/debug/metrics/cmdline", func(w http.ResponseWriter, r *http.Request) { | ||
metricsMux.HandleFunc("/cmdline", func(w http.ResponseWriter, r *http.Request) { | ||
w.Header().Set("Access-Control-Allow-Origin", "*") | ||
writeCmdLine(w) | ||
}) | ||
} | ||
w.Header().Set("Content-Type", "application/json") | ||
|
||
var space []byte | ||
|
||
func writeCmdLine(w io.Writer) { | ||
fmt.Fprintf(w, "SUCCESS\n") | ||
for _, arg := range os.Args { | ||
fmt.Fprintf(w, "%s\n", arg) | ||
} | ||
w.Write([]byte{'"'}) | ||
for _, arg := range os.Args { | ||
if len(space) > 0 { | ||
w.Write(space) | ||
} else { | ||
space = []byte(" ") | ||
} | ||
|
||
w.Write([]byte(strings.Trim(strconv.Quote(arg), `"`))) | ||
} | ||
w.Write([]byte{'"'}) | ||
}) | ||
} |
Oops, something went wrong.