diff --git a/.circle.yml b/.circle.yml new file mode 100644 index 0000000..3288c0c --- /dev/null +++ b/.circle.yml @@ -0,0 +1,2 @@ +test: + override: make test diff --git a/config.go b/config.go index 9d620de..233d114 100644 --- a/config.go +++ b/config.go @@ -63,14 +63,17 @@ func (c Config) HttpHandler() actions.HttpHandler { } func (c *Config) Init() error { - new_provider := persistence.CassandraProvider{Hosts: c.Hosts, Keyspace: c.Keyspace} + new_provider := persistence.CassandraProvider{ + Hosts: c.Hosts, + Keyspace: c.Keyspace, + } err := new_provider.Init() if err != nil { return err } c.provider = &new_provider - dd := telemetry.NewDatadog(c.StatsdAddr, c.Keyspace) + dd := telemetry.NewDatadog(c.StatsdAddr, "archai", c.Keyspace) c.telemetry = dd c.initialized = true diff --git a/persistence/provider.go b/persistence/provider.go index b03fe7f..7cb9c44 100644 --- a/persistence/provider.go +++ b/persistence/provider.go @@ -38,7 +38,7 @@ func (cp *CassandraProvider) Session() (Session, error) { return nil, fmt.Errorf("Initialize CassandraProvider with NewProvider first") } -const createKeySpace = `CREATE KEYSPACE IF NOT EXISTS %s WITH replication = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };` +const createKeySpace = `CREATE KEYSPACE IF NOT EXISTS %s WITH replication = { 'class' : 'NetworkTopologyStrategy' };` func (c *CassandraProvider) createKeySpace() error { cluster := c.NewCluster() diff --git a/telemetry/datadog.go b/telemetry/datadog.go index 261e2b6..24cca12 100644 --- a/telemetry/datadog.go +++ b/telemetry/datadog.go @@ -23,6 +23,7 @@ func (c *Client) on_error(err error) { func (c *Client) Failure(title, text string) { if c.initialized { + title = c.client.Namespace + "." + title ev := statsd.NewEvent(title, text) ev.AlertType = statsd.Error err := errors.Wrap(c.client.Event(ev), "Failed sending event to DataDog") @@ -41,7 +42,7 @@ func (c *Client) Incr(name string, tags []string) { } } -func NewDatadog(addr string, namespace string) Datadog { +func NewDatadog(addr string, namespace string, keyspace string) Datadog { c, err := statsd.New(addr) if err != nil { client := &Client{} @@ -49,5 +50,6 @@ func NewDatadog(addr string, namespace string) Datadog { return client } c.Namespace = namespace + "." + c.Tags = append(c.Tags, "keyspace:"+keyspace) return &Client{client: c, initialized: true} }