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

Add status messages for traceflow graph #1277

Merged
merged 1 commit into from
Sep 23, 2020
Merged

Conversation

ZhangYW18
Copy link
Contributor

@ZhangYW18 ZhangYW18 commented Sep 21, 2020

When users start a traceflow on the Antrea Octant plugin, they need to wait for several seconds before the traceflow graph finishes., which may be considered a UI bug. Also, when something's wrong with traceflow, users will see a blank graph, which is confusing.

This patch shows status messages on traceflow graph when traceflow is running, pending or stopped for some reason. When users start a traceflow, they will see the graph showing "traceflow xxx is running" in the first seconds.

Example graphs:

  1. Traceflow is running:
    running

  2. Showing error messages:
    error

According to Octant team, the next Octant release is running into some delays and pushing into early this week. Alerts with traceflow error messages will be added after the next Octant release.

Fixes #1175

@antrea-bot
Copy link
Collaborator

Thanks for your PR.
Unit tests and code linters are run automatically every time the PR is updated.
E2e, conformance and network policy tests can only be triggered by a member of the vmware-tanzu organization. Regular contributors to the project should join the org.

The following commands are available:

  • /test-e2e: to trigger e2e tests.
  • /skip-e2e: to skip e2e tests.
  • /test-conformance: to trigger conformance tests.
  • /skip-conformance: to skip conformance tests.
  • /test-whole-conformance: to trigger all conformance tests on linux.
  • /skip-whole-conformance: to skip all conformance tests on linux.
  • /test-networkpolicy: to trigger networkpolicy tests.
  • /skip-networkpolicy: to skip networkpolicy tests.
  • /test-windows-conformance: to trigger windows conformance tests.
  • /skip-windows-conformance: to skip windows conformance tests.
  • /test-windows-networkpolicy: to trigger windows networkpolicy tests.
  • /skip-windows-networkpolicy: to skip windows networkpolicy tests.
  • /test-hw-offload: to trigger ovs hardware offload test.
  • /skip-hw-offload: to skip ovs hardware offload test.
  • /test-all: to trigger all tests (except whole conformance).
  • /skip-all: to skip all tests (except whole conformance).

@codecov-commenter
Copy link

codecov-commenter commented Sep 21, 2020

Codecov Report

Merging #1277 into master will decrease coverage by 0.02%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1277      +/-   ##
==========================================
- Coverage   55.02%   55.00%   -0.03%     
==========================================
  Files         110      110              
  Lines       10573    10596      +23     
==========================================
+ Hits         5818     5828      +10     
- Misses       4183     4192       +9     
- Partials      572      576       +4     
Flag Coverage Δ
#integration-tests 44.87% <ø> (-0.14%) ⬇️
#unit-tests 41.88% <ø> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pkg/apiserver/handlers/endpoint/handler.go 58.82% <0.00%> (-11.77%) ⬇️
pkg/ovs/openflow/ofctrl_bridge.go 67.98% <0.00%> (-1.59%) ⬇️
pkg/controller/traceflow/controller.go 61.29% <0.00%> (-1.30%) ⬇️
pkg/agent/controller/networkpolicy/reconciler.go 66.50% <0.00%> (-0.01%) ⬇️
pkg/agent/openflow/client.go 32.85% <0.00%> (ø)
pkg/apis/controlplane/helper.go 0.00% <0.00%> (ø)
pkg/agent/types/networkpolicy.go 11.11% <0.00%> (ø)
pkg/apis/controlplane/v1beta1/helper.go 0.00% <0.00%> (ø)
pkg/agent/openflow/pipeline.go 57.26% <0.00%> (+0.06%) ⬆️
pkg/agent/openflow/network_policy.go 73.70% <0.00%> (+0.07%) ⬆️
... and 5 more

} else {
wStr += string(str[i])
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could it use strings.ReplaceAll instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Used strings.ReplaceAll instead.

@@ -309,6 +334,12 @@ func GenGraph(tf *opsv1alpha1.Traceflow) (string, error) {

senderRst := getNodeResult(tf, isSender)
receiverRst := getNodeResult(tf, isReceiver)
if tf.Status.Phase != opsv1alpha1.Succeeded {
err := getTraceflowStatusMessage(tf, graph)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it doesn't seem that the function will return an error, and having a side effect in a get function is obscure, maybe just let the function return the message and set the label in GenGraph, which could be more consistent as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function modified.

case opsv1alpha1.Pending:
return getWrappedStr(fmt.Sprintf("traceflow %s is pending...", tf.Name))
default:
return "Unknown traceflow status, please check whether Antrea is running and traceflow is enabled."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't this message need to be wrapped by "?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added getWrappedStr.

tnqn
tnqn previously approved these changes Sep 22, 2020
Copy link
Member

@tnqn tnqn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

func getTraceflowStatusMessage(tf *opsv1alpha1.Traceflow) string {
switch tf.Status.Phase {
case opsv1alpha1.Failed:
return getWrappedStr(fmt.Sprintf("traceflow %s failed: %s", tf.Name, tf.Status.Reason))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel "Traceflow" is better.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"traceflow" changed to "Traceflow".

case opsv1alpha1.Pending:
return getWrappedStr(fmt.Sprintf("traceflow %s is pending...", tf.Name))
default:
return getWrappedStr("Unknown traceflow status, please check whether Antrea is running and traceflow is enabled.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion - Unknown Traceflow status. Please check Antrea is running with Traceflow feature gate enabled.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Message revised.

Copy link
Member

@tnqn tnqn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tnqn
Copy link
Member

tnqn commented Sep 23, 2020

/test-all

@tnqn tnqn merged commit 76b3641 into antrea-io:master Sep 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Traceflow UX improvement
6 participants