| OLD | NEW |
| 1 package main | 1 package main |
| 2 | 2 |
| 3 import ( | 3 import ( |
| 4 "bytes" | 4 "bytes" |
| 5 "crypto/md5" | 5 "crypto/md5" |
| 6 "database/sql" | 6 "database/sql" |
| 7 "encoding/base64" | 7 "encoding/base64" |
| 8 "encoding/binary" | 8 "encoding/binary" |
| 9 "encoding/json" | 9 "encoding/json" |
| 10 "flag" | 10 "flag" |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 } | 283 } |
| 284 } | 284 } |
| 285 }() | 285 }() |
| 286 | 286 |
| 287 metrics.RegisterRuntimeMemStats(metrics.DefaultRegistry) | 287 metrics.RegisterRuntimeMemStats(metrics.DefaultRegistry) |
| 288 go metrics.CaptureRuntimeMemStats(metrics.DefaultRegistry, 1*time.Minute
) | 288 go metrics.CaptureRuntimeMemStats(metrics.DefaultRegistry, 1*time.Minute
) |
| 289 | 289 |
| 290 // Start reporting metrics. | 290 // Start reporting metrics. |
| 291 // TODO(jcgregorio) We need a centrialized config server for storing thi
ngs | 291 // TODO(jcgregorio) We need a centrialized config server for storing thi
ngs |
| 292 // like the IP address of the Graphite monitor. | 292 // like the IP address of the Graphite monitor. |
| 293 » addr, _ := net.ResolveTCPAddr("tcp", "10.240.159.195:2003") | 293 » addr, _ := net.ResolveTCPAddr("tcp", "skia-monitoring-b:2003") |
| 294 go metrics.Graphite(metrics.DefaultRegistry, 1*time.Minute, "webtry", ad
dr) | 294 go metrics.Graphite(metrics.DefaultRegistry, 1*time.Minute, "webtry", ad
dr) |
| 295 | 295 |
| 296 writeOutAllSourceImages() | 296 writeOutAllSourceImages() |
| 297 } | 297 } |
| 298 | 298 |
| 299 func writeOutAllSourceImages() { | 299 func writeOutAllSourceImages() { |
| 300 // Pull all the source images from the db and write them out to inout. | 300 // Pull all the source images from the db and write them out to inout. |
| 301 rows, err := db.Query("SELECT id, image, create_ts FROM source_images OR
DER BY create_ts DESC") | 301 rows, err := db.Query("SELECT id, image, create_ts FROM source_images OR
DER BY create_ts DESC") |
| 302 | 302 |
| 303 if err != nil { | 303 if err != nil { |
| (...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 863 http.HandleFunc("/sources/", autogzip.HandleFunc(sourcesHandler)) | 863 http.HandleFunc("/sources/", autogzip.HandleFunc(sourcesHandler)) |
| 864 | 864 |
| 865 // Resources are served directly | 865 // Resources are served directly |
| 866 // TODO add support for caching/etags/gzip | 866 // TODO add support for caching/etags/gzip |
| 867 http.Handle("/res/", autogzip.Handle(http.FileServer(http.Dir("./")))) | 867 http.Handle("/res/", autogzip.Handle(http.FileServer(http.Dir("./")))) |
| 868 | 868 |
| 869 // TODO Break out /c/ as it's own handler. | 869 // TODO Break out /c/ as it's own handler. |
| 870 http.HandleFunc("/", autogzip.HandleFunc(mainHandler)) | 870 http.HandleFunc("/", autogzip.HandleFunc(mainHandler)) |
| 871 log.Fatal(http.ListenAndServe(*port, nil)) | 871 log.Fatal(http.ListenAndServe(*port, nil)) |
| 872 } | 872 } |
| OLD | NEW |