Skip to content

Commit

Permalink
review comments
Browse files Browse the repository at this point in the history
Signed-off-by: tanujd11 <dwiveditanuj41@gmail.com>
  • Loading branch information
tanujd11 committed Sep 20, 2023
1 parent 2a6c57c commit b0dd81a
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 7 deletions.
12 changes: 6 additions & 6 deletions internal/cmd/egctl/envoy_stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,26 @@ var (
statsType, outputFormat string
)

func newEnvoyStatsConfigCmd() *cobra.Command {
func newEnvoyStatsCmd() *cobra.Command {
var podName, podNamespace string

statsConfigCmd := &cobra.Command{
Use: "stats [<type>/]<name>[.<namespace>]",
Use: "envoy-proxy [<type>/]<name>[.<namespace>]",
Short: "Retrieves Envoy metrics in the specified pod",
Long: `Retrieve Envoy emitted metrics for the specified pod.`,
Example: ` # Retrieve Envoy emitted metrics for the specified pod.
egctl experimental stats <pod-name[.namespace]>
# Retrieve Envoy server metrics in prometheus format
egctl experimental stats <pod-name[.namespace]> --output prom
egctl experimental stats envoy-proxy <pod-name[.namespace]> --output prom
# Retrieve Envoy server metrics in prometheus format with merged application metrics
egctl experimental stats <pod-name[.namespace]> --output prom-merged
egctl experimental stats envoy-proxy <pod-name[.namespace]> --output prom-merged
# Retrieve Envoy cluster metrics
egctl experimental stats <pod-name[.namespace]> --type clusters
egctl experimental stats envoy-proxy <pod-name[.namespace]> --type clusters
`,
Aliases: []string{"es"},
Aliases: []string{"ep"},
Args: func(cmd *cobra.Command, args []string) error {
if len(args) != 1 && len(labelSelectors) == 0 {
cmd.Println(cmd.UsageString())
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/egctl/experimental.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func newExperimentalCommand() *cobra.Command {
}

experimentalCommand.AddCommand(NewTranslateCommand())
experimentalCommand.AddCommand(newEnvoyStatsConfigCmd())
experimentalCommand.AddCommand(statsCommand())

return experimentalCommand
}
21 changes: 21 additions & 0 deletions internal/cmd/egctl/stats.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright Envoy Gateway Authors
// SPDX-License-Identifier: Apache-2.0
// The full text of the Apache license is available in the LICENSE file at
// the root of the repo.

package egctl

import (
"github.com/spf13/cobra"
)

func statsCommand() *cobra.Command {
c := &cobra.Command{
Use: "stats",

Check failure on line 14 in internal/cmd/egctl/stats.go

View workflow job for this annotation

GitHub Actions / lint

File is not `gofmt`-ed with `-s` (gofmt)
Long: "Retrieve stats from envoy proxy.",
}

c.AddCommand(newEnvoyStatsCmd())

return c
}

Check failure on line 21 in internal/cmd/egctl/stats.go

View workflow job for this annotation

GitHub Actions / coverage-test

syntax error: unexpected var after top level declaration

0 comments on commit b0dd81a

Please sign in to comment.