-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(server): use NATS queues instead of postgres notify/listen (#3329)
* feat: add nats driver * have a factory to decide which driver to use * delete postgres driver * update gomod * fix: unmarshal resolved trigger in test run --------- Co-authored-by: Matheus Nogueira <[email protected]>
- Loading branch information
1 parent
e7e8d21
commit 29936fd
Showing
15 changed files
with
265 additions
and
233 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
version: "3.2" | ||
services: | ||
tracetest: | ||
restart: unless-stopped | ||
image: kubeshop/tracetest:${TAG:-latest} | ||
extra_hosts: | ||
- "host.docker.internal:host-gateway" | ||
build: | ||
context: . | ||
volumes: | ||
- type: bind | ||
source: ./local-config/tracetest.config.nats.yaml | ||
target: /app/tracetest.yaml | ||
- type: bind | ||
source: ./local-config/tracetest.provision.yaml | ||
target: /app/provisioning.yaml | ||
ports: | ||
- 11633:11633 | ||
command: --provisioning-file /app/provisioning.yaml | ||
healthcheck: | ||
test: ["CMD", "wget", "--spider", "localhost:11633"] | ||
interval: 1s | ||
timeout: 3s | ||
retries: 60 | ||
depends_on: | ||
postgres: | ||
condition: service_healthy | ||
environment: | ||
TRACETEST_DEV: ${TRACETEST_DEV} | ||
TRACETEST_TESTPIPELINES_TRIGGEREXECUTE_ENABLED: ${TRACETEST_TESTPIPELINES_TRIGGEREXECUTE_ENABLED} | ||
TRACETEST_TESTPIPELINES_TRACEFETCH_ENABLED: ${TRACETEST_TESTPIPELINES_TRACEFETCH_ENABLED} | ||
TRACETEST_DATASTOREPIPELINES_TESTCONNECTION_ENABLED: ${TRACETEST_DATASTOREPIPELINES_TESTCONNECTION_ENABLED} | ||
|
||
postgres: | ||
image: postgres:15.2 | ||
environment: | ||
POSTGRES_PASSWORD: postgres | ||
POSTGRES_USER: postgres | ||
ports: | ||
- 5432:5432 | ||
healthcheck: | ||
test: pg_isready -U "$$POSTGRES_USER" -d "$$POSTGRES_DB" | ||
interval: 1s | ||
timeout: 5s | ||
retries: 60 | ||
|
||
otel-collector: | ||
image: otel/opentelemetry-collector-contrib:0.59.0 | ||
extra_hosts: | ||
- "host.docker.internal:host-gateway" | ||
ports: | ||
- "55679:55679" | ||
- "4317:4317" | ||
- "8888:8888" | ||
command: | ||
- "--config" | ||
- "/otel-local-config.yaml" | ||
volumes: | ||
- ./local-config/collector.config.yaml:/otel-local-config.yaml | ||
depends_on: | ||
- tracetest | ||
|
||
nats: | ||
image: nats:2.10-alpine | ||
ports: | ||
- "4222:4222" # connecting | ||
- "8222:8222" # reporting server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
postgres: | ||
host: postgres | ||
user: postgres | ||
password: postgres | ||
port: 5432 | ||
dbname: postgres | ||
params: sslmode=disable | ||
|
||
nats: | ||
endpoint: nats:4222 | ||
|
||
telemetry: | ||
exporters: | ||
collector: | ||
serviceName: tracetest | ||
sampling: 100 # 100% | ||
exporter: | ||
type: collector | ||
collector: | ||
endpoint: otel-collector:4317 | ||
|
||
server: | ||
telemetry: | ||
exporter: collector |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package pipeline | ||
|
||
import "github.com/nats-io/nats.go" | ||
|
||
func NewDriverFactory[T any](natsConn *nats.Conn) DriverFactory[T] { | ||
return DriverFactory[T]{ | ||
natsConn: natsConn, | ||
} | ||
} | ||
|
||
type DriverFactory[T any] struct { | ||
natsConn *nats.Conn | ||
} | ||
|
||
func (df DriverFactory[T]) NewDriver(channelName string) WorkerDriver[T] { | ||
if df.natsConn != nil { | ||
return NewNatsDriver[T](df.natsConn, channelName) | ||
} | ||
|
||
return NewInMemoryQueueDriver[T](channelName) | ||
} |
Oops, something went wrong.