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

Application Layer Dashboard #523

Closed
wants to merge 7 commits into from
Closed

Conversation

Dhruv-J
Copy link
Contributor

@Dhruv-J Dhruv-J commented Oct 4, 2023

This PR adds an Application Layer Dashboard to include visualizations for layer
seven Network Policies and HTTP values within the flows table. The changes
include the following:

  1. A new dashboard named Application Layer Visibility, which contains two
    panels, a Chord Panel to illustrate layer seven Network Policies, and a table
    panel that shows the HTTP values for each flow.

  2. Since the default grafana table plugin isn't able to handle nested JSON
    values and aggregate them in a clean manner, this PR introduces a new plugin
    called http-table-plugin that leverages the material-ui library to create a
    simple table that includes the source and destination IPs and ports, with
    expandable rows that show multiple HTTP value sets if a flow contains them.
    This plugin is created using the updated @grafana/create-plugin tool, which
    contains a .config directory for all plugin build and run configuration files.

  3. Testing for the application layer dashboard and unit testing for the
    http-table-plugin.

This PR builds upon #417, which adds additional fields for L7 visibility.

@Dhruv-J
Copy link
Contributor Author

Dhruv-J commented Oct 4, 2023

will update docs with following images:
Screenshot 2023-10-04 at 4 14 41 PM
Screenshot 2023-10-04 at 4 14 52 PM
Screenshot 2023-10-04 at 4 16 59 PM
Screenshot 2023-10-04 at 4 17 05 PM

@codecov
Copy link

codecov bot commented Oct 4, 2023

Codecov Report

Attention: Patch coverage is 98.14815% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 70.87%. Comparing base (5ea4756) to head (67ae723).
Report is 27 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #523      +/-   ##
==========================================
+ Coverage   70.51%   70.87%   +0.35%     
==========================================
  Files          40       48       +8     
  Lines        5253     5565     +312     
  Branches        0       45      +45     
==========================================
+ Hits         3704     3944     +240     
- Misses       1372     1437      +65     
- Partials      177      184       +7     
Flag Coverage Δ *Carryforward flag
kind-e2e-tests 62.48% <ø> (ø) Carriedforward from 2090b55
kind-multi-cluster-e2e-tests 43.17% <ø> (ø)
python-coverage 55.75% <ø> (ø) Carriedforward from 2090b55
unit-tests 70.42% <ø> (+0.27%) ⬆️

*This pull request uses carry forward flags. Click here to find out more.

Files Coverage Δ
...ns/grafana-http-table-plugin/.config/jest-setup.js 100.00% <100.00%> (ø)
...ugins/grafana-http-table-plugin/src/TablePanel.tsx 100.00% <100.00%> (ø)
...able-plugin/.config/jest/mocks/react-inlinesvg.tsx 83.33% <83.33%> (ø)

... and 5 files with indirect coverage changes

@Dhruv-J
Copy link
Contributor Author

Dhruv-J commented Oct 16, 2023

Screenshot 2023-10-16 at 11 20 46 AM
Screenshot 2023-10-16 at 11 20 55 AM

"uid": "tCTkERMSk",
"version": 1,
"weekStart": ""
}
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 blank line

