add datadog monitoring for vdb

This commit is contained in:
Taka Goto 2018-09-04 15:10:15 -05:00
parent 807b7accd6
commit cf72eae86c
4 changed files with 13 additions and 0 deletions

View File

@ -17,6 +17,7 @@ Vulcanize DB is a set of tools that make it easier for developers to write appli
## Installation ## Installation
`go get github.com/vulcanize/vulcanizedb` `go get github.com/vulcanize/vulcanizedb`
`go get gopkg.in/DataDog/dd-trace-go.v1/ddtrace`
## Setting up the Database ## Setting up the Database
1. Install Postgres 1. Install Postgres

View File

@ -70,6 +70,7 @@ func init() {
rootCmd.PersistentFlags().String("database-password", "", "database password") rootCmd.PersistentFlags().String("database-password", "", "database password")
rootCmd.PersistentFlags().String("client-ipcPath", "", "location of geth.ipc file") rootCmd.PersistentFlags().String("client-ipcPath", "", "location of geth.ipc file")
rootCmd.PersistentFlags().String("client-levelDbPath", "", "location of levelDb chaindata") 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.name", rootCmd.PersistentFlags().Lookup("database-name"))
viper.BindPFlag("database.port", rootCmd.PersistentFlags().Lookup("database-port")) 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("database.password", rootCmd.PersistentFlags().Lookup("database-password"))
viper.BindPFlag("client.ipcPath", rootCmd.PersistentFlags().Lookup("client-ipcPath")) viper.BindPFlag("client.ipcPath", rootCmd.PersistentFlags().Lookup("client-ipcPath"))
viper.BindPFlag("client.levelDbPath", rootCmd.PersistentFlags().Lookup("client-levelDbPath")) viper.BindPFlag("client.levelDbPath", rootCmd.PersistentFlags().Lookup("client-levelDbPath"))
viper.BindPFlag("datadog.name", rootCmd.PersistentFlags().Lookup("datadog-name"))
} }
func initConfig() { func initConfig() {

View File

@ -7,3 +7,6 @@ port = 5432
[client] [client]
ipcPath = "/mnt/geth.ipc" ipcPath = "/mnt/geth.ipc"
[datadog]
name = "maker_vdb_staging"

View File

@ -2,8 +2,15 @@ package main
import ( import (
"github.com/vulcanize/vulcanizedb/cmd" "github.com/vulcanize/vulcanizedb/cmd"
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer"
"github.com/spf13/viper"
) )
func main() { func main() {
tracer.Start(tracer.WithServiceName(viper.GetString("datadog.name")))
cmd.Execute() cmd.Execute()
defer tracer.Stop()
} }