arugal commented on a change in pull request #10: [Feature] Support instance
list command
URL: https://github.com/apache/skywalking-cli/pull/10#discussion_r344484220
##########
File path: graphql/client/client.go
##########
@@ -50,3 +55,33 @@ func Services(cliCtx *cli.Context, duration
schema.Duration) []schema.Service {
return response["services"]
}
+
+func Instances(cliCtx *cli.Context, serviceId string, duration
schema.Duration) []schema.ServiceInstance {
+ client := newGraphqlClient(cliCtx)
+
+ var response map[string][]schema.ServiceInstance
+ request := graphql.NewRequest(`
+ query ($serviceId: ID!, $duration: Duration!) {
+ instances: getServiceInstances(duration: $duration, serviceId:
$serviceId) {
+ id
+ name
+ language
+ instanceUUID
+ attributes {
+ name
+ value
+ }
+ }
+ }
+ `)
+ request.Var("serviceId", serviceId)
+ request.Var("duration", duration)
+
+ ctx := context.Background()
+ if err := client.Run(ctx, request, &response); err != nil {
+ logger.Log.Fatalln(err)
+ panic(err)
Review comment:
I'll check all the code
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services