@@ -576,7 +576,7 @@
},
"id": 27,
"options": {
"content": "The following seven dashboards are pre-built and are recommended for network flow\nvisualization.\n\n<span style=\"color:rgb(184, 119, 217)\">Flow Records Dashboard</span> displays the flow records being captured in the selected\ntime range.\n\n<span style=\"color:rgb(184, 119, 217)\">Pod-to-Pod Flows Dashboard</span> shows cumulative bytes and throughput of Pod-to-Pod\ntraffic.\n\n<span style=\"color:rgb(184, 119, 217)\">Pod-to-External Flows Dashboard</span> shows cumulative bytes and throughput of\ntraffic from in-cluster to out-of-cluster. The destination of such a traffic flow\nis represented by the destination IP address.\n\n<span style=\"color:rgb(184, 119, 217)\">Pod-to-Service Flows Dashboard</span> shows cumulative bytes and throughput of\nPod-to-Service flows. The destination of such a traffic is represented by the\ndestination Service metadata.\n\n<span style=\"color:rgb(184, 119, 217)\">Node-to-Node Flows Dashboard</span> visualizes the Node-to-Node traffic, including intra-Node\nand inter-Node flows.\n\n<span style=\"color:rgb(184, 119, 217)\">Network-Policy Flows Dashboard</span> visualizes both the traffic with NetworkPolicies enforced,\nand unprotected traffic.\n\n<span style=\"color:rgb(184, 119, 217)\">Network Topology Dashboard</span> visualizes both Pod-to-Pod and Pod-to-Service traffic via a graph.",
"content": "The following eight dashboards are pre-built and are recommended for network flow\nvisualization.\n\n<span style=\"color:rgb(184, 119, 217)\">Flow Records Dashboard</span> displays the flow records being captured in the selected\ntime range.\n\n<span style=\"color:rgb(184, 119, 217)\">Pod-to-Pod Flows Dashboard</span> shows cumulative bytes and throughput of Pod-to-Pod\ntraffic.\n\n<span style=\"color:rgb(184, 119, 217)\">Pod-to-External Flows Dashboard</span> shows cumulative bytes and throughput of\ntraffic from in-cluster to out-of-cluster. The destination of such a traffic flow\nis represented by the destination IP address.\n\n<span style=\"color:rgb(184, 119, 217)\">Pod-to-Service Flows Dashboard</span> shows cumulative bytes and throughput of\nPod-to-Service flows. The destination of such a traffic is represented by the\ndestination Service metadata.\n\n<span style=\"color:rgb(184, 119, 217)\">Node-to-Node Flows Dashboard</span> visualizes the Node-to-Node traffic, including intra-Node\nand inter-Node flows.\n\n<span style=\"color:rgb(184, 119, 217)\">Network-Policy Flows Dashboard</span> visualizes both the traffic with NetworkPolicies enforced,\nand unprotected traffic.\n\n<span style=\"color:rgb(184, 119, 217)\">Network Topology Dashboard</span> visualizes both Pod-to-Pod and Pod-to-Service traffic via a graph.\n\n<span style=\"color:rgb(184, 119, 217)\">Application Visibility Dashboard</span> shows cumulative bytes and throughput for L7 NetworkPolicies\nas well as corresponding HTTP values.",
Copy link
Contributor

Choose a reason for hiding this comment

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

Application Visibility Dashboard displays cumulative bytes and throughput for L7 NetworkPolicies\nas well as corresponding HTTP data.

}
},
"queryType": "sql",
"rawSql": "SELECT sourcePodName, sourcePodLabels, sourcePodNamespace, sourceNodeName, destinationPodName, destinationPodLabels, destinationNodeName, destinationServicePortName, octetDeltaCount FROM flows\nWHERE sourcePodNamespace NOT IN ('kube-system', 'flow-visibility', 'flow-aggregator')\nAND destinationPodNamespace NOT IN ('kube-system', 'flow-visibility', 'flow-aggregator')\nAND ( destinationPodName != '' OR sourcePodName != '' )\nAND octetDeltaCount != 0\nAND httpVals == ''\nAND $__timeFilter(flowEndSeconds)\nORDER BY flowEndSeconds DESC",
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't it be based on the l7ProtocolName instead of httpvals?

@@ -60,11 +101,11 @@
}
},
"queryType": "sql",
"rawSql": "SELECT sourcePodName, sourcePodLabels, sourcePodNamespace, sourceNodeName, destinationPodName, destinationPodLabels, destinationNodeName, destinationServicePortName, octetDeltaCount FROM flows\nWHERE sourcePodNamespace NOT IN ('kube-system', 'flow-visibility', 'flow-aggregator')\nAND destinationPodNamespace NOT IN ('kube-system', 'flow-visibility', 'flow-aggregator')\nAND destinationPodName != ''\nAND sourcePodName != ''\nAND octetDeltaCount != 0\nAND $__timeFilter(flowEndSeconds)\nORDER BY flowEndSeconds DESC",
"rawSql": "SELECT sourcePodName, sourcePodLabels, sourcePodNamespace, sourceNodeName, sourceIP, sourceTransportPort, destinationPodName, destinationPodLabels, destinationNodeName, destinationServicePortName, destinationIP, destinationTransportPort, octetDeltaCount, httpVals FROM flows\nWHERE sourcePodNamespace NOT IN ('kube-system', 'flow-visibility', 'flow-aggregator')\nAND destinationPodNamespace NOT IN ('kube-system', 'flow-visibility', 'flow-aggregator')\nAND ( destinationPodName != '' OR sourcePodName != '' )\nAND octetDeltaCount != 0\nAND httpVals != ''\nAND $__timeFilter(flowEndSeconds)\nORDER BY flowEndSeconds DESC",
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

