Skip to content

Commit

Permalink
chore: remove eventrouter and tinybird references (#2705)
Browse files Browse the repository at this point in the history
  • Loading branch information
chronark authored Dec 5, 2024
1 parent cf5955e commit 9ffce49
Show file tree
Hide file tree
Showing 15 changed files with 4 additions and 462 deletions.
22 changes: 0 additions & 22 deletions apps/agent/cmd/agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"runtime/debug"
"strings"
"syscall"
"time"

"github.com/Southclaws/fault"
"github.com/Southclaws/fault/fmsg"
Expand All @@ -22,11 +21,9 @@ import (
"github.com/unkeyed/unkey/apps/agent/pkg/metrics"
"github.com/unkeyed/unkey/apps/agent/pkg/profiling"
"github.com/unkeyed/unkey/apps/agent/pkg/prometheus"
"github.com/unkeyed/unkey/apps/agent/pkg/tinybird"
"github.com/unkeyed/unkey/apps/agent/pkg/tracing"
"github.com/unkeyed/unkey/apps/agent/pkg/uid"
"github.com/unkeyed/unkey/apps/agent/pkg/version"
"github.com/unkeyed/unkey/apps/agent/services/eventrouter"
"github.com/unkeyed/unkey/apps/agent/services/ratelimit"
"github.com/unkeyed/unkey/apps/agent/services/vault"
"github.com/unkeyed/unkey/apps/agent/services/vault/storage"
Expand Down Expand Up @@ -244,25 +241,6 @@ func run(c *cli.Context) error {
return err
}

if cfg.Services.EventRouter != nil {
var er *eventrouter.Service
er, err = eventrouter.New(eventrouter.Config{
Logger: logger,
Metrics: m,
BatchSize: cfg.Services.EventRouter.Tinybird.BatchSize,
BufferSize: cfg.Services.EventRouter.Tinybird.BufferSize,
FlushInterval: time.Duration(cfg.Services.EventRouter.Tinybird.FlushInterval) * time.Second,
Tinybird: tinybird.New("https://api.tinybird.co", cfg.Services.EventRouter.Tinybird.Token),
Clickhouse: ch,
AuthToken: cfg.AuthToken,
})
if err != nil {
return err
}
srv.WithEventRouter(er)

}

connectSrv, err := connect.New(connect.Config{Logger: logger, Image: cfg.Image, Metrics: m})
if err != nil {
return err
Expand Down
8 changes: 0 additions & 8 deletions apps/agent/config.docker.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,6 @@
}
},
"services": {
"eventRouter": {
"tinybird": {
"token": "${TINYBIRD_TOKEN}",
"batchSize": 1000,
"flushInterval": 1,
"bufferSize": 10000
}
},
"vault": {
"s3Url": "${VAULT_S3_URL}",
"s3Bucket": "${VAULT_S3_BUCKET}",
Expand Down
8 changes: 0 additions & 8 deletions apps/agent/config.production.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,6 @@
}
},
"services": {
"eventRouter": {
"tinybird": {
"token": "${TINYBIRD_TOKEN}",
"batchSize": 1000,
"flushInterval": 1,
"bufferSize": 10000
}
},
"vault": {
"s3Url": "${VAULT_S3_URL}",
"s3Bucket": "${VAULT_S3_BUCKET}",
Expand Down
8 changes: 0 additions & 8 deletions apps/agent/config.staging.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,6 @@
"region": "fly::${FLY_REGION}",
"authToken": "${AUTH_TOKEN}",
"services": {
"eventRouter": {
"tinybird": {
"token": "${TINYBIRD_TOKEN}",
"batchSize": 1000,
"flushInterval": 1,
"bufferSize": 10000
}
},
"vault": {
"s3Url": "${VAULT_S3_URL}",
"s3Bucket": "${VAULT_S3_BUCKET}",
Expand Down
10 changes: 0 additions & 10 deletions apps/agent/pkg/api/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"github.com/unkeyed/unkey/apps/agent/pkg/api/validation"
"github.com/unkeyed/unkey/apps/agent/pkg/logging"
"github.com/unkeyed/unkey/apps/agent/pkg/metrics"
"github.com/unkeyed/unkey/apps/agent/services/eventrouter"
"github.com/unkeyed/unkey/apps/agent/services/ratelimit"
"github.com/unkeyed/unkey/apps/agent/services/vault"
)
Expand Down Expand Up @@ -94,15 +93,6 @@ func New(config Config) (*Server, error) {
return s, nil
}

func (s *Server) WithEventRouter(svc *eventrouter.Service) {
s.Lock()
defer s.Unlock()

pattern, handlerFunc := svc.CreateHandler()

s.mux.HandleFunc(pattern, handlerFunc)
}

// Calling this function multiple times will have no effect.
func (s *Server) Listen(addr string) error {
s.Lock()
Expand Down
8 changes: 0 additions & 8 deletions apps/agent/pkg/config/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,6 @@ type Agent struct {
} `json:"heartbeat,omitempty" description:"Send heartbeat to a URL"`

Services struct {
EventRouter *struct {
Tinybird *struct {
Token string `json:"token" minLength:"1" description:"The token to use for tinybird authentication"`
FlushInterval int `json:"flushInterval" min:"1" description:"Interval in seconds to flush events"`
BufferSize int `json:"bufferSize" min:"1" description:"Size of the buffer"`
BatchSize int `json:"batchSize" min:"1" description:"Size of the batch"`
} `json:"tinybird,omitempty" description:"Send events to tinybird"`
} `json:"eventRouter,omitempty" description:"Route events"`
Vault struct {
S3Bucket string `json:"s3Bucket" minLength:"1" description:"The bucket to store secrets in"`
S3Url string `json:"s3Url" minLength:"1" description:"The url to store secrets in"`
Expand Down
5 changes: 0 additions & 5 deletions apps/agent/pkg/prometheus/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,6 @@ var (
Subsystem: "cache",
Name: "rejected",
}, []string{"resource"})
EventRouterFlushedRows = promauto.NewCounterVec(prometheus.CounterOpts{
Namespace: "agent",
Subsystem: "event_router",
Name: "flushed_rows",
}, []string{"datasource"})
RatelimitPushPullEvents = promauto.NewCounterVec(prometheus.CounterOpts{
Namespace: "agent",
Subsystem: "ratelimit",
Expand Down
1 change: 0 additions & 1 deletion apps/agent/pkg/testutils/containers/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ func NewAgent(t *testing.T, clusterSize int) []Agent {
"VAULT_S3_ACCESS_KEY_ID": s3.AccessKeyId,
"VAULT_S3_ACCESS_KEY_SECRET": s3.AccessKeySecret,
"VAULT_MASTER_KEYS": "Ch9rZWtfMmdqMFBJdVhac1NSa0ZhNE5mOWlLSnBHenFPENTt7an5MRogENt9Si6wms4pQ2XIvqNSIgNpaBenJmXgcInhu6Nfv2U=",
"TINYBIRD_TOKEN": "I can't wait until we use clickhouse for local development",
},
WaitingFor: wait.ForHTTP("/v1/liveness"),
},
Expand Down
71 changes: 0 additions & 71 deletions apps/agent/pkg/tinybird/tinybird.go

This file was deleted.

35 changes: 0 additions & 35 deletions apps/agent/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -207,41 +207,6 @@
"services": {
"type": "object",
"properties": {
"eventRouter": {
"type": "object",
"description": "Route events",
"properties": {
"tinybird": {
"type": "object",
"description": "Send events to tinybird",
"properties": {
"batchSize": {
"type": "integer",
"description": "Size of the batch",
"format": "int32"
},
"bufferSize": {
"type": "integer",
"description": "Size of the buffer",
"format": "int32"
},
"flushInterval": {
"type": "integer",
"description": "Interval in seconds to flush events",
"format": "int32"
},
"token": {
"type": "string",
"description": "The token to use for tinybird authentication",
"minLength": 1
}
},
"additionalProperties": false,
"required": ["token", "flushInterval", "bufferSize", "batchSize"]
}
},
"additionalProperties": false
},
"vault": {
"type": "object",
"description": "Store secrets",
Expand Down
Loading

0 comments on commit 9ffce49

Please sign in to comment.