Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(server): Datastore test pipeline #3261

Merged
merged 1 commit into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions server/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ func (app *App) Start(opts ...appOption) error {
tracer,
tracedbFactory,
app.cfg,
meter,
)

dsTestPipeline.Start()
Expand Down
4 changes: 3 additions & 1 deletion server/app/ds_test_connection_pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/kubeshop/tracetest/server/pkg/pipeline"
"github.com/kubeshop/tracetest/server/testconnection"
"github.com/kubeshop/tracetest/server/tracedb"
"go.opentelemetry.io/otel/metric"
"go.opentelemetry.io/otel/trace"
)

Expand All @@ -15,13 +16,14 @@ func buildDataStoreTestPipeline(
tracer trace.Tracer,
newTraceDBFn tracedb.FactoryFunc,
appConfig *config.AppConfig,
meter metric.Meter,
) *testconnection.DataStoreTestPipeline {
requestWorker := testconnection.NewDsTestConnectionRequest(tracer, newTraceDBFn, appConfig.DataStorePipelineTestConnectionEnabled())
notifyWorker := testconnection.NewDsTestConnectionNotify(dsTestListener, tracer)

pgQueue := pipeline.NewPostgresQueueDriver[testconnection.Job](pool, pgChannelName)

pipeline := pipeline.New(&testconnection.Configurer[testconnection.Job]{},
pipeline := pipeline.New(testconnection.NewConfigurer(meter),
pipeline.Step[testconnection.Job]{Processor: requestWorker, Driver: pgQueue.Channel("datastore_test_connection_request")},
pipeline.Step[testconnection.Job]{Processor: notifyWorker, Driver: pgQueue.Channel("datastore_test_connection_notify")},
)
Expand Down
13 changes: 11 additions & 2 deletions server/testconnection/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/kubeshop/tracetest/server/model"
"github.com/kubeshop/tracetest/server/pkg/pipeline"
"github.com/kubeshop/tracetest/server/tracedb"
"go.opentelemetry.io/otel/metric"
)

type Job struct {
Expand All @@ -30,9 +31,17 @@ type DataStoreTestPipeline struct {
dsTestListener DsTestListener
}

type Configurer[T any] struct{}
type Configurer[T any] struct {
meter metric.Meter
}

func NewConfigurer(meter metric.Meter) *Configurer[Job] {
return &Configurer[Job]{meter: meter}
}

func (c *Configurer[Job]) Configure(_ *pipeline.Queue[Job]) {}
func (c *Configurer[Job]) Configure(queue *pipeline.Queue[Job]) {
queue.InitializeMetrics(c.meter)
}

func NewDataStoreTestPipeline(
pipeline *pipeline.Pipeline[Job],
Expand Down
Loading