You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2020/12/08 09:42:40 UTC

[GitHub] [skywalking-cli] fgksgf opened a new pull request #79: Fix the bug that can't query JVM instance metrics

fgksgf opened a new pull request #79:
URL: https://github.com/apache/skywalking-cli/pull/79


   Because the demo env have changed, I can't test CLI commands now.
   
   Resolve apache/skywalking#5973


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [skywalking-cli] fgksgf commented on a change in pull request #79: Fix the bug that can't query JVM instance metrics

Posted by GitBox <gi...@apache.org>.
fgksgf commented on a change in pull request #79:
URL: https://github.com/apache/skywalking-cli/pull/79#discussion_r538970075



##########
File path: commands/interceptor/scope.go
##########
@@ -31,7 +31,7 @@ func ParseScope(name string) schema.Scope {
 		ret = schema.ScopeServiceRelation
 	} else if strings.HasPrefix(name, "service_instance_relation") {
 		ret = schema.ScopeServiceInstanceRelation
-	} else if strings.HasPrefix(name, "service_instance") {
+	} else if strings.HasPrefix(name, "service_instance") || strings.HasPrefix(name, "instance_") {

Review comment:
       Ok, I thought your "auto-scope logic" referred this..




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [skywalking-cli] fgksgf commented on pull request #79: Fix the bug that can't query JVM instance metrics

Posted by GitBox <gi...@apache.org>.
fgksgf commented on pull request #79:
URL: https://github.com/apache/skywalking-cli/pull/79#issuecomment-740513794


   I will let users specify the scope.


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [skywalking-cli] fgksgf commented on pull request #79: Fix the bug that can't query JVM instance metrics

Posted by GitBox <gi...@apache.org>.
fgksgf commented on pull request #79:
URL: https://github.com/apache/skywalking-cli/pull/79#issuecomment-742167112


   > LGTM. Please confirm whether remove `don't merge`.
   
   Tested locally, it works well.


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [skywalking-cli] wu-sheng commented on a change in pull request #79: Fix the bug that can't query JVM instance metrics

Posted by GitBox <gi...@apache.org>.
wu-sheng commented on a change in pull request #79:
URL: https://github.com/apache/skywalking-cli/pull/79#discussion_r539327257



##########
File path: commands/interceptor/entity.go
##########
@@ -0,0 +1,69 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you under
+// the Apache License, Version 2.0 (the "License"); you may
+// not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package interceptor
+
+import (
+	"github.com/apache/skywalking-cli/graphql/schema"
+
+	"github.com/urfave/cli"
+)
+
+func ParseEntity(ctx *cli.Context) *schema.Entity {
+	service := ctx.String("service")
+	normal := ctx.BoolT("isNormal")
+	instance := ctx.String("instance")
+	endpoint := ctx.String("endpoint")
+
+	destService := ctx.String("destService")
+	destNormal := ctx.BoolT("isDestNormal")
+	destInstance := ctx.String("destServiceInstance")
+	destEndpoint := ctx.String("destEndpoint")
+
+	return &schema.Entity{
+		Scope:                   parseScope(ctx),
+		ServiceName:             &service,
+		Normal:                  &normal,
+		ServiceInstanceName:     &instance,
+		EndpointName:            &endpoint,
+		DestServiceName:         &destService,
+		DestNormal:              &destNormal,
+		DestServiceInstanceName: &destInstance,
+		DestEndpointName:        &destEndpoint,
+	}
+}
+
+// parseScope defines the scope based on the input parameters.
+func parseScope(ctx *cli.Context) schema.Scope {
+	ret := schema.ScopeAll
+
+	if ctx.String("destEndpoint") != "" {
+		ret = schema.ScopeEndpointRelation
+	} else if ctx.String("destInstance") != "" {
+		ret = schema.ScopeServiceInstanceRelation
+	} else if ctx.String("destService") != "" {
+		ret = schema.ScopeServiceRelation
+	} else if ctx.String("endpointName") != "" {
+		ret = schema.ScopeEndpoint
+	} else if ctx.String("instanceName") != "" {
+		ret = schema.ScopeServiceInstance
+	} else if ctx.String("serviceName") != "" {
+		ret = schema.ScopeService
+	}

Review comment:
       This rule makes sense to me. @kezhenxu94 Please review others.




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [skywalking-cli] fgksgf merged pull request #79: Fix the bug that can't query JVM instance metrics

Posted by GitBox <gi...@apache.org>.
fgksgf merged pull request #79:
URL: https://github.com/apache/skywalking-cli/pull/79


   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [skywalking-cli] codecov-io commented on pull request #79: Fix the bug that can't query JVM instance metrics

Posted by GitBox <gi...@apache.org>.
codecov-io commented on pull request #79:
URL: https://github.com/apache/skywalking-cli/pull/79#issuecomment-741493471


   # [Codecov](https://codecov.io/gh/apache/skywalking-cli/pull/79?src=pr&el=h1) Report
   > Merging [#79](https://codecov.io/gh/apache/skywalking-cli/pull/79?src=pr&el=desc) (f670e6c) into [master](https://codecov.io/gh/apache/skywalking-cli/commit/8b31c49842b505587d86c258f85e594fb0535a14?el=desc) (8b31c49) will **not change** coverage.
   > The diff coverage is `100.00%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/skywalking-cli/pull/79/graphs/tree.svg?width=650&height=150&src=pr&token=oivudZDTNJ)](https://codecov.io/gh/apache/skywalking-cli/pull/79?src=pr&el=tree)
   
   ```diff
   @@           Coverage Diff           @@
   ##           master      #79   +/-   ##
   =======================================
     Coverage   51.56%   51.56%           
   =======================================
     Files           9        9           
     Lines         128      128           
   =======================================
     Hits           66       66           
     Misses         54       54           
     Partials        8        8           
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/skywalking-cli/pull/79?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [commands/interceptor/scope.go](https://codecov.io/gh/apache/skywalking-cli/pull/79/diff?src=pr&el=tree#diff-Y29tbWFuZHMvaW50ZXJjZXB0b3Ivc2NvcGUuZ28=) | `100.00% <100.00%> (ø)` | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/skywalking-cli/pull/79?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/skywalking-cli/pull/79?src=pr&el=footer). Last update [8b31c49...f670e6c](https://codecov.io/gh/apache/skywalking-cli/pull/79?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [skywalking-cli] wu-sheng commented on a change in pull request #79: Fix the bug that can't query JVM instance metrics

Posted by GitBox <gi...@apache.org>.
wu-sheng commented on a change in pull request #79:
URL: https://github.com/apache/skywalking-cli/pull/79#discussion_r538979290



##########
File path: commands/interceptor/scope.go
##########
@@ -31,7 +31,7 @@ func ParseScope(name string) schema.Scope {
 		ret = schema.ScopeServiceRelation
 	} else if strings.HasPrefix(name, "service_instance_relation") {
 		ret = schema.ScopeServiceInstanceRelation
-	} else if strings.HasPrefix(name, "service_instance") {
+	} else if strings.HasPrefix(name, "service_instance") || strings.HasPrefix(name, "instance_") {

Review comment:
       Let me be more clear. `auto-scope logic` means the scope is based on the input parameter.




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [skywalking-cli] wu-sheng commented on a change in pull request #79: Fix the bug that can't query JVM instance metrics

Posted by GitBox <gi...@apache.org>.
wu-sheng commented on a change in pull request #79:
URL: https://github.com/apache/skywalking-cli/pull/79#discussion_r538969015



##########
File path: commands/interceptor/scope.go
##########
@@ -31,7 +31,7 @@ func ParseScope(name string) schema.Scope {
 		ret = schema.ScopeServiceRelation
 	} else if strings.HasPrefix(name, "service_instance_relation") {
 		ret = schema.ScopeServiceInstanceRelation
-	} else if strings.HasPrefix(name, "service_instance") {
+	} else if strings.HasPrefix(name, "service_instance") || strings.HasPrefix(name, "instance_") {

Review comment:
       I think you should remove this prefix mechanism?




----------------------------------------------------------------
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:
users@infra.apache.org