"weekStart": ""
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Blank line

Copy link
Contributor

Choose a reason for hiding this comment

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

Solved?

@@ -2770,7 +2928,7 @@ data:
},
"id": 27,
"options": {
"content": "The following seven dashboards are pre-built and are recommended for network flow\nvisualization.\n\n<span style=\"color:rgb(184, 119, 217)\">Flow Records Dashboard</span> displays the flow records being captured in the selected\ntime range.\n\n<span style=\"color:rgb(184, 119, 217)\">Pod-to-Pod Flows Dashboard</span> shows cumulative bytes and throughput of Pod-to-Pod\ntraffic.\n\n<span style=\"color:rgb(184, 119, 217)\">Pod-to-External Flows Dashboard</span> shows cumulative bytes and throughput of\ntraffic from in-cluster to out-of-cluster. The destination of such a traffic flow\nis represented by the destination IP address.\n\n<span style=\"color:rgb(184, 119, 217)\">Pod-to-Service Flows Dashboard</span> shows cumulative bytes and throughput of\nPod-to-Service flows. The destination of such a traffic is represented by the\ndestination Service metadata.\n\n<span style=\"color:rgb(184, 119, 217)\">Node-to-Node Flows Dashboard</span> visualizes the Node-to-Node traffic, including intra-Node\nand inter-Node flows.\n\n<span style=\"color:rgb(184, 119, 217)\">Network-Policy Flows Dashboard</span> visualizes both the traffic with NetworkPolicies enforced,\nand unprotected traffic.\n\n<span style=\"color:rgb(184, 119, 217)\">Network Topology Dashboard</span> visualizes both Pod-to-Pod and Pod-to-Service traffic via a graph.",
"content": "The following eight dashboards are pre-built and are recommended for network flow\nvisualization.\n\n<span style=\"color:rgb(184, 119, 217)\">Flow Records Dashboard</span> displays the flow records being captured in the selected\ntime range.\n\n<span style=\"color:rgb(184, 119, 217)\">Pod-to-Pod Flows Dashboard</span> shows cumulative bytes and throughput of Pod-to-Pod\ntraffic.\n\n<span style=\"color:rgb(184, 119, 217)\">Pod-to-External Flows Dashboard</span> shows cumulative bytes and throughput of\ntraffic from in-cluster to out-of-cluster. The destination of such a traffic flow\nis represented by the destination IP address.\n\n<span style=\"color:rgb(184, 119, 217)\">Pod-to-Service Flows Dashboard</span> shows cumulative bytes and throughput of\nPod-to-Service flows. The destination of such a traffic is represented by the\ndestination Service metadata.\n\n<span style=\"color:rgb(184, 119, 217)\">Node-to-Node Flows Dashboard</span> visualizes the Node-to-Node traffic, including intra-Node\nand inter-Node flows.\n\n<span style=\"color:rgb(184, 119, 217)\">Network-Policy Flows Dashboard</span> visualizes both the traffic with NetworkPolicies enforced,\nand unprotected traffic.\n\n<span style=\"color:rgb(184, 119, 217)\">Network Topology Dashboard</span> visualizes both Pod-to-Pod and Pod-to-Service traffic via a graph.\n\n<span style=\"color:rgb(184, 119, 217)\">Application Visibility Dashboard</span> shows cumulative bytes and throughput for L7 NetworkPolicies\nas well as corresponding HTTP values.",
Copy link
Contributor

Choose a reason for hiding this comment

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

same as above

@@ -0,0 +1,16 @@
ARG grafana_version=latest
Copy link
Contributor

Choose a reason for hiding this comment

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

why use latest and not a verified version?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will update to 9.1.3

@@ -0,0 +1,3 @@
{
"extends": "./.config/tsconfig.json"
}
Copy link
Contributor

Choose a reason for hiding this comment

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

There are lots of generated file missing empty line. Do we have a method to avoid that? Or we should add it manually?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think we do, I will add them manually

Copy link
Contributor

Choose a reason for hiding this comment

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

missing empty line

@@ -0,0 +1,133 @@
import React, { useMemo } from 'react';
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we can add unit test for this file to verify if the data are in our component correctly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes will do, working on getting tests to run locally

"scripts": {
"build": "webpack -c ./.config/webpack/webpack.config.ts --env production",
"dev": "webpack -w -c ./.config/webpack/webpack.config.ts --env development",
"test": "jest --watch --onlyChanged",
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove watch, otherwise it won't stop when we do the typescript unit test in the workflow.

This PR adds an Application Layer Dashboard to include visualizations for layer
seven Network Policies and HTTP values within the flows table.

Signed-off-by: Dhruv-J <[email protected]>
}
},
"queryType": "sql",
"rawSql": "SELECT sourcePodName, sourcePodLabels, sourcePodNamespace, sourceNodeName, destinationPodName, destinationPodLabels, destinationNodeName, destinationServicePortName, octetDeltaCount FROM flows\nWHERE sourcePodNamespace NOT IN ('kube-system', 'flow-visibility', 'flow-aggregator')\nAND destinationPodNamespace NOT IN ('kube-system', 'flow-visibility', 'flow-aggregator')\nAND ( destinationPodName != '' OR sourcePodName != '' )\nAND octetDeltaCount != 0\nAND httpVals == ''\nAND $__timeFilter(flowEndSeconds)\nORDER BY flowEndSeconds DESC",
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to exclude the ns local-path-storage, which is created in the kind cluster by default?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've already added that into #488, i'll remove it from this PR, don't know why it's showing up as a change

