@@ -53,6 +53,9 @@ $ swctl trace ls --service-name "business-zone::projectB" --endpoint-name "/proj
5353
54543. Query the monitored trace of id "321661b1-9a31-4e12-ad64-c8f6711f108d":
5555$ swctl trace ls --trace-id "321661b1-9a31-4e12-ad64-c8f6711f108d"
56+
57+ 4. Query the monitored trace of id "321661b1-9a31-4e12-ad64-c8f6711f108d" from cold-stage storage:
58+ $ swctl trace ls --trace-id "321661b1-9a31-4e12-ad64-c8f6711f108d" --cold
5659` ,
5760 Flags : flags .Flags (
5861 flags .DurationFlags ,
@@ -74,6 +77,11 @@ $ swctl trace ls --trace-id "321661b1-9a31-4e12-ad64-c8f6711f108d"
7477 Usage : "`order` of the returned traces, can be `duration` or `startTime`" ,
7578 Value : "duration" ,
7679 },
80+ & cli.BoolFlag {
81+ Name : "cold" ,
82+ Usage : "query trace from cold-stage storage, must be used with trace-id" ,
83+ Value : false ,
84+ },
7785 },
7886 ),
7987 Before : interceptor .BeforeChain (
@@ -96,6 +104,20 @@ $ swctl trace ls --trace-id "321661b1-9a31-4e12-ad64-c8f6711f108d"
96104 serviceInstanceID := ctx .String ("instance-id" )
97105 traceID := ctx .String ("trace-id" )
98106 tagStr := ctx .String ("tags" )
107+ cold := ctx .Bool ("cold" )
108+
109+ if cold && traceID == "" {
110+ return fmt .Errorf ("cold storage must be queried with trace-id" )
111+ }
112+
113+ if cold {
114+ trace , err := trace .ColdTrace (ctx .Context , duration , traceID )
115+ if err != nil {
116+ return err
117+ }
118+ return display .Display (ctx .Context , & displayable.Displayable {Data : trace })
119+ }
120+
99121 var tags []* api.SpanTag = nil
100122 if tagStr != "" {
101123 tagArr := strings .SplitSeq (tagStr , "," )
0 commit comments