You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by ke...@apache.org on 2022/05/27 05:19:13 UTC
[skywalking-cli] 01/01: Fix event query should query all types by default
This is an automated email from the ASF dual-hosted git repository.
kezhenxu94 pushed a commit to branch event
in repository https://gitbox.apache.org/repos/asf/skywalking-cli.git
commit 588c25c721532191b8919e28578d1dea8b175473
Author: kezhenxu94 <ke...@apache.org>
AuthorDate: Fri May 27 13:17:33 2022 +0800
Fix event query should query all types by default
---
internal/commands/event/list.go | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/internal/commands/event/list.go b/internal/commands/event/list.go
index 20efbc3..ff0e60b 100644
--- a/internal/commands/event/list.go
+++ b/internal/commands/event/list.go
@@ -34,6 +34,12 @@ import (
)
const DefaultPageSize = 15
+const EventTypeAll event.Type = -1
+
+func init() {
+ event.Type_name[-1] = "All"
+ event.Type_value["All"] = -1
+}
var listCommand = &cli.Command{
Name: "list",
@@ -65,8 +71,7 @@ $ swctl event list
Usage: "the type of the event",
Value: &model.EventTypeEnumValue{
Enum: []event.Type{event.Type_Normal, event.Type_Error},
- Default: event.Type_Normal,
- Selected: event.Type_Normal,
+ Selected: EventTypeAll,
},
},
},
@@ -91,7 +96,7 @@ $ swctl event list
serviceInstanceName := ctx.String("instance-name")
endpointName := ctx.String("endpoint-name")
name := ctx.String("name")
- eventType := api.EventType(ctx.Generic("type").(*model.EventTypeEnumValue).String())
+ eventType := ctx.Generic("type").(*model.EventTypeEnumValue).Selected
layer := strings.ToUpper(ctx.String("layer"))
pageNum := 1
@@ -106,12 +111,15 @@ $ swctl event list
Endpoint: &endpointName,
},
Name: &name,
- Type: &eventType,
Time: &duration,
Layer: &layer,
Order: nil,
Paging: &paging,
}
+ if eventType != EventTypeAll {
+ t := api.EventType(eventType.String())
+ condition.Type = &t
+ }
events, err := eventQl.Events(ctx, condition)