Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI panic when using stat --from flag with a job #1872

Closed
klingerf opened this issue Nov 26, 2018 · 0 comments
Closed

CLI panic when using stat --from flag with a job #1872

klingerf opened this issue Nov 26, 2018 · 0 comments

Comments

@klingerf
Copy link
Contributor

klingerf commented Nov 26, 2018

Bug Report

What is the issue?

The CLI stat command panics when the --from flag is used with a job resource.

How can it be reproduced?

First build linkerd and run all integration tests:

bin/fast-build
bin/test-run `pwd`/bin/linkerd

Then try to fetch deployment stats filtered by source job:

$ bin/linkerd stat deploy/gateway -n linkerd-tap-test --from job/slow-cooker
panic: runtime error: index out of range

goroutine 1 [running]:
github.com/linkerd/linkerd2/controller/api/util.BuildResource(0x0, 0x0, 0x7ffeefbff85f, 0xf, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/Users/kl/workspace/go/src/github.com/linkerd/linkerd2/controller/api/util/api_utils.go:284 +0xe9
github.com/linkerd/linkerd2/cli/cmd.buildStatSummaryRequests(0xc420429b20, 0x1, 0x7, 0xc420434300, 0x1da0ae0, 0x0, 0x1f7205b, 0x32, 0x28c52e0)
	/Users/kl/workspace/go/src/github.com/linkerd/linkerd2/cli/cmd/stat.go:447 +0x558
github.com/linkerd/linkerd2/cli/cmd.newCmdStat.func1(0xc420433440, 0xc420429b20, 0x1, 0x7, 0x0, 0x0)
	/Users/kl/workspace/go/src/github.com/linkerd/linkerd2/cli/cmd/stat.go:118 +0x6e
github.com/linkerd/linkerd2/vendor/github.com/spf13/cobra.(*Command).execute(0xc420433440, 0xc420429ab0, 0x7, 0x7, 0xc420433440, 0xc420429ab0)
	/Users/kl/workspace/go/src/github.com/linkerd/linkerd2/vendor/github.com/spf13/cobra/command.go:698 +0x46d
github.com/linkerd/linkerd2/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0x2898b20, 0x0, 0xc4201a5f68, 0x1c6aec3)
	/Users/kl/workspace/go/src/github.com/linkerd/linkerd2/vendor/github.com/spf13/cobra/command.go:783 +0x2e4
github.com/linkerd/linkerd2/vendor/github.com/spf13/cobra.(*Command).Execute(0x2898b20, 0xc4201a5f78, 0xc4200a6058)
	/Users/kl/workspace/go/src/github.com/linkerd/linkerd2/vendor/github.com/spf13/cobra/command.go:736 +0x2b
main.main()
	/Users/kl/workspace/go/src/github.com/linkerd/linkerd2/cli/main.go:10 +0x2d

Additional context

Note that using the --from flag with a pod instead of a job works as expected:a

$ bin/linkerd stat deploy/gateway -n linkerd-tap-test --from po/slow-cooker-2s7th
NAME      MESHED   SUCCESS      RPS   LATENCY_P50   LATENCY_P95   LATENCY_P99   TLS
gateway      1/1     0.00%   1.0rps          17ms          28ms          30ms    0%

Job stats aren't supported from the CLI, but I'd still expect to be able to filter using a job resource. Or if it's really not supported, we should return a validation error instead of panicking.

@klingerf klingerf reopened this Nov 26, 2018
@klingerf klingerf added the bug label Nov 26, 2018
@grampelberg grampelberg added the priority/P1 Planned for Release label Nov 29, 2018
@siggy siggy self-assigned this Nov 30, 2018
siggy added a commit that referenced this issue Nov 30, 2018
Also add support for `job` as a `--from` and `--to` flag.

Fixes #1872

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
siggy added a commit that referenced this issue Dec 1, 2018
Filtering by Kubernetes job was not supported. Also filtering by any unknown
type caused a panic.

Add filtering support by Kubernetes job, with special case mapping `job` to
`k8s_job`, to not conflict with Prometheus' job label.

Fix panic when unknown type specified as a `--from` or `--to` flag.

Fix `job` label from `linkerd-proxy` overwriting Prometheus `job` label at
collection time. This caused all metrics collected by proxy sidecars in
Kubernetes jobs to be collected into an incorrect Prometheus job, rather than
the expected `linkerd-proxy` Prometheus job.

Fix `unsupported resource type` tap error message incorrectly printing the
target resource rather than the destination.

Set `--controller-log-level debug` in `install_test.go` for easier debugging.

Expose `slow-cooker`'s metrics via a k8s service in the tap integration test, to
validate proxy requests with a job as destination.

Fixes #1872
Part of #627

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
siggy added a commit that referenced this issue Dec 3, 2018
Filtering by Kubernetes job was not supported. Also filtering by any unknown
type caused a panic.

Add filtering support by Kubernetes job, with special case mapping `job` to
`k8s_job`, to not conflict with Prometheus' job label.

Fix panic when unknown type specified as a `--from` or `--to` flag.

Fix `job` label from `linkerd-proxy` overwriting Prometheus `job` label at
collection time. This caused all metrics collected by proxy sidecars in
Kubernetes jobs to be collected into an incorrect Prometheus job, rather than
the expected `linkerd-proxy` Prometheus job.

Fix `unsupported resource type` tap error message incorrectly printing the
target resource rather than the destination.

Set `--controller-log-level debug` in `install_test.go` for easier debugging.

Expose `slow-cooker`'s metrics via a k8s service in the tap integration test, to
validate proxy requests with a job as destination.

Fixes #1872
Part of #627

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants