You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by "mrproliu (via GitHub)" <gi...@apache.org> on 2025/09/30 04:41:19 UTC
[PR] Add trace query command in bydbctl [skywalking-banyandb]
mrproliu opened a new pull request, #797:
URL: https://github.com/apache/skywalking-banyandb/pull/797
- [ ] If this pull request closes/resolves/fixes an existing issue, replace the issue number. Fixes apache/skywalking#<issue number>.
- [ ] Update the [`CHANGES` log](https://github.com/apache/skywalking-banyandb/blob/main/CHANGES.md).
--
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: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add trace query command in bydbctl [skywalking-banyandb]
Posted by "hanahmily (via GitHub)" <gi...@apache.org>.
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: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add trace query command in bydbctl [skywalking-banyandb]
Posted by "hanahmily (via GitHub)" <gi...@apache.org>.
hanahmily commented on code in PR #797:
URL: https://github.com/apache/skywalking-banyandb/pull/797#discussion_r2393508281
##########
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:
![Uploading image.png…]()
put "/api/v1/trace/data" here
--
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: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add trace query command in bydbctl [skywalking-banyandb]
Posted by "hanahmily (via GitHub)" <gi...@apache.org>.
hanahmily merged PR #797:
URL: https://github.com/apache/skywalking-banyandb/pull/797
--
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: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add trace query command in bydbctl [skywalking-banyandb]
Posted by "hanahmily (via GitHub)" <gi...@apache.org>.
hanahmily commented on code in PR #797:
URL: https://github.com/apache/skywalking-banyandb/pull/797#discussion_r2393508281
##########
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:
https://github.com/apache/skywalking-banyandb/blob/main/bydbctl/internal/cmd/trace.go#L31
put "/api/v1/trace/data" here
--
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: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org