Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2636)

Unified Diff: experimental/webtry/webtry.go

Issue 312373002: Add metrics reporting to SkFiddle. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix linking Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: experimental/webtry/webtry.go
diff --git a/experimental/webtry/webtry.go b/experimental/webtry/webtry.go
index 43598fe09286191a817494d7d664ee0a86c08a20..5c1443d6a2d443b5e18cab8102a65f92c3abd035 100644
--- a/experimental/webtry/webtry.go
+++ b/experimental/webtry/webtry.go
@@ -17,6 +17,7 @@ import (
"io/ioutil"
"log"
"math/rand"
+ "net"
"net/http"
"os"
"os/exec"
@@ -31,11 +32,12 @@ import (
"github.com/fiorix/go-web/autogzip"
_ "github.com/go-sql-driver/mysql"
_ "github.com/mattn/go-sqlite3"
+ "github.com/rcrowley/go-metrics"
)
const (
RESULT_COMPILE = `../../experimental/webtry/safec++ -DSK_GAMMA_SRGB -DSK_GAMMA_APPLY_TO_A8 -DSK_SCALAR_TO_FLOAT_EXCLUDED -DSK_ALLOW_STATIC_GLOBAL_INITIALIZERS=1 -DSK_SUPPORT_GPU=0 -DSK_SUPPORT_OPENCL=0 -DSK_FORCE_DISTANCEFIELD_FONTS=0 -DSK_SCALAR_IS_FLOAT -DSK_CAN_USE_FLOAT -DSK_SAMPLES_FOR_X -DSK_BUILD_FOR_UNIX -DSK_USE_POSIX_THREADS -DSK_SYSTEM_ZLIB=1 -DSK_DEBUG -DSK_DEVELOPER=1 -I../../src/core -I../../src/images -I../../tools/flags -I../../include/config -I../../include/core -I../../include/pathops -I../../include/pipe -I../../include/effects -I../../include/ports -I../../src/sfnt -I../../include/utils -I../../src/utils -I../../include/images -g -fno-exceptions -fstrict-aliasing -Wall -Wextra -Winit-self -Wpointer-arith -Wno-unused-parameter -m64 -fno-rtti -Wnon-virtual-dtor -c ../../../cache/%s.cpp -o ../../../cache/%s.o`
- LINK = `../../experimental/webtry/safec++ -m64 -lstdc++ -lm -o ../../../inout/%s -Wl,--start-group ../../../cache/%s.o obj/experimental/webtry/webtry.main.o obj/gyp/libflags.a libskia_images.a libskia_core.a libskia_effects.a obj/gyp/libjpeg.a obj/gyp/libetc1.a obj/gyp/libwebp_dec.a obj/gyp/libwebp_demux.a obj/gyp/libwebp_dsp.a obj/gyp/libwebp_enc.a obj/gyp/libwebp_utils.a libskia_utils.a libskia_opts.a libskia_opts_ssse3.a libskia_ports.a libskia_sfnt.a -Wl,--end-group -lpng -lz -lgif -lpthread -lfontconfig -ldl -lfreetype`
+ LINK = `../../experimental/webtry/safec++ -m64 -lstdc++ -lm -o ../../../inout/%s -Wl,--start-group ../../../cache/%s.o obj/experimental/webtry/webtry.main.o obj/gyp/libflags.a libskia_images.a libskia_core.a libskia_effects.a obj/gyp/libjpeg.a obj/gyp/libetc1.a obj/gyp/libSkKTX.a obj/gyp/libwebp_dec.a obj/gyp/libwebp_demux.a obj/gyp/libwebp_dsp.a obj/gyp/libwebp_enc.a obj/gyp/libwebp_utils.a libskia_utils.a libskia_opts.a libskia_opts_ssse3.a libskia_ports.a libskia_sfnt.a -Wl,--end-group -lpng -lz -lgif -lpthread -lfontconfig -ldl -lfreetype`
DEFAULT_SAMPLE = `void draw(SkCanvas* canvas) {
SkPaint p;
@@ -112,6 +114,8 @@ var (
gitHash = ""
gitInfo = ""
+
+ requestsCounter = metrics.NewRegisteredCounter("requests", metrics.DefaultRegistry)
)
// flags
@@ -280,6 +284,15 @@ func init() {
}
}()
+ metrics.RegisterRuntimeMemStats(metrics.DefaultRegistry)
+ go metrics.CaptureRuntimeMemStats(metrics.DefaultRegistry, 1*time.Minute)
+
+ // Start reporting metrics.
+ // TODO(jcgregorio) We need a centrialized config server for storing things
mtklein 2014/06/06 02:50:50 Is there any sort of public GNS/BNS/Chubby in GCE
jcgregorio 2014/06/06 12:50:45 Turns out we can fetch files from Git via Gitiles,
+ // like the IP address of the Graphite monitor.
+ addr, _ := net.ResolveTCPAddr("tcp", "10.240.159.195:2003")
+ go metrics.Graphite(metrics.DefaultRegistry, 1*time.Minute, "webtry", addr)
+
writeOutAllSourceImages()
}
@@ -733,6 +746,7 @@ func cleanCompileOutput(s, hash string) string {
// mainHandler handles the GET and POST of the main page.
func mainHandler(w http.ResponseWriter, r *http.Request) {
log.Printf("Main Handler: %q\n", r.URL.Path)
+ requestsCounter.Inc(1)
if r.Method == "GET" {
code := DEFAULT_SAMPLE
source := 0
« experimental/webtry/templates/template.cpp ('K') | « experimental/webtry/templates/template.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698