Skip to content

Conversation

jotak
Copy link
Member

@jotak jotak commented Nov 7, 2024

  • Remove hardcoded columns
  • Change some of the rendering scripted functions:
    • getConcatenatedValue -> concat now dedicated to just concatenate values
    • they can now accept litterals (e.g. concat(DstAddr,':',DstPort))
    • remove getSrcOrDstValue since there was also "[...]" for the same role
    • add new kubeObject func to show kind-name-namespace sort of things
  • Improve performance by avoiding re-parsing everything for every rendered flow
    • there's probably more that we could do on that side
  • Add unit tests

Description

Dependencies

operator: netobserv/network-observability-operator#835

Checklist

If you are not familiar with our processes or don't know what to answer in the list below, let us know in a comment: the maintainers will take care of that.

  • Is this PR backed with a JIRA ticket? If so, make sure it is written as a title prefix (in general, PRs affecting the NetObserv/Network Observability product should be backed with a JIRA ticket - especially if they bring user facing changes).
  • Does this PR require product documentation?
    • If so, make sure the JIRA epic is labelled with "documentation" and provides a description relevant for doc writers, such as use cases or scenarios. Any required step to activate or configure the feature should be documented there, such as new CRD knobs.
  • Does this PR require a product release notes entry?
    • If so, fill in "Release Note Text" in the JIRA.
  • Is there anything else the QE team should know before testing? E.g: configuration changes, environment setup, etc.
    • If so, make sure it is described in the JIRA ticket.
  • QE requirements (check 1 from the list):
    • Standard QE validation, with pre-merge tests unless stated otherwise.
    • Regression tests only (e.g. refactoring with no user-facing change).
    • No QE (e.g. trivial change with high reviewer's confidence, or per agreement with the QE team).

@openshift-ci-robot
Copy link
Collaborator

openshift-ci-robot commented Nov 7, 2024

@jotak: This pull request references NETOBSERV-1959 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.18.0" version, but no target version was set.

In response to this:

  • Remove hardcoded columns
  • Change some of the rendering scripted functions:
  • getConcatenatedValue -> concat now dedicated to just concatenate values
  • they can now accept litterals (e.g. concat(DstAddr,':',DstPort))
  • remove getSrcOrDstValue since there was also "[...]" for the same role
  • add new kubeObject func to show kind-name-namespace sort of things
  • Improve performance by avoiding re-parsing everything for every rendered flow
  • there's probably more that we could do on that side
  • Add unit tests

Description

Dependencies

n/a

Checklist

If you are not familiar with our processes or don't know what to answer in the list below, let us know in a comment: the maintainers will take care of that.

  • Is this PR backed with a JIRA ticket? If so, make sure it is written as a title prefix (in general, PRs affecting the NetObserv/Network Observability product should be backed with a JIRA ticket - especially if they bring user facing changes).
  • Does this PR require product documentation?
  • If so, make sure the JIRA epic is labelled with "documentation" and provides a description relevant for doc writers, such as use cases or scenarios. Any required step to activate or configure the feature should be documented there, such as new CRD knobs.
  • Does this PR require a product release notes entry?
  • If so, fill in "Release Note Text" in the JIRA.
  • Is there anything else the QE team should know before testing? E.g: configuration changes, environment setup, etc.
  • If so, make sure it is described in the JIRA ticket.
  • QE requirements (check 1 from the list):
  • Standard QE validation, with pre-merge tests unless stated otherwise.
  • Regression tests only (e.g. refactoring with no user-facing change).
  • No QE (e.g. trivial change with high reviewer's confidence, or per agreement with the QE team).

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

Copy link

openshift-ci bot commented Nov 7, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from jotak. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot
Copy link
Collaborator

openshift-ci-robot commented Nov 7, 2024

@jotak: This pull request references NETOBSERV-1959 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.18.0" version, but no target version was set.

In response to this:

  • Remove hardcoded columns
  • Change some of the rendering scripted functions:
  • getConcatenatedValue -> concat now dedicated to just concatenate values
  • they can now accept litterals (e.g. concat(DstAddr,':',DstPort))
  • remove getSrcOrDstValue since there was also "[...]" for the same role
  • add new kubeObject func to show kind-name-namespace sort of things
  • Improve performance by avoiding re-parsing everything for every rendered flow
  • there's probably more that we could do on that side
  • Add unit tests

Description

Dependencies

n/a

Checklist

If you are not familiar with our processes or don't know what to answer in the list below, let us know in a comment: the maintainers will take care of that.

  • Is this PR backed with a JIRA ticket? If so, make sure it is written as a title prefix (in general, PRs affecting the NetObserv/Network Observability product should be backed with a JIRA ticket - especially if they bring user facing changes).
  • Does this PR require product documentation?
  • If so, make sure the JIRA epic is labelled with "documentation" and provides a description relevant for doc writers, such as use cases or scenarios. Any required step to activate or configure the feature should be documented there, such as new CRD knobs.
  • Does this PR require a product release notes entry?
  • If so, fill in "Release Note Text" in the JIRA.
  • Is there anything else the QE team should know before testing? E.g: configuration changes, environment setup, etc.
  • If so, make sure it is described in the JIRA ticket.
  • QE requirements (check 1 from the list):
  • Standard QE validation, with pre-merge tests unless stated otherwise.
  • Regression tests only (e.g. refactoring with no user-facing change).
  • No QE (e.g. trivial change with high reviewer's confidence, or per agreement with the QE team).

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

1 similar comment
@openshift-ci-robot
Copy link
Collaborator

openshift-ci-robot commented Nov 7, 2024

@jotak: This pull request references NETOBSERV-1959 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.18.0" version, but no target version was set.

In response to this:

  • Remove hardcoded columns
  • Change some of the rendering scripted functions:
  • getConcatenatedValue -> concat now dedicated to just concatenate values
  • they can now accept litterals (e.g. concat(DstAddr,':',DstPort))
  • remove getSrcOrDstValue since there was also "[...]" for the same role
  • add new kubeObject func to show kind-name-namespace sort of things
  • Improve performance by avoiding re-parsing everything for every rendered flow
  • there's probably more that we could do on that side
  • Add unit tests

Description

Dependencies

n/a

Checklist

If you are not familiar with our processes or don't know what to answer in the list below, let us know in a comment: the maintainers will take care of that.

  • Is this PR backed with a JIRA ticket? If so, make sure it is written as a title prefix (in general, PRs affecting the NetObserv/Network Observability product should be backed with a JIRA ticket - especially if they bring user facing changes).
  • Does this PR require product documentation?
  • If so, make sure the JIRA epic is labelled with "documentation" and provides a description relevant for doc writers, such as use cases or scenarios. Any required step to activate or configure the feature should be documented there, such as new CRD knobs.
  • Does this PR require a product release notes entry?
  • If so, fill in "Release Note Text" in the JIRA.
  • Is there anything else the QE team should know before testing? E.g: configuration changes, environment setup, etc.
  • If so, make sure it is described in the JIRA ticket.
  • QE requirements (check 1 from the list):
  • Standard QE validation, with pre-merge tests unless stated otherwise.
  • Regression tests only (e.g. refactoring with no user-facing change).
  • No QE (e.g. trivial change with high reviewer's confidence, or per agreement with the QE team).

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci-robot
Copy link
Collaborator

openshift-ci-robot commented Nov 7, 2024

@jotak: This pull request references NETOBSERV-1959 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.18.0" version, but no target version was set.

In response to this:

  • Remove hardcoded columns
  • Change some of the rendering scripted functions:
  • getConcatenatedValue -> concat now dedicated to just concatenate values
  • they can now accept litterals (e.g. concat(DstAddr,':',DstPort))
  • remove getSrcOrDstValue since there was also "[...]" for the same role
  • add new kubeObject func to show kind-name-namespace sort of things
  • Improve performance by avoiding re-parsing everything for every rendered flow
  • there's probably more that we could do on that side
  • Add unit tests

Description

Dependencies

n/a

Checklist

If you are not familiar with our processes or don't know what to answer in the list below, let us know in a comment: the maintainers will take care of that.

  • Is this PR backed with a JIRA ticket? If so, make sure it is written as a title prefix (in general, PRs affecting the NetObserv/Network Observability product should be backed with a JIRA ticket - especially if they bring user facing changes).
  • Does this PR require product documentation?
  • If so, make sure the JIRA epic is labelled with "documentation" and provides a description relevant for doc writers, such as use cases or scenarios. Any required step to activate or configure the feature should be documented there, such as new CRD knobs.
  • Does this PR require a product release notes entry?
  • If so, fill in "Release Note Text" in the JIRA.
  • Is there anything else the QE team should know before testing? E.g: configuration changes, environment setup, etc.
  • If so, make sure it is described in the JIRA ticket.
  • QE requirements (check 1 from the list):
  • Standard QE validation, with pre-merge tests unless stated otherwise.
  • Regression tests only (e.g. refactoring with no user-facing change).
  • No QE (e.g. trivial change with high reviewer's confidence, or per agreement with the QE team).

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@jotak jotak added no-qe This PR doesn't necessitate QE approval no-doc This PR doesn't require documentation change on the NetObserv operator labels Nov 7, 2024
@jotak jotak force-pushed the refac-columns branch 3 times, most recently from 6b7b546 to 23bba4c Compare November 7, 2024 17:01
Comment on lines 7 to 13
const getConfig = () => {
const file = fs.readFileSync('../config/sample-config.yaml', 'utf8');
const config = parse(file);
const columnsConfig: ColumnConfigDef[] = config.frontend.columns;
const fields: FieldConfig[] = config.frontend.fields;
return { columnsConfig, fields };
};
Copy link
Contributor

Choose a reason for hiding this comment

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

We already have some config sample with columns / fields in https://github.com/netobserv/network-observability-console-plugin/blob/main/web/src/components/__tests-data__/config.ts

I guess it would be better to reuse these

Copy link
Member Author

Choose a reason for hiding this comment

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

done

<ResourceIcon kind={kind} />
<Text component={TextVariants.p} className="co-resource-item__resource-name" data-test-id={value}>
{value}
&nbsp;{value}
Copy link
Contributor

Choose a reason for hiding this comment

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

Add a padding or marging using a new classname instead

<div data-test={`field-resource-${kind}.${ns}.${value}`} className="force-truncate">
{resourceIconText(value, kind, ns)}
<TextContent className="record-field-tooltip netobserv-no-child-margin">
{/* Note: THIS IS THE TOOLTIP */}
Copy link
Contributor

Choose a reason for hiding this comment

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

If it's not clear here, you can create a kubeObjTooltip function returning the whole TextContent element. I would avoid having brackets for this comment

return !forbiddenColumns.includes(c.id) && value !== null && value !== '' && !Number.isNaN(value);
return (
!forbiddenColumns.includes(c.id) &&
value !== undefined &&
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it was on purepose to keep undefined values here.

The goal was having null to skip a column display when misconfigured and undefined when the data is missing from the record which will result in empty text display

Copy link
Member Author

Choose a reason for hiding this comment

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

ok I missed this subtelty and it's probably why I have some tests failing.
I'd like somehow to make this more obvious ... but not sure how

Comment on lines 38 to 51
const obj: KubeObj = {
kind: String(getColumnOrRecordValue(columns, record, args[0], '')),
namespace: String(getColumnOrRecordValue(columns, record, args[1], '')),
name: String(getColumnOrRecordValue(columns, record, args[2], '')),
showNamespace: args[3] === '1'
};
if (!obj.name || !obj.kind) {
return undefined;
}
// Remove empty namespace
if (obj.namespace === '') {
delete obj.namespace;
}
return obj;
Copy link
Contributor

Choose a reason for hiding this comment

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

It would feel easier to read building the KubeObj at return statement:

Suggested change
const obj: KubeObj = {
kind: String(getColumnOrRecordValue(columns, record, args[0], '')),
namespace: String(getColumnOrRecordValue(columns, record, args[1], '')),
name: String(getColumnOrRecordValue(columns, record, args[2], '')),
showNamespace: args[3] === '1'
};
if (!obj.name || !obj.kind) {
return undefined;
}
// Remove empty namespace
if (obj.namespace === '') {
delete obj.namespace;
}
return obj;
const kind = String(getColumnOrRecordValue(columns, record, args[0], ''));
const namespace = String(getColumnOrRecordValue(columns, record, args[1], ''));
const name = String(getColumnOrRecordValue(columns, record, args[2], ''));
const showNamespace = args[3] === '1'
};
if (!name || !kind) {
return undefined;
} else if (namespace === '') {
return { kind, name };
}
return { kind, namespace, name, showNamespace };

Comment on lines +100 to +105
export interface KubeObj {
name: string;
kind: string;
namespace?: string;
showNamespace: boolean;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

following kubeObject parser suggestion:

Suggested change
export interface KubeObj {
name: string;
kind: string;
namespace?: string;
showNamespace: boolean;
}
export interface KubeObj {
name: string;
kind: string;
namespace?: string;
showNamespace?: boolean;
}

Copy link
Member Author

Choose a reason for hiding this comment

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

I did (almost) what you suggested but kept showNamespace strict boolean

Copy link

codecov bot commented Nov 8, 2024

Codecov Report

Attention: Patch coverage is 62.23776% with 54 lines in your changes missing coverage. Please review.

Project coverage is 56.54%. Comparing base (c12294d) to head (ca42865).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
web/src/utils/column-parser.ts 66.27% 27 Missing and 2 partials ⚠️
web/src/components/drawer/record/record-field.tsx 56.66% 11 Missing and 2 partials ⚠️
web/src/utils/columns.ts 35.29% 9 Missing and 2 partials ⚠️
web/src/components/netflow-traffic.tsx 75.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #633      +/-   ##
==========================================
+ Coverage   55.75%   56.54%   +0.78%     
==========================================
  Files         195      196       +1     
  Lines       10065    10063       -2     
  Branches     1200     1195       -5     
==========================================
+ Hits         5612     5690      +78     
+ Misses       4084     4008      -76     
+ Partials      369      365       -4     
Flag Coverage Δ
uitests 59.25% <62.23%> (+1.14%) ⬆️
unittests 50.58% <ø> (ø)

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

Files with missing lines Coverage Δ
web/src/components/__tests-data__/columns.ts 100.00% <ø> (ø)
web/src/components/__tests-data__/flows.ts 100.00% <ø> (ø)
web/src/components/drawer/record/record-panel.tsx 52.23% <100.00%> (+2.23%) ⬆️
...omponents/tabs/netflow-table/netflow-table-row.tsx 91.66% <ø> (ø)
web/src/components/netflow-traffic.tsx 66.76% <75.00%> (-0.10%) ⬇️
web/src/utils/columns.ts 78.10% <35.29%> (+23.00%) ⬆️
web/src/components/drawer/record/record-field.tsx 52.04% <56.66%> (+2.87%) ⬆️
web/src/utils/column-parser.ts 66.27% <66.27%> (ø)

... and 1 file with indirect coverage changes

---- 🚨 Try these New Features:

@openshift-ci-robot
Copy link
Collaborator

openshift-ci-robot commented Nov 12, 2024

@jotak: This pull request references NETOBSERV-1959 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.18.0" version, but no target version was set.

In response to this:

  • Remove hardcoded columns
  • Change some of the rendering scripted functions:
  • getConcatenatedValue -> concat now dedicated to just concatenate values
  • they can now accept litterals (e.g. concat(DstAddr,':',DstPort))
  • remove getSrcOrDstValue since there was also "[...]" for the same role
  • add new kubeObject func to show kind-name-namespace sort of things
  • Improve performance by avoiding re-parsing everything for every rendered flow
  • there's probably more that we could do on that side
  • Add unit tests

Description

Dependencies

operator: netobserv/network-observability-operator#835

Checklist

If you are not familiar with our processes or don't know what to answer in the list below, let us know in a comment: the maintainers will take care of that.

  • Is this PR backed with a JIRA ticket? If so, make sure it is written as a title prefix (in general, PRs affecting the NetObserv/Network Observability product should be backed with a JIRA ticket - especially if they bring user facing changes).
  • Does this PR require product documentation?
  • If so, make sure the JIRA epic is labelled with "documentation" and provides a description relevant for doc writers, such as use cases or scenarios. Any required step to activate or configure the feature should be documented there, such as new CRD knobs.
  • Does this PR require a product release notes entry?
  • If so, fill in "Release Note Text" in the JIRA.
  • Is there anything else the QE team should know before testing? E.g: configuration changes, environment setup, etc.
  • If so, make sure it is described in the JIRA ticket.
  • QE requirements (check 1 from the list):
  • Standard QE validation, with pre-merge tests unless stated otherwise.
  • Regression tests only (e.g. refactoring with no user-facing change).
  • No QE (e.g. trivial change with high reviewer's confidence, or per agreement with the QE team).

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

- Remove hardcoded columns
- Change some of the rendering scripted functions:
  - getConcatenatedValue -> concat now dedicated to just concatenate
    values
  - they can now accept litterals (e.g. concat(DstAddr,':',DstPort))
  - remove getSrcOrDstValue since there was also "[...]" for the same
    role
  - add new kubeObject func to show kind-name-namespace sort of things
- Improve performance by avoiding re-parsing everything for every rendered
  flow
  - there's probably more that we could do on that side
- Add unit tests
Previously, visible fields were determined out of several criteria
including:
- fields with calculated values were filtered out
- record with null value was filtered out (as opposed to undefined)

Also, "Common" columns was determined by having a calculated value (ie.
non-common columns were prohibited to use calculated)

This must change since columns can now have calculated and still must be
visible (e.g. SrcK8S_Name is a kubeObject calculated value)

- So, Common now is when calculated in the form of "[a,b]"
- Visible columns for side panel is now based on being tied to fields
Those fields should be correctly displayed when ICMP data is present,
and not displayed (in side panel) when ICMP data is absent.
Copy link

openshift-ci bot commented Nov 18, 2024

New changes are detected. LGTM label has been removed.

@jotak jotak merged commit 8fb9a44 into netobserv:main Nov 19, 2024
7 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

jira/valid-reference no-doc This PR doesn't require documentation change on the NetObserv operator no-qe This PR doesn't necessitate QE approval

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants