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 2021/01/18 08:52:35 UTC
[GitHub] [skywalking-cli] fgksgf opened a new pull request #88: Add report event command
fgksgf opened a new pull request #88:
URL: https://github.com/apache/skywalking-cli/pull/88
- [ ] Generate go codes according to the protocol
- [ ] Add a new command `report`
- [ ] Construct a request with CLI flags and arguments
- [ ] Construct a grpc client with generated code
- [ ] Send the request via grpc client
- [ ] Test the code
- [ ] Update README
----------------------------------------------------------------
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] kezhenxu94 commented on pull request #88: Add report event command
Posted by GitBox <gi...@apache.org>.
kezhenxu94 commented on pull request #88:
URL: https://github.com/apache/skywalking-cli/pull/88#issuecomment-766818008
The PR is ready to merge, but can you please make the `report` command as a sub-command `event`, so that we can have more like `swctl event list` in the future
----------------------------------------------------------------
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] kezhenxu94 commented on a change in pull request #88: Add report event command
Posted by GitBox <gi...@apache.org>.
kezhenxu94 commented on a change in pull request #88:
URL: https://github.com/apache/skywalking-cli/pull/88#discussion_r559568701
##########
File path: internal/commands/interceptor/event.go
##########
@@ -0,0 +1,45 @@
+// 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 (
+ "strings"
+
+ "github.com/apache/skywalking-cli/internal/logger"
+
+ "github.com/urfave/cli"
+)
+
+// ParseParameters parses parameters of the event message from args.
+func ParseParameters(paras cli.Args) map[string]string {
+ ret := make(map[string]string, len(paras))
+
+ for _, para := range paras {
+ sepIndex := strings.Index(para, "=")
+ // To make sure that len(k) > 0 && len(v) > 0
+ if len(para) >= 3 && sepIndex >= 1 && sepIndex < len(para)-1 {
+ k := para[:sepIndex]
+ v := para[sepIndex+1:]
+ ret[k] = v
+ } else {
+ logger.Log.Warnf("%s is not a vaild parameter, should like `key=value`\n", para)
Review comment:
Let's return an error to caller function and fail the command there
----------------------------------------------------------------
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] kezhenxu94 merged pull request #88: Add report event command
Posted by GitBox <gi...@apache.org>.
kezhenxu94 merged pull request #88:
URL: https://github.com/apache/skywalking-cli/pull/88
----------------------------------------------------------------
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 #88: Add report event command
Posted by GitBox <gi...@apache.org>.
codecov-io commented on pull request #88:
URL: https://github.com/apache/skywalking-cli/pull/88#issuecomment-762118485
# [Codecov](https://codecov.io/gh/apache/skywalking-cli/pull/88?src=pr&el=h1) Report
> Merging [#88](https://codecov.io/gh/apache/skywalking-cli/pull/88?src=pr&el=desc) (f4fd192) into [master](https://codecov.io/gh/apache/skywalking-cli/commit/1ed7be29e70b52c3318bd0afcb4e5885684da5e0?el=desc) (1ed7be2) will **increase** coverage by `3.17%`.
> The diff coverage is `100.00%`.
[](https://codecov.io/gh/apache/skywalking-cli/pull/88?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #88 +/- ##
==========================================
+ Coverage 44.89% 48.07% +3.17%
==========================================
Files 9 10 +1
Lines 147 156 +9
==========================================
+ Hits 66 75 +9
Misses 73 73
Partials 8 8
```
| [Impacted Files](https://codecov.io/gh/apache/skywalking-cli/pull/88?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [internal/commands/interceptor/event.go](https://codecov.io/gh/apache/skywalking-cli/pull/88/diff?src=pr&el=tree#diff-aW50ZXJuYWwvY29tbWFuZHMvaW50ZXJjZXB0b3IvZXZlbnQuZ28=) | `100.00% <100.00%> (ø)` | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/skywalking-cli/pull/88?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/88?src=pr&el=footer). Last update [1ed7be2...f4fd192](https://codecov.io/gh/apache/skywalking-cli/pull/88?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] fgksgf commented on pull request #88: Add report event command
Posted by GitBox <gi...@apache.org>.
fgksgf commented on pull request #88:
URL: https://github.com/apache/skywalking-cli/pull/88#issuecomment-766887735
> The PR is ready to merge, but can you please make the `report` command as a sub-command `event`, so that we can have more like `swctl event list` in the future
No problem.
----------------------------------------------------------------
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 #88: Add report event command
Posted by GitBox <gi...@apache.org>.
fgksgf commented on pull request #88:
URL: https://github.com/apache/skywalking-cli/pull/88#issuecomment-766887735
> The PR is ready to merge, but can you please make the `report` command as a sub-command `event`, so that we can have more like `swctl event list` in the future
No problem.
----------------------------------------------------------------
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] kezhenxu94 commented on a change in pull request #88: Add report event command
Posted by GitBox <gi...@apache.org>.
kezhenxu94 commented on a change in pull request #88:
URL: https://github.com/apache/skywalking-cli/pull/88#discussion_r559571383
##########
File path: internal/commands/report/report.go
##########
@@ -0,0 +1,120 @@
+// 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 report
+
+import (
+ "github.com/apache/skywalking-cli/internal/commands/interceptor"
+ "github.com/apache/skywalking-cli/internal/logger"
+ "github.com/apache/skywalking-cli/internal/model"
+ "github.com/apache/skywalking-cli/pkg/display"
+ "github.com/apache/skywalking-cli/pkg/display/displayable"
+ "github.com/apache/skywalking-cli/pkg/grpc"
+
+ "github.com/urfave/cli"
+
+ event "skywalking/network/event/v3"
+)
+
+var Command = cli.Command{
+ Name: "report",
+ Aliases: []string{"r"},
+ Usage: "Report an event to OAP server via gRPC",
+ ArgsUsage: "[parameters...]",
+ Flags: []cli.Flag{
+ cli.StringFlag{
+ Name: "grpcAddr",
Review comment:
Because we have multiple commands using this, let's add this as a top level flag, and make it possible to be specified by the `~/.skywalking.yaml`, just like [`base-url`](https://github.com/apache/skywalking-cli/blob/160f2bd2ebb8395d25b728ddaae4dc9995742f79/cmd/swctl/main.go#L61)
----------------------------------------------------------------
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] kezhenxu94 commented on pull request #88: Add report event command
Posted by GitBox <gi...@apache.org>.
kezhenxu94 commented on pull request #88:
URL: https://github.com/apache/skywalking-cli/pull/88#issuecomment-766818008
The PR is ready to merge, but can you please make the `report` command as a sub-command `event`, so that we can have more like `swctl event list` in the future
----------------------------------------------------------------
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