"weekStart": ""
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Solved?

"singleQuote": true,
"useTabs": false,
"tabWidth": 2
};
Copy link
Contributor

Choose a reason for hiding this comment

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

empty line

module.exports = {
// Prettier configuration provided by Grafana scaffolding
...require("./.config/.prettierrc.js")
};
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

Signed-off-by: Dhruv-J <[email protected]>
@@ -0,0 +1,10 @@
import { e2e } from '@grafana/e2e';

e2e.scenario({
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need this e2e test for Grafana?
cc @heanlan

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we run it with automation? e.g. will github action trigger it?

Copy link
Contributor Author

@Dhruv-J Dhruv-J Nov 27, 2023

Choose a reason for hiding this comment

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

I can remove this, I don't think it's testing anything important, nor is it run during yarn test. @yuntanghsu thoughts?

Copy link
Contributor

@heanlan heanlan left a comment

Choose a reason for hiding this comment

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

If we would like to deploy and test the dashboard by ourselves, how should we do it? Where can we get the sample http data? Could you give some instructions?

@@ -0,0 +1,114 @@
<!-- This README file is going to be the one displayed on the Grafana.com website for your plugin. Uncomment and replace the content here before publishing.

Remove any remaining comments before publishing as these may be displayed on Grafana.com -->
Copy link
Contributor

Choose a reason for hiding this comment

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

remove the first two lines of comment?

```sql
SELECT httpVals
FROM flows
WHERE l7ProtocolName!=''
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 we can remove WHERE l7ProtocolName!='' in this query example for better clarity to external users.

Use the grafana-cli tool to install chord-panel-plugin from the commandline:

```shell
grafana-cli --pluginUrl https://github.com/Dhruv-J/grafana-http-table-plugin/archive/refs/tags/v2.zip plugins install theia-grafana-dependency-plugin
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
grafana-cli --pluginUrl https://github.com/Dhruv-J/grafana-http-table-plugin/archive/refs/tags/v2.zip plugins install theia-grafana-dependency-plugin
grafana-cli --pluginUrl https://github.com/Dhruv-J/grafana-http-table-plugin/archive/refs/tags/v2.zip plugins install theia-grafana-http-table-plugin

Copy link
Contributor

Choose a reason for hiding this comment

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

this file can be removed as we are using antrea logo

Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't this file be moved to plugins/grafana-custom-plugins/grafana-http-table-plugin/ ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will do, I'll replace the README in plugins/grafana-custom-plugins/grafana-http-table-plugin/ with the one in /src

props.options = {};
let component = shallow(<TablePanel {...props} />);
React.useLayoutEffect = React.useEffect;
console.log('component text: '+component.render().text());
Copy link
Contributor

Choose a reason for hiding this comment

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

debug log?

let component = shallow(<TablePanel {...props} />);
React.useLayoutEffect = React.useEffect;
console.log('component text: '+component.render().text());
let renderedHtmlString = component.render().text();
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not familiar whether we can test it in another way, rather than converting to text. Maybe @yuntanghsu can give more constructive feedback.

But if we are just checking the text content, instead of using includes expression checking a series of substring ,can we just do expect(textContent).toEqual(expectedContent); to check the entire string?

Copy link
Contributor

Choose a reason for hiding this comment

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

image I think we should use `getAllByText` or `expect(getByText('10.10.1.4:42162')).toBeInTheDocument()` to check the data in the component. For example, in your test and the picture, we can see there are 3 transaction IDs for a certain combination of source and destination. We want to make sure your component can generate exactly 3 elements, which should be based on the number of HttpVals you have. And we also want to make sure the contents are correct in these 3 elements. I'll suggest you change the vals in each transaction ID and verify the context for all of them. Otherwise the result can be a false positive case as you only use "includes" to check the data.

I also found there are lots of warning when using component.render().text():

at div
        at /Users/hsuy/Desktop/theia/plugins/grafana-custom-plugins/grafana-http-table-plugin/node_modules/@emotion/react/dist/emotion-element-b63ca7c6.cjs.dev.js:43:23
        at TableContainer (/Users/hsuy/Desktop/theia/plugins/grafana-custom-plugins/grafana-http-table-plugin/node_modules/@mui/material/node/TableContainer/TableContainer.js:40:44)
        at MRT_TableContainer (/Users/hsuy/Desktop/theia/plugins/grafana-custom-plugins/grafana-http-table-plugin/node_modules/material-react-table/src/table/MRT_TableContainer.tsx:13:38)
        at div
        at /Users/hsuy/Desktop/theia/plugins/grafana-custom-plugins/grafana-http-table-plugin/node_modules/@emotion/react/dist/emotion-element-b63ca7c6.cjs.dev.js:43:23
        at Paper (/Users/hsuy/Desktop/theia/plugins/grafana-custom-plugins/grafana-http-table-plugin/node_modules/@mui/material/node/Paper/Paper.js:69:44)
        at MRT_TablePaper (/Users/hsuy/Desktop/theia/plugins/grafana-custom-plugins/grafana-http-table-plugin/node_modules/material-react-table/src/table/MRT_TablePaper.tsx:11:34)
        at useRef (/Users/hsuy/Desktop/theia/plugins/grafana-custom-plugins/grafana-http-table-plugin/node_modules/material-react-table/src/table/MRT_TableRoot.tsx:50:28)
        at MaterialReactTable (/Users/hsuy/Desktop/theia/plugins/grafana-custom-plugins/grafana-http-table-plugin/node_modules/material-react-table/src/MaterialReactTable.tsx:14:3)
        at ThemeProvider (/Users/hsuy/Desktop/theia/plugins/grafana-custom-plugins/grafana-http-table-plugin/node_modules/@mui/private-theming/node/ThemeProvider/ThemeProvider.js:39:5)
        at ThemeProvider (/Users/hsuy/Desktop/theia/plugins/grafana-custom-plugins/grafana-http-table-plugin/node_modules/@mui/system/ThemeProvider/ThemeProvider.js:50:5)
        at ThemeProvider (/Users/hsuy/Desktop/theia/plugins/grafana-custom-plugins/grafana-http-table-plugin/node_modules/@mui/material/node/styles/ThemeProvider.js:21:14)
        at div

      33 |     React.useLayoutEffect = React.useEffect;
      34 |     // console.log('component text: '+component.render().text());
    > 35 |     let renderedHtmlString = component.render().text();
         |                                        ^
      36 |     expect(renderedHtmlString.includes('10.10.1.4:42162')).toEqual(true);
      37 |     expect(renderedHtmlString.includes('93.184.216.34:80')).toEqual(true);
      38 |     expect(renderedHtmlString.includes('example.com')).toEqual(true);

      at printWarning (node_modules/react-dom/cjs/react-dom-server.node.development.js:82:30)
      at error (node_modules/react-dom/cjs/react-dom-server.node.development.js:58:5)
      at Object.useLayoutEffect (node_modules/react-dom/cjs/react-dom-server.node.development.js:1617:5)
      at useLayoutEffect (node_modules/react/cjs/react.development.js:1524:21)
      at useEventCallback (node_modules/@mui/utils/useEventCallback/useEventCallback.js:20:34)
      at useRippleHandler (node_modules/@mui/material/node/ButtonBase/ButtonBase.js:160:42)
      at Object.ButtonBase [as render] (node_modules/@mui/material/node/ButtonBase/ButtonBase.js:186:22)
      at ReactDOMServerRenderer.render (node_modules/react-dom/cjs/react-dom-server.node.development.js:3872:44)
      at ReactDOMServerRenderer.read (node_modules/react-dom/cjs/react-dom-server.node.development.js:3690:29)
      at Object.renderToStaticMarkup (node_modules/react-dom/cjs/react-dom-server.node.development.js:4314:27)
      at Object.renderToStaticMarkup [as render] (node_modules/enzyme-adapter-react-16/src/ReactSixteenAdapter.js:835:31)
      at ShallowWrapper.render (node_modules/enzyme/src/ShallowWrapper.js:1108:23)
      at ShallowWrapper.call [as single] (node_modules/enzyme/src/ShallowWrapper.js:1654:21)
      at ShallowWrapper.single [as html] (node_modules/enzyme/src/ShallowWrapper.js:1104:17)
      at ShallowWrapper.html [as render] (node_modules/enzyme/src/ShallowWrapper.js:1120:23)
      at Object.render (src/components/TablePanel.test.tsx:35:40)

  console.error
    Warning: useLayoutEffect does nothing on the server, because its effect cannot be encoded into the server renderer's output format. This will lead to a mismatch between the initial, non-hydrated UI and the intended UI. To avoid this, useLayoutEffect should only be used in components that render exclusively on the client. See https://reactjs.org/link/uselayouteffect-ssr for common fixes.
        at ButtonBase (/Users/hsuy/Desktop/theia/plugins/grafana-custom-plugins/grafana-http-table-plugin/node_modules/@mui/material/node/ButtonBase/ButtonBase.js:95:44)
        at /Users/hsuy/Desktop/theia/plugins/grafana-custom-plugins/grafana-http-table-plugin/node_modules/@emotion/react/dist/emotion-element-b63ca7c6.cjs.dev.js:43:23
        at TableSortLabel (/Users/hsuy/Desktop/theia/plugins/grafana-custom-plugins/grafana-http-table-plugin/node_modules/@mui/material/node/TableSortLabel/TableSortLabel.js:102:44)
        at span
        at /Users/hsuy/Desktop/theia/plugins/grafana-custom-plugins/grafana-http-table-plugin/node_modules/@emotion/react/dist/emotion-element-b63ca7c6.cjs.dev.js:43:23
        at Badge (/Users/hsuy/Desktop/theia/plugins/grafana-custom-plugins/grafana-http-table-plugin/node_modules/@mui/material/node/Badge/Badge.js:169:44)
        at Tooltip (/Users/hsuy/Desktop/theia/plugins/grafana-custom-plugins/grafana-http-table-plugin/node_modules/@mui/material/node/Tooltip/Tooltip.js:226:44)
        at MRT_TableHeadCellSortLabel (/Users/hsuy/Desktop/theia/plugins/grafana-custom-plugins/grafana-http-table-plugin/node_modules/material-react-table/src/head/MRT_TableHeadCellSortLabel.tsx:14:3)
        at div
        at /Users/hsuy/Desktop/theia/plugins/grafana-custom-plugins/grafana-http-table-plugin/node_modules/@emotion/react/dist/emotion-element-b63ca7c6.cjs.dev.js:43:23
        at Box (/Users/hsuy/Desktop/theia/plugins/grafana-custom-plugins/grafana-http-table-plugin/node_modules/@mui/system/createBox.js:31:41)
        at div
        at /Users/hsuy/Desktop/theia/plugins/grafana-custom-plugins/grafana-http-table-plugin/node_modules/@emotion/react/dist/emotion-element-b63ca7c6.cjs.dev.js:43:23
        at Box (/Users/hsuy/Desktop/theia/plugins/grafana-custom-plugins/grafana-http-table-plugin/node_modules/@mui/system/createBox.js:31:41)
        at th
        at /Users/hsuy/Desktop/theia/plugins/grafana-custom-plugins/grafana-http-table-plugin/node_modules/@emotion/react/dist/emotion-element-b63ca7c6.cjs.dev.js:43:23
        at TableCell (/Users/hsuy/Desktop/theia/plugins/grafana-custom-plugins/grafana-http-table-plugin/node_modules/@mui/material/node/TableCell/TableCell.js:108:44)
        at MRT_TableHeadCell (/Users/hsuy/Desktop/theia/plugins/grafana-custom-plugins/grafana-http-table-plugin/node_modules/material-react-table/src/head/MRT_TableHeadCell.tsx:20:37)
        at tr
        at /Users/hsuy/Desktop/theia/plugins/grafana-custom-plugins/grafana-http-table-plugin/node_modules/@emotion/react/dist/emotion-element-b63ca7c6.cjs.dev.js:43:23
        at TableRow (/Users/hsuy/Desktop/theia/plugins/grafana-custom-plugins/grafana-http-table-plugin/node_modules/@mui/material/node/TableRow/TableRow.js:70:44)
        at MRT_TableHeadRow (/Users/hsuy/Desktop/theia/plugins/grafana-custom-plugins/grafana-http-table-plugin/node_modules/material-react-table/src/head/MRT_TableHeadRow.tsx:20:3)
        at thead
        at /Users/hsuy/Desktop/theia/plugins/grafana-custom-plugins/grafana-http-table-plugin/node_modules/@emotion/react/dist/emotion-element-b63ca7c6.cjs.dev.js:43:23
        at TableHead (/Users/hsuy/Desktop/theia/plugins/grafana-custom-plugins/grafana-http-table-plugin/node_modules/@mui/material/node/TableHead/TableHead.js:44:44)
        at MRT_TableHead (/Users/hsuy/Desktop/theia/plugins/grafana-custom-plugins/grafana-http-table-plugin/node_modules/material-react-table/src/head/MRT_TableHead.tsx:14:3)
        at table
        at /Users/hsuy/Desktop/theia/plugins/grafana-custom-plugins/grafana-http-table-plugin/node_modules/@emotion/react/dist/emotion-element-b63ca7c6.cjs.dev.js:43:23
        at Table (/Users/hsuy/Desktop/theia/plugins/grafana-custom-plugins/grafana-http-table-plugin/node_modules/@mui/material/node/Table/Table.js:61:44)
        at MRT_Table (/Users/hsuy/Desktop/theia/plugins/grafana-custom-plugins/grafana-http-table-plugin/node_modules/material-react-table/src/table/MRT_Table.tsx:19:29)
        at div
        at /Users/hsuy/Desktop/theia/plugins/grafana-custom-plugins/grafana-http-table-plugin/node_modules/@emotion/react/dist/emotion-element-b63ca7c6.cjs.dev.js:43:23
        at TableContainer (/Users/hsuy/Desktop/theia/plugins/grafana-custom-plugins/grafana-http-table-plugin/node_modules/@mui/material/node/TableContainer/TableContainer.js:40:44)
        at MRT_TableContainer (/Users/hsuy/Desktop/theia/plugins/grafana-custom-plugins/grafana-http-table-plugin/node_modules/material-react-table/src/table/MRT_TableContainer.tsx:13:38)
        at div
        at /Users/hsuy/Desktop/theia/plugins/grafana-custom-plugins/grafana-http-table-plugin/node_modules/@emotion/react/dist/emotion-element-b63ca7c6.cjs.dev.js:43:23
        at Paper (/Users/hsuy/Desktop/theia/plugins/grafana-custom-plugins/grafana-http-table-plugin/node_modules/@mui/material/node/Paper/Paper.js:69:44)
        at MRT_TablePaper (/Users/hsuy/Desktop/theia/plugins/grafana-custom-plugins/grafana-http-table-plugin/node_modules/material-react-table/src/table/MRT_TablePaper.tsx:11:34)
        at useRef (/Users/hsuy/Desktop/theia/plugins/grafana-custom-plugins/grafana-http-table-plugin/node_modules/material-react-table/src/table/MRT_TableRoot.tsx:50:28)
        at MaterialReactTable (/Users/hsuy/Desktop/theia/plugins/grafana-custom-plugins/grafana-http-table-plugin/node_modules/material-react-table/src/MaterialReactTable.tsx:14:3)
        at ThemeProvider (/Users/hsuy/Desktop/theia/plugins/grafana-custom-plugins/grafana-http-table-plugin/node_modules/@mui/private-theming/node/ThemeProvider/ThemeProvider.js:39:5)
        at ThemeProvider (/Users/hsuy/Desktop/theia/plugins/grafana-custom-plugins/grafana-http-table-plugin/node_modules/@mui/system/ThemeProvider/ThemeProvider.js:50:5)
        at ThemeProvider (/Users/hsuy/Desktop/theia/plugins/grafana-custom-plugins/grafana-http-table-plugin/node_modules/@mui/material/node/styles/ThemeProvider.js:21:14)
        at div

@Dhruv-J Do you have any idea what happened?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, the material-ui library recommends running unit testing without the use of material-ui components in order to keep code immune to breaking due to changes within material-ui internal structure. So I can't directly check for including the table itself, so I check for the string being rendered within the html itself. @yuntanghsu I can attempt using those again, but I remember when I tried using similar solutions that false would be returned even though the text was supposedly being rendered. The warnings happen because the render() function is being called in a unit test, and so the result isn't actually visible anywhere. I looked into this issue specifically with material-ui and found that it is quite common, so people largely suppress the warning or haven't found a workaround. I'll try the clause that you mentioned and update the results within this thread.

@@ -0,0 +1,3 @@
{
"extends": "./.config/tsconfig.json"
}
Copy link
Contributor

Choose a reason for hiding this comment

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

missing empty line

"name": "Antrea io"
},
"logos": {
"small": "img/logo.svg",
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

not solved yet

@@ -0,0 +1,7 @@
type SeriesSize = 'sm' | 'md' | 'lg';
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these options being used anywhere? I see they are passed as parameter into TablePanel, but I don't see where users can configure them, and where do we explicitly handle their values in the source code? The name "SimpleOptions" also looks a bit too general for me to understand its usage.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

those are default options, I'll remove them

@Dhruv-J
Copy link
Contributor Author

Dhruv-J commented Dec 11, 2023

Instructions for those wanting to deploy the solution for themselves @heanlan:

  1. pull Antrea PR #5218
  2. pull Theia PR Adding new Clickhouse fields for NP visibility #417 and this PR
  3. execute the included script for build_antrea.sh.zip
  4. deploy flow-visibility.yml from the new theia PR
  5. apply the following: pods.yaml.zip
  6. annotate the pods with the following command: kubectl pod annotate <pod-name> -n <namespace> [visibility.antrea.io/enable-l7=both](http://visibility.antrea.io/enable-l7=both)
  7. kubectl exec into the applied admin pod and run the command curl example.com to get one row, or curl example.com example.com example.com to get multiple rows (it'll take about 2 minutes to populate clickhouse)
  8. open the application layer dashboard to view http values

Copy link
Contributor

@heanlan heanlan left a comment

Choose a reason for hiding this comment

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

LGTM overall

Same with #488 , let's hold this PR up and take another look until all the PRs it depends on are merged.


1. Install dependencies
- Clickhouse
Copy link
Contributor

Choose a reason for hiding this comment

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

ClickHouse

"name": "Antrea io"
},
"logos": {
"small": "img/logo.svg",
Copy link
Contributor

Choose a reason for hiding this comment

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

not solved yet

},
"logos": {
"small": "img/logo.svg",
"large": "img/logo.svg"
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

@@ -0,0 +1,2 @@
export interface SimpleOptions {
Copy link
Contributor

Choose a reason for hiding this comment

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

rename to TableOptions?

Copy link

This PR is stale because it has been open 90 days with no activity. Remove stale label or comment, or this will be closed in 90 days

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants