Skip to content

Commit

Permalink
Remove librato
Browse files Browse the repository at this point in the history
  • Loading branch information
norkans7 committed Dec 17, 2024
1 parent 89e11a4 commit b6fb003
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 25 deletions.
14 changes: 1 addition & 13 deletions backends/rapidpro/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
"github.com/jmoiron/sqlx"
"github.com/nyaruka/courier"
"github.com/nyaruka/courier/queue"
"github.com/nyaruka/gocommon/analytics"
"github.com/nyaruka/gocommon/aws/cwatch"
"github.com/nyaruka/gocommon/aws/dynamo"
"github.com/nyaruka/gocommon/aws/s3x"
Expand Down Expand Up @@ -807,18 +806,7 @@ func (b *backend) Heartbeat() error {
slog.Error("error putting metrics", "error", err)
}

analytics.Gauge("courier.db_busy", float64(dbStats.InUse))
analytics.Gauge("courier.db_idle", float64(dbStats.Idle))
analytics.Gauge("courier.db_wait_ms", float64(dbWaitDurationInPeriod/time.Millisecond))
analytics.Gauge("courier.db_wait_count", float64(dbWaitCountInPeriod))
analytics.Gauge("courier.redis_active", float64(redisStats.ActiveCount))
analytics.Gauge("courier.redis_idle", float64(redisStats.IdleCount))
analytics.Gauge("courier.redis_wait_ms", float64(redisWaitDurationInPeriod/time.Millisecond))
analytics.Gauge("courier.redis_wait_count", float64(redisWaitCountInPeriod))
analytics.Gauge("courier.bulk_queue", float64(bulkSize))
analytics.Gauge("courier.priority_queue", float64(prioritySize))

slog.Info("current analytics", "db_busy", dbStats.InUse,
slog.Info("current metrics", "db_busy", dbStats.InUse,
"db_idle", dbStats.Idle,
"db_wait_time", dbWaitDurationInPeriod,
"db_wait_count", dbWaitCountInPeriod,
Expand Down
2 changes: 1 addition & 1 deletion backends/rapidpro/backend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,7 @@ func (ts *BackendTestSuite) TestHealth() {
}

func (ts *BackendTestSuite) TestHeartbeat() {
// TODO make analytics abstraction layer so we can test what we report
// TODO make metrics abstraction layer so we can test what we report
ts.NoError(ts.b.Heartbeat())
}

Expand Down
11 changes: 0 additions & 11 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"log"
"log/slog"
"net/http"
"os"
"runtime/debug"
"slices"
"sort"
Expand Down Expand Up @@ -94,14 +93,6 @@ func NewServerWithLogger(config *Config, backend Backend, logger *slog.Logger) S
// if it encounters any unrecoverable (or ignorable) error, though its bias is to move forward despite
// connection errors
func (s *server) Start() error {
// configure librato if we have configuration options for it
host, _ := os.Hostname()
if s.config.LibratoUsername != "" {
analytics.RegisterBackend(analytics.NewLibrato(s.config.LibratoUsername, s.config.LibratoToken, host, time.Second, s.waitGroup))
}

analytics.Start()

// start our backend
err := s.backend.Start()
if err != nil {
Expand Down Expand Up @@ -197,8 +188,6 @@ func (s *server) Stop() error {
return err
}

analytics.Stop()

// wait for everything to stop
s.waitGroup.Wait()

Expand Down

0 comments on commit b6fb003

Please sign in to comment.