This is an automated email from the ASF dual-hosted git repository. hanahmily pushed a commit to branch trace/liaison in repository https://gitbox.apache.org/repos/asf/skywalking-banyandb.git
commit 58bd798dc4ea985ae3109b0013559f337e68493b Author: Gao Hongtao <hanahm...@gmail.com> AuthorDate: Thu Aug 28 10:32:26 2025 +0800 Add trace service subscription in standalone setup - Integrated a write callback handler for the trace service in the standalone PreRun method. - Initialized the trace service within the standalone command setup, ensuring proper error handling during service initiation. --- banyand/trace/svc_standalone.go | 10 ++++++++++ pkg/cmdsetup/standalone.go | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/banyand/trace/svc_standalone.go b/banyand/trace/svc_standalone.go index a2c101bd..fe0e9fc9 100644 --- a/banyand/trace/svc_standalone.go +++ b/banyand/trace/svc_standalone.go @@ -24,6 +24,7 @@ import ( "github.com/pkg/errors" + "github.com/apache/skywalking-banyandb/api/data" commonv1 "github.com/apache/skywalking-banyandb/api/proto/banyandb/common/v1" databasev1 "github.com/apache/skywalking-banyandb/api/proto/banyandb/database/v1" "github.com/apache/skywalking-banyandb/banyand/metadata" @@ -128,6 +129,15 @@ func (s *standalone) PreRun(_ context.Context) error { // Initialize snapshot directory s.snapshotDir = filepath.Join(s.dataPath, "snapshot") + // Set up write callback handler + if s.pipeline != nil { + writeListener := setUpWriteCallback(s.l, &s.schemaRepo, s.maxDiskUsagePercent) + err := s.pipeline.Subscribe(data.TopicTraceWrite, writeListener) + if err != nil { + return err + } + } + s.l.Info(). Str("root", s.root). Str("dataPath", s.dataPath). diff --git a/pkg/cmdsetup/standalone.go b/pkg/cmdsetup/standalone.go index 90b9293e..fb6c2028 100644 --- a/pkg/cmdsetup/standalone.go +++ b/pkg/cmdsetup/standalone.go @@ -35,6 +35,7 @@ import ( "github.com/apache/skywalking-banyandb/banyand/query" "github.com/apache/skywalking-banyandb/banyand/queue" "github.com/apache/skywalking-banyandb/banyand/stream" + "github.com/apache/skywalking-banyandb/banyand/trace" "github.com/apache/skywalking-banyandb/pkg/logger" "github.com/apache/skywalking-banyandb/pkg/run" "github.com/apache/skywalking-banyandb/pkg/version" @@ -58,6 +59,10 @@ func newStandaloneCmd(runners ...run.Unit) *cobra.Command { if err != nil { l.Fatal().Err(err).Msg("failed to initiate stream service") } + traceSvc, err := trace.NewService(metaSvc, dataPipeline, metricSvc, pm) + if err != nil { + l.Fatal().Err(err).Msg("failed to initiate trace service") + } var srvMetrics *grpcprom.ServerMetrics srvMetrics.UnaryServerInterceptor() srvMetrics.UnaryServerInterceptor() @@ -88,6 +93,7 @@ func newStandaloneCmd(runners ...run.Unit) *cobra.Command { propertySvc, measureSvc, streamSvc, + traceSvc, q, grpcServer, httpServer,