diff --git a/cmd/client/main.go b/cmd/client/main.go index c20e43b..2848800 100644 --- a/cmd/client/main.go +++ b/cmd/client/main.go @@ -8,9 +8,9 @@ import ( "os" "time" - "github.com/ericvolp12/jetstream/pkg/client" - "github.com/ericvolp12/jetstream/pkg/client/schedulers/sequential" - "github.com/ericvolp12/jetstream/pkg/models" + "github.com/bluesky-social/jetstream/pkg/client" + "github.com/bluesky-social/jetstream/pkg/client/schedulers/sequential" + "github.com/bluesky-social/jetstream/pkg/models" ) const ( diff --git a/cmd/jetstream/main.go b/cmd/jetstream/main.go index 5873651..3e8cc0c 100644 --- a/cmd/jetstream/main.go +++ b/cmd/jetstream/main.go @@ -16,8 +16,7 @@ import ( "github.com/bluesky-social/indigo/events" "github.com/bluesky-social/indigo/events/schedulers/parallel" - "github.com/ericvolp12/bsky-experiments/pkg/tracing" - "github.com/ericvolp12/jetstream/pkg/consumer" + "github.com/bluesky-social/jetstream/pkg/consumer" "github.com/gorilla/websocket" "github.com/labstack/echo/v4" "github.com/prometheus/client_golang/prometheus/promhttp" @@ -114,20 +113,6 @@ func Jetstream(cctx *cli.Context) error { return fmt.Errorf("failed to parse ws-url: %w", err) } - // Registers a tracer Provider globally if the exporter endpoint is set - if os.Getenv("OTEL_EXPORTER_OTLP_ENDPOINT") != "" { - log.Info("initializing tracer...") - shutdown, err := tracing.InstallExportPipeline(ctx, "Jetstream", 0.01) - if err != nil { - return fmt.Errorf("failed to initialize tracer: %w", err) - } - defer func() { - if err := shutdown(ctx); err != nil { - log.Error("failed to shutdown tracer", "error", err) - } - }() - } - s, err := NewServer(cctx.Float64("max-sub-rate")) if err != nil { return fmt.Errorf("failed to create server: %w", err) diff --git a/cmd/jetstream/server.go b/cmd/jetstream/server.go index 9336840..1e0c7ce 100644 --- a/cmd/jetstream/server.go +++ b/cmd/jetstream/server.go @@ -9,8 +9,8 @@ import ( "time" "github.com/bluesky-social/indigo/atproto/syntax" - "github.com/ericvolp12/jetstream/pkg/consumer" - "github.com/ericvolp12/jetstream/pkg/models" + "github.com/bluesky-social/jetstream/pkg/consumer" + "github.com/bluesky-social/jetstream/pkg/models" "github.com/goccy/go-json" "github.com/gorilla/websocket" "github.com/labstack/echo/v4" diff --git a/docker-compose.yaml b/docker-compose.yaml index c428c90..729ba84 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,6 +1,6 @@ services: jetstream: - image: ghcr.io/ericvolp12/jetstream:${JETSTREAM_VERSION} + image: ghcr.io/bluesky-social/jetstream:${JETSTREAM_VERSION} build: context: . dockerfile: Dockerfile diff --git a/go.mod b/go.mod index 54fefd1..2f23492 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/ericvolp12/jetstream +module github.com/bluesky-social/jetstream go 1.22 @@ -7,13 +7,15 @@ toolchain go1.22.3 require ( github.com/bluesky-social/indigo v0.0.0-20240905024844-a4f38639767f github.com/cockroachdb/pebble v1.1.2 - github.com/ericvolp12/bsky-experiments v0.0.0-20231201044208-137e3e04c531 github.com/goccy/go-json v0.10.2 github.com/gorilla/websocket v1.5.1 github.com/labstack/echo/v4 v4.11.3 + github.com/labstack/gommon v0.4.1 github.com/prometheus/client_golang v1.19.1 github.com/urfave/cli/v2 v2.26.0 go.opentelemetry.io/otel v1.21.0 + golang.org/x/sync v0.7.0 + golang.org/x/time v0.5.0 ) require ( @@ -21,7 +23,6 @@ require ( github.com/RussellLuo/slidingwindow v0.0.0-20200528002341-535bb99d338b // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/carlmjohnson/versioninfo v0.22.5 // indirect - github.com/cenkalti/backoff/v4 v4.2.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/cockroachdb/errors v1.11.3 // indirect github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce // indirect @@ -34,10 +35,8 @@ require ( github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang/protobuf v1.5.3 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/uuid v1.6.0 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.1 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-retryablehttp v0.7.5 // indirect github.com/hashicorp/golang-lru v1.0.2 // indirect @@ -76,7 +75,6 @@ require ( github.com/klauspost/cpuid/v2 v2.2.7 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect - github.com/labstack/gommon v0.4.1 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/minio/sha256-simd v1.0.1 // indirect @@ -103,27 +101,17 @@ require ( github.com/whyrusleeping/cbor-gen v0.1.3-0.20240904181319-8dc02b38228c // indirect github.com/xrash/smetrics v0.0.0-20231213231151-1d8dd44e695e // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.21.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.21.0 // indirect go.opentelemetry.io/otel/metric v1.21.0 // indirect - go.opentelemetry.io/otel/sdk v1.21.0 // indirect go.opentelemetry.io/otel/trace v1.21.0 // indirect - go.opentelemetry.io/proto/otlp v1.0.0 // indirect go.uber.org/atomic v1.11.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.26.0 // indirect golang.org/x/crypto v0.22.0 // indirect golang.org/x/exp v0.0.0-20240604190554-fc45aab8b7f8 // indirect golang.org/x/net v0.24.0 // indirect - golang.org/x/sync v0.7.0 // indirect golang.org/x/sys v0.22.0 // indirect golang.org/x/text v0.16.0 // indirect - golang.org/x/time v0.5.0 // indirect golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect - google.golang.org/genproto v0.0.0-20231212172506-995d672761c0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20231212172506-995d672761c0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20231212172506-995d672761c0 // indirect - google.golang.org/grpc v1.60.0 // indirect google.golang.org/protobuf v1.34.2 // indirect gorm.io/driver/postgres v1.5.7 // indirect gorm.io/gorm v1.25.9 // indirect diff --git a/go.sum b/go.sum index 5e25d86..b145be8 100644 --- a/go.sum +++ b/go.sum @@ -14,8 +14,6 @@ github.com/bluesky-social/indigo v0.0.0-20240905024844-a4f38639767f h1:Q9cfCAlYW github.com/bluesky-social/indigo v0.0.0-20240905024844-a4f38639767f/go.mod h1:Zx9nSWgd/FxMenkJW07VKnzspxpHBdPrPmS+Fspl2I0= github.com/carlmjohnson/versioninfo v0.22.5 h1:O00sjOLUAFxYQjlN/bzYTuZiS0y6fWDQjMRvwtKgwwc= github.com/carlmjohnson/versioninfo v0.22.5/go.mod h1:QT9mph3wcVfISUKd0i9sZfVrPviHuSF+cUtLjm2WSf8= -github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= -github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f h1:otljaYPt5hWxV3MUfO5dFPFiOXg9CyG5/kCfayTqsJ4= @@ -43,8 +41,6 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etlyjdBU4sfcs2WYQMs= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= -github.com/ericvolp12/bsky-experiments v0.0.0-20231201044208-137e3e04c531 h1:4UU2J+BY7bdj7hdy/PqOMkhti7E3V251+iM5LaHJS60= -github.com/ericvolp12/bsky-experiments v0.0.0-20231201044208-137e3e04c531/go.mod h1:pDCyWZlKW9I8vPpG3WxXP7A0gdziK9p65bE7pHbivGQ= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= @@ -67,12 +63,8 @@ github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY= github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gopacket v1.1.19 h1:ves8RnFZPGiFnTS0uPQStjwru6uO6h+nlr9j6fL7kF8= @@ -84,8 +76,6 @@ github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGa github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY= github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.1 h1:6UKoz5ujsI55KNpsJH3UwCq3T8kKbZwNZBNPuTTje8U= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.1/go.mod h1:YvJ2f6MplWDhfxiUC3KpyTy76kYUZA4W3pTv/wdKQ9Y= github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= github.com/hashicorp/go-hclog v0.9.2 h1:CG6TE5H9/JXsFWJCfoIVpKFIkFe6ysEuHirp4DxCsHI= @@ -352,18 +342,10 @@ go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 h1:aFJWCqJ go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1/go.mod h1:sEGXWArGqc3tVa+ekntsN65DmVbVeW+7lTKTjZF3/Fo= go.opentelemetry.io/otel v1.21.0 h1:hzLeKBZEL7Okw2mGzZ0cc4k/A7Fta0uoPgaJCr8fsFc= go.opentelemetry.io/otel v1.21.0/go.mod h1:QZzNPQPm1zLX4gZK4cMi+71eaorMSGT3A4znnUvNNEo= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.21.0 h1:cl5P5/GIfFh4t6xyruOgJP5QiA1pw4fYYdv6nc6CBWw= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.21.0/go.mod h1:zgBdWWAu7oEEMC06MMKc5NLbA/1YDXV1sMpSqEeLQLg= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.21.0 h1:digkEZCJWobwBqMwC0cwCq8/wkkRy/OowZg5OArWZrM= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.21.0/go.mod h1:/OpE/y70qVkndM0TrxT4KBoN3RsFZP0QaofcfYrj76I= go.opentelemetry.io/otel/metric v1.21.0 h1:tlYWfeo+Bocx5kLEloTjbcDwBuELRrIFxwdQ36PlJu4= go.opentelemetry.io/otel/metric v1.21.0/go.mod h1:o1p3CA8nNHW8j5yuQLdc1eeqEaPfzug24uvsyIEJRWM= -go.opentelemetry.io/otel/sdk v1.21.0 h1:FTt8qirL1EysG6sTQRZ5TokkU8d0ugCj8htOgThZXQ8= -go.opentelemetry.io/otel/sdk v1.21.0/go.mod h1:Nna6Yv7PWTdgJHVRD9hIYywQBRx7pbox6nwBnZIxl/E= go.opentelemetry.io/otel/trace v1.21.0 h1:WD9i5gzvoUPuXIXH24ZNBudiarZDKuekPqi/E8fpfLc= go.opentelemetry.io/otel/trace v1.21.0/go.mod h1:LGbsEB0f9LGjN+OZaQQ26sohbOmiMR+BaslueVtS/qQ= -go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= -go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= @@ -446,16 +428,6 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 h1:+cNy6SZtPcJQH3LJVLOSmiC7MMxXNOb3PU/VUEz+EhU= golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028/go.mod h1:NDW/Ps6MPRej6fsCIbMTohpP40sJ/P/vI1MoTEGwX90= -google.golang.org/genproto v0.0.0-20231212172506-995d672761c0 h1:YJ5pD9rF8o9Qtta0Cmy9rdBwkSjrTCT6XTiUQVOtIos= -google.golang.org/genproto v0.0.0-20231212172506-995d672761c0/go.mod h1:l/k7rMz0vFTBPy+tFSGvXEd3z+BcoG1k7EHbqm+YBsY= -google.golang.org/genproto/googleapis/api v0.0.0-20231212172506-995d672761c0 h1:s1w3X6gQxwrLEpxnLd/qXTVLgQE2yXwaOaoa6IlY/+o= -google.golang.org/genproto/googleapis/api v0.0.0-20231212172506-995d672761c0/go.mod h1:CAny0tYF+0/9rmDB9fahA9YLzX3+AEVl1qXbv5hhj6c= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231212172506-995d672761c0 h1:/jFB8jK5R3Sq3i/lmeZO0cATSzFfZaJq1J2Euan3XKU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231212172506-995d672761c0/go.mod h1:FUoWkonphQm3RhTS+kOEhF8h0iDpm4tdXolVCeZ9KKA= -google.golang.org/grpc v1.60.0 h1:6FQAR0kM31P6MRdeluor2w2gPaS4SVNrD/DNTxrQ15k= -google.golang.org/grpc v1.60.0/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/pkg/client/client.go b/pkg/client/client.go index 076dbcc..0473f61 100644 --- a/pkg/client/client.go +++ b/pkg/client/client.go @@ -7,7 +7,7 @@ import ( "net/http" "net/url" - "github.com/ericvolp12/jetstream/pkg/models" + "github.com/bluesky-social/jetstream/pkg/models" "github.com/goccy/go-json" "github.com/gorilla/websocket" ) diff --git a/pkg/client/schedulers/parallel/parallel.go b/pkg/client/schedulers/parallel/parallel.go index 41cd22a..a5ace92 100644 --- a/pkg/client/schedulers/parallel/parallel.go +++ b/pkg/client/schedulers/parallel/parallel.go @@ -7,8 +7,8 @@ import ( "log/slog" "sync" - "github.com/ericvolp12/jetstream/pkg/client/schedulers" - "github.com/ericvolp12/jetstream/pkg/models" + "github.com/bluesky-social/jetstream/pkg/client/schedulers" + "github.com/bluesky-social/jetstream/pkg/models" "github.com/prometheus/client_golang/prometheus" ) diff --git a/pkg/client/schedulers/sequential/sequential.go b/pkg/client/schedulers/sequential/sequential.go index c8bad8c..dd16d73 100644 --- a/pkg/client/schedulers/sequential/sequential.go +++ b/pkg/client/schedulers/sequential/sequential.go @@ -4,8 +4,8 @@ import ( "context" "log/slog" - "github.com/ericvolp12/jetstream/pkg/client/schedulers" - "github.com/ericvolp12/jetstream/pkg/models" + "github.com/bluesky-social/jetstream/pkg/client/schedulers" + "github.com/bluesky-social/jetstream/pkg/models" "github.com/prometheus/client_golang/prometheus" ) diff --git a/pkg/consumer/consumer.go b/pkg/consumer/consumer.go index 8e86ac3..5ca1c82 100644 --- a/pkg/consumer/consumer.go +++ b/pkg/consumer/consumer.go @@ -13,9 +13,9 @@ import ( "github.com/bluesky-social/indigo/events" "github.com/bluesky-social/indigo/repo" "github.com/bluesky-social/indigo/repomgr" + "github.com/bluesky-social/jetstream/pkg/models" + "github.com/bluesky-social/jetstream/pkg/monotonic" "github.com/cockroachdb/pebble" - "github.com/ericvolp12/jetstream/pkg/models" - "github.com/ericvolp12/jetstream/pkg/monotonic" "github.com/goccy/go-json" "github.com/prometheus/client_golang/prometheus" "go.opentelemetry.io/otel" diff --git a/pkg/consumer/persist.go b/pkg/consumer/persist.go index fe198d2..5d3a0c7 100644 --- a/pkg/consumer/persist.go +++ b/pkg/consumer/persist.go @@ -8,8 +8,8 @@ import ( "sync" "time" + "github.com/bluesky-social/jetstream/pkg/models" "github.com/cockroachdb/pebble" - "github.com/ericvolp12/jetstream/pkg/models" "github.com/goccy/go-json" "github.com/labstack/gommon/log" "golang.org/x/time/rate"