From cf72eae86c5d7c1ee17445743f016d44dbcb32ff Mon Sep 17 00:00:00 2001 From: Taka Goto Date: Tue, 4 Sep 2018 15:10:15 -0500 Subject: [PATCH] add datadog monitoring for vdb --- README.md | 1 + cmd/root.go | 2 ++ environments/staging.toml | 3 +++ main.go | 7 +++++++ 4 files changed, 13 insertions(+) diff --git a/README.md b/README.md index bf586a36..99b6867b 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ Vulcanize DB is a set of tools that make it easier for developers to write appli ## Installation `go get github.com/vulcanize/vulcanizedb` +`go get gopkg.in/DataDog/dd-trace-go.v1/ddtrace` ## Setting up the Database 1. Install Postgres diff --git a/cmd/root.go b/cmd/root.go index c0336edc..e2715f62 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -70,6 +70,7 @@ func init() { rootCmd.PersistentFlags().String("database-password", "", "database password") rootCmd.PersistentFlags().String("client-ipcPath", "", "location of geth.ipc file") rootCmd.PersistentFlags().String("client-levelDbPath", "", "location of levelDb chaindata") + rootCmd.PersistentFlags().String("datadog-name", "vulcanize-test", "datadog service name") viper.BindPFlag("database.name", rootCmd.PersistentFlags().Lookup("database-name")) viper.BindPFlag("database.port", rootCmd.PersistentFlags().Lookup("database-port")) @@ -78,6 +79,7 @@ func init() { viper.BindPFlag("database.password", rootCmd.PersistentFlags().Lookup("database-password")) viper.BindPFlag("client.ipcPath", rootCmd.PersistentFlags().Lookup("client-ipcPath")) viper.BindPFlag("client.levelDbPath", rootCmd.PersistentFlags().Lookup("client-levelDbPath")) + viper.BindPFlag("datadog.name", rootCmd.PersistentFlags().Lookup("datadog-name")) } func initConfig() { diff --git a/environments/staging.toml b/environments/staging.toml index 2dc3941e..80d92b0b 100644 --- a/environments/staging.toml +++ b/environments/staging.toml @@ -7,3 +7,6 @@ port = 5432 [client] ipcPath = "/mnt/geth.ipc" + +[datadog] +name = "maker_vdb_staging" \ No newline at end of file diff --git a/main.go b/main.go index a27eb869..0e467ded 100644 --- a/main.go +++ b/main.go @@ -2,8 +2,15 @@ package main import ( "github.com/vulcanize/vulcanizedb/cmd" + + "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + "github.com/spf13/viper" ) func main() { + tracer.Start(tracer.WithServiceName(viper.GetString("datadog.name"))) + cmd.Execute() + + defer tracer.Stop() }