hanahmily commented on code in PR #797:
URL: 
https://github.com/apache/skywalking-banyandb/pull/797#discussion_r2389963517


##########
bydbctl/internal/cmd/trace.go:
##########
@@ -137,8 +137,22 @@ func newTraceCmd() *cobra.Command {
                },
        }
 
-       bindFileFlag(createCmd, updateCmd)
-       bindTLSRelatedFlag(getCmd, createCmd, deleteCmd, updateCmd, listCmd)
-       traceCmd.AddCommand(getCmd, createCmd, deleteCmd, updateCmd, listCmd)
+       queryCmd := &cobra.Command{
+               Use:     "query [-s start_time] [-e end_time] -f [file|dir|-]",
+               Version: version.Build(),
+               Short:   "Query data in a trace",
+               Long:    timeRangeUsage,
+               RunE: func(cmd *cobra.Command, _ []string) (err error) {
+                       return rest(func() ([]reqBody, error) { return 
parseTimeRangeFromFlagAndYAML(cmd.InOrStdin()) },
+                               func(request request) (*resty.Response, error) {
+                                       return 
request.req.SetBody(request.data).Post(getPath("/api/v1/trace/data"))

Review Comment:
   Convert the string to a global constant.



##########
bydbctl/internal/cmd/trace_test.go:
##########
@@ -18,20 +18,33 @@
 package cmd_test
 
 import (
+       "fmt"
        "strings"
+       "testing"
+       "time"
 
        . "github.com/onsi/ginkgo/v2"
        . "github.com/onsi/gomega"
        "github.com/spf13/cobra"
        "github.com/zenizh/go-capturer"
+       grpclib "google.golang.org/grpc"
+       "google.golang.org/grpc/credentials/insecure"
 
        databasev1 
"github.com/apache/skywalking-banyandb/api/proto/banyandb/database/v1"
+       tracev1 
"github.com/apache/skywalking-banyandb/api/proto/banyandb/trace/v1"
        "github.com/apache/skywalking-banyandb/bydbctl/internal/cmd"
        "github.com/apache/skywalking-banyandb/pkg/test/flags"
        "github.com/apache/skywalking-banyandb/pkg/test/helpers"
        "github.com/apache/skywalking-banyandb/pkg/test/setup"
+       "github.com/apache/skywalking-banyandb/pkg/timestamp"
+       cases_trace_data 
"github.com/apache/skywalking-banyandb/test/cases/trace/data"
 )
 
+func TestStable(t *testing.T) {
+       RegisterFailHandler(Fail)
+       RunSpecs(t, "Stable Suite", Label("integration", "slow"))
+}
+

Review Comment:
   ```suggestion
   ```
   
   Each pkg only needs a Test function.



##########
banyand/liaison/grpc/discovery.go:
##########
@@ -234,7 +234,9 @@ func (e *entityRepo) OnAddOrUpdate(schemaMetadata 
schema.Metadata) {
        case schema.KindTrace:
                trace := schemaMetadata.Spec.(*databasev1.Trace)
                id = getID(trace.GetMetadata())
+               e.RWMutex.Lock()

Review Comment:
   It is good but does not cover all scenarios: e.traceIDIndexMap should be 
protected by a mutex.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to