Permalink
Browse files

ADD easybi

  • Loading branch information...
1 parent b37b6d9 commit d68c387435331da80d235cb52506d61553c5837e @daviddengcn committed Jan 14, 2016
View
@@ -0,0 +1,15 @@
+package gcse
+
+import (
+ "github.com/daviddengcn/go-easybi"
+)
+
+func init() {
+ bi.DataPath = BiDataPath.S()
+}
+
+func AddBiValueAndProcess(name string, value int) {
+ bi.AddValue(name, value)
+ bi.Flush()
+ bi.Process()
+}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
@@ -5,11 +5,11 @@
// loadtemplatepass: ""
// autoloadtemplate: false
}
-
+
back: {
// dbroot: "./data/"
}
-
+
crawler: {
// due_per_run: "1h"
// godoc: true
@@ -20,8 +20,13 @@
// clientsecret: ""
// }
}
-
+
docdb: {
// nonstore_regexps: []
}
-}
+
+ bi: {
+ // data_path: "/tmp/gcse.bolt"
+ // web_path: "/bi"
+ }
+}
View
@@ -86,6 +86,9 @@ var (
CrawlerGithubClientID = ""
CrawlerGithubClientSecret = ""
+ BiDataPath = villa.Path("/tmp/gcse.bolt")
+ BiWebPath = "/bi"
+
/*
Increase this to ignore etag of last versions to crawl and parse all
packages.
@@ -143,4 +146,7 @@ func init() {
CrawlerGithubClientSecret = conf.String("crawler.github.clientsecret", "")
NonStorePackageRegexps = conf.StringList("docdb.nonstore_regexps", nil)
+
+ BiDataPath = villa.Path(conf.String("bi.data_path", BiDataPath.S()))
+ BiWebPath = conf.String("bi.web_path", BiWebPath)
}
View
@@ -76,6 +76,7 @@ func doIndex() bool {
}
log.Printf("Indexing success: %s (%d)", idxSegm, ts.DocCount())
+ gcse.AddBiValueAndProcess("index-doc-count", ts.DocCount())
ts = nil
gcse.DumpMemStats()
View
@@ -20,6 +20,7 @@ import (
"github.com/ajstarks/svgo"
"github.com/daviddengcn/gcse"
"github.com/daviddengcn/gddo/doc"
+ "github.com/daviddengcn/go-easybi"
"github.com/daviddengcn/go-index"
"github.com/russross/blackfriday"
)
@@ -82,6 +83,7 @@ func init() {
http.HandleFunc("/loadtemplates", pageLoadTemplate)
http.HandleFunc("/badge", pageBadge)
http.HandleFunc("/badgepage", pageBadgePage)
+ bi.HandleRequest(gcse.BiWebPath)
http.HandleFunc("/", pageRoot)
}
@@ -122,7 +124,7 @@ func main() {
log.Printf("ListenAndServe at %s ...", gcse.ServerAddr)
- http.ListenAndServe(gcse.ServerAddr, LogHandler{})
+ log.Fatal(http.ListenAndServe(gcse.ServerAddr, LogHandler{}))
}
type SimpleDuration time.Duration

0 comments on commit d68c387

Please sign in to comment.