mirror of
https://github.com/kubeshark/kubeshark.git
synced 2026-06-09 09:46:54 +00:00
Compare commits
42 Commits
31.0-dev23
...
31.0-dev63
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d76f24edb8 | ||
|
|
32ba653d12 | ||
|
|
e03db7b09b | ||
|
|
de533730d3 | ||
|
|
d834fcc3cb | ||
|
|
1624b0d7b9 | ||
|
|
9715bb046b | ||
|
|
65e5ebe23c | ||
|
|
30986c3b22 | ||
|
|
1e167f2757 | ||
|
|
149e86d050 | ||
|
|
1213162b85 | ||
|
|
189c158150 | ||
|
|
c5006e5f57 | ||
|
|
d7fcf273c0 | ||
|
|
eca3267b47 | ||
|
|
a527fc6c51 | ||
|
|
e104128df8 | ||
|
|
5bb904d068 | ||
|
|
1a5378b64b | ||
|
|
7cfe506897 | ||
|
|
ab64046e8e | ||
|
|
62cbcf8857 | ||
|
|
8f3b0e8fee | ||
|
|
32d473ea26 | ||
|
|
97000293fd | ||
|
|
3ed9bc1e0d | ||
|
|
86e5dcea19 | ||
|
|
81fe4af30d | ||
|
|
df1fd2c3a7 | ||
|
|
f8496c0235 | ||
|
|
2de7107c0a | ||
|
|
22e3b3d8b2 | ||
|
|
45611c4c13 | ||
|
|
bb425fa6e2 | ||
|
|
4bc83ebcb5 | ||
|
|
bbb44dae79 | ||
|
|
72a1aba3e5 | ||
|
|
d8fb8ff710 | ||
|
|
f344bd2633 | ||
|
|
6575495fa5 | ||
|
|
cf5c03d45c |
2
.github/workflows/acceptance_tests.yml
vendored
2
.github/workflows/acceptance_tests.yml
vendored
@@ -43,7 +43,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
status: ${{ job.status }}
|
status: ${{ job.status }}
|
||||||
notification_title: 'Mizu {workflow} has {status_message}'
|
notification_title: 'Mizu {workflow} has {status_message}'
|
||||||
message_format: '{emoji} *{workflow}* {status_message} during <{run_url}|run>, after commit <{commit_url}|{commit_sha}> by ${{ github.event.head_commit.committer.name }} <${{ github.event.head_commit.committer.email }}> ```${{ github.event.head_commit.message }}```'
|
message_format: '{emoji} *{workflow}* {status_message} during <{run_url}|run>, after commit <{commit_url}|{commit_sha}> by ${{ github.event.head_commit.author.name }} <${{ github.event.head_commit.author.email }}> ```${{ github.event.head_commit.message }}```'
|
||||||
footer: 'Linked Repo <{repo_url}|{repo}>'
|
footer: 'Linked Repo <{repo_url}|{repo}>'
|
||||||
notify_when: 'failure'
|
notify_when: 'failure'
|
||||||
env:
|
env:
|
||||||
|
|||||||
38
.github/workflows/acceptance_tests_on_pr.yml
vendored
Normal file
38
.github/workflows/acceptance_tests_on_pr.yml
vendored
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
name: Acceptance tests on PR
|
||||||
|
|
||||||
|
on: push
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: acceptance-tests-on-pr-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
run-tests:
|
||||||
|
name: Run tests
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: ${{ contains(github.event.head_commit.message, '#run_acceptance_tests') }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Set up Go 1.17
|
||||||
|
uses: actions/setup-go@v2
|
||||||
|
with:
|
||||||
|
go-version: '^1.17'
|
||||||
|
|
||||||
|
- name: Check out code into the Go module directory
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Setup acceptance test
|
||||||
|
run: ./acceptanceTests/setup.sh
|
||||||
|
|
||||||
|
- name: Create k8s users and change context
|
||||||
|
env:
|
||||||
|
USERNAME_UNRESTRICTED: user-with-clusterwide-access
|
||||||
|
USERNAME_RESTRICTED: user-with-restricted-access
|
||||||
|
run: |
|
||||||
|
./acceptanceTests/create_user.sh "${USERNAME_UNRESTRICTED}"
|
||||||
|
./acceptanceTests/create_user.sh "${USERNAME_RESTRICTED}"
|
||||||
|
kubectl apply -f cli/cmd/permissionFiles/permissions-all-namespaces-tap.yaml
|
||||||
|
kubectl config use-context ${USERNAME_UNRESTRICTED}
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
run: make acceptance-test
|
||||||
5
.github/workflows/inactive-issues-close.yaml
vendored
5
.github/workflows/inactive-issues-close.yaml
vendored
@@ -13,10 +13,11 @@ jobs:
|
|||||||
- uses: actions/stale@v3
|
- uses: actions/stale@v3
|
||||||
with:
|
with:
|
||||||
days-before-issue-stale: 30
|
days-before-issue-stale: 30
|
||||||
days-before-issue-close: 14
|
days-before-issue-close: -1
|
||||||
|
exempt-issue-labels: "enhancement"
|
||||||
stale-issue-label: "stale"
|
stale-issue-label: "stale"
|
||||||
stale-issue-message: "This issue is stale because it has been open for 30 days with no activity."
|
stale-issue-message: "This issue is stale because it has been open for 30 days with no activity."
|
||||||
close-issue-message: "This issue was closed because it has been inactive for 14 days since being marked as stale."
|
close-issue-message: ""
|
||||||
days-before-pr-stale: -1
|
days-before-pr-stale: -1
|
||||||
days-before-pr-close: -1
|
days-before-pr-close: -1
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
3
.github/workflows/test.yml
vendored
3
.github/workflows/test.yml
vendored
@@ -56,7 +56,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Check extensions modified files
|
- name: Check extensions modified files
|
||||||
id: ext_modified_files
|
id: ext_modified_files
|
||||||
run: devops/check_modified_files.sh tap/extensions/
|
run: devops/check_modified_files.sh tap/extensions/ tap/api/
|
||||||
|
|
||||||
- name: Extensions Test
|
- name: Extensions Test
|
||||||
if: github.event_name == 'push' || steps.ext_modified_files.outputs.matched == 'true'
|
if: github.event_name == 'push' || steps.ext_modified_files.outputs.matched == 'true'
|
||||||
@@ -64,4 +64,3 @@ jobs:
|
|||||||
|
|
||||||
- name: Upload coverage to Codecov
|
- name: Upload coverage to Codecov
|
||||||
uses: codecov/codecov-action@v2
|
uses: codecov/codecov-action@v2
|
||||||
|
|
||||||
|
|||||||
@@ -87,8 +87,8 @@ RUN go build -ldflags="-extldflags=-static -s -w \
|
|||||||
-X 'github.com/up9inc/mizu/agent/pkg/version.Ver=${VER}'" -o mizuagent .
|
-X 'github.com/up9inc/mizu/agent/pkg/version.Ver=${VER}'" -o mizuagent .
|
||||||
|
|
||||||
# Download Basenine executable, verify the sha1sum
|
# Download Basenine executable, verify the sha1sum
|
||||||
ADD https://github.com/up9inc/basenine/releases/download/v0.6.6/basenine_linux_${GOARCH} ./basenine_linux_${GOARCH}
|
ADD https://github.com/up9inc/basenine/releases/download/v0.7.3/basenine_linux_${GOARCH} ./basenine_linux_${GOARCH}
|
||||||
ADD https://github.com/up9inc/basenine/releases/download/v0.6.6/basenine_linux_${GOARCH}.sha256 ./basenine_linux_${GOARCH}.sha256
|
ADD https://github.com/up9inc/basenine/releases/download/v0.7.3/basenine_linux_${GOARCH}.sha256 ./basenine_linux_${GOARCH}.sha256
|
||||||
|
|
||||||
RUN shasum -a 256 -c basenine_linux_"${GOARCH}".sha256 && \
|
RUN shasum -a 256 -c basenine_linux_"${GOARCH}".sha256 && \
|
||||||
chmod +x ./basenine_linux_"${GOARCH}" && \
|
chmod +x ./basenine_linux_"${GOARCH}" && \
|
||||||
|
|||||||
@@ -39,13 +39,13 @@ export function verifyMinimumEntries() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function leftTextCheck(entryNum, path, expectedText) {
|
export function leftTextCheck(entryId, path, expectedText) {
|
||||||
cy.get(`#list #entry-${entryNum} ${path}`).invoke('text').should('eq', expectedText);
|
cy.get(`#list #entry-${entryId} ${path}`).invoke('text').should('eq', expectedText);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function leftOnHoverCheck(entryNum, path, filterName) {
|
export function leftOnHoverCheck(entryId, path, filterName) {
|
||||||
cy.get(`#list #entry-${entryNum} ${path}`).trigger('mouseover');
|
cy.get(`#list #entry-${entryId} ${path}`).trigger('mouseover');
|
||||||
cy.get(`#list #entry-${entryNum} [data-cy='QueryableTooltip']`).invoke('text').should('match', new RegExp(filterName));
|
cy.get(`#list #entry-${entryId} [data-cy='QueryableTooltip']`).invoke('text').should('match', new RegExp(filterName));
|
||||||
}
|
}
|
||||||
|
|
||||||
export function rightTextCheck(path, expectedText) {
|
export function rightTextCheck(path, expectedText) {
|
||||||
@@ -89,13 +89,13 @@ export function checkFilterByMethod(funcDict) {
|
|||||||
cy.get('#entries-length').invoke('text').then(len => {
|
cy.get('#entries-length').invoke('text').then(len => {
|
||||||
resizeIfNeeded(len);
|
resizeIfNeeded(len);
|
||||||
listElmWithIdAttr.forEach(entry => {
|
listElmWithIdAttr.forEach(entry => {
|
||||||
if (entry?.id && entry.id.match(RegExp(/entry-(\d{2}|\d{1})$/gm))) {
|
if (entry?.id && entry.id.match(RegExp(/entry-(\d{24})$/gm))) {
|
||||||
const entryNum = getEntryNumById(entry.id);
|
const entryId = getEntryId(entry.id);
|
||||||
|
|
||||||
leftTextCheck(entryNum, methodDict.pathLeft, methodDict.expectedText);
|
leftTextCheck(entryId, methodDict.pathLeft, methodDict.expectedText);
|
||||||
leftTextCheck(entryNum, protocolDict.pathLeft, protocolDict.expectedTextLeft);
|
leftTextCheck(entryId, protocolDict.pathLeft, protocolDict.expectedTextLeft);
|
||||||
if (summaryDict)
|
if (summaryDict)
|
||||||
leftTextCheck(entryNum, summaryDict.pathLeft, summaryDict.expectedText);
|
leftTextCheck(entryId, summaryDict.pathLeft, summaryDict.expectedText);
|
||||||
|
|
||||||
if (!doneCheckOnFirst) {
|
if (!doneCheckOnFirst) {
|
||||||
deepCheck(funcDict, protocolDict, methodDict, entry);
|
deepCheck(funcDict, protocolDict, methodDict, entry);
|
||||||
@@ -111,6 +111,11 @@ export function checkFilterByMethod(funcDict) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getEntryId(id) {
|
||||||
|
// take the second part from the string (entry-<ID>)
|
||||||
|
return id.split('-')[1];
|
||||||
|
}
|
||||||
|
|
||||||
function resizeIfNeeded(entriesLen) {
|
function resizeIfNeeded(entriesLen) {
|
||||||
if (entriesLen > maxEntriesInDom){
|
if (entriesLen > maxEntriesInDom){
|
||||||
Cypress.config().viewportHeight === Cypress.env('normalMizuHeight') ?
|
Cypress.config().viewportHeight === Cypress.env('normalMizuHeight') ?
|
||||||
@@ -119,14 +124,14 @@ function resizeIfNeeded(entriesLen) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function deepCheck(generalDict, protocolDict, methodDict, entry) {
|
function deepCheck(generalDict, protocolDict, methodDict, entry) {
|
||||||
const entryNum = getEntryNumById(entry.id);
|
const entryId = getEntryId(entry.id);
|
||||||
const {summary, value} = generalDict;
|
const {summary, value} = generalDict;
|
||||||
const summaryDict = getSummaryDict(summary);
|
const summaryDict = getSummaryDict(summary);
|
||||||
|
|
||||||
leftOnHoverCheck(entryNum, methodDict.pathLeft, methodDict.expectedOnHover);
|
leftOnHoverCheck(entryId, methodDict.pathLeft, methodDict.expectedOnHover);
|
||||||
leftOnHoverCheck(entryNum, protocolDict.pathLeft, protocolDict.expectedOnHover);
|
leftOnHoverCheck(entryId, protocolDict.pathLeft, protocolDict.expectedOnHover);
|
||||||
if (summaryDict)
|
if (summaryDict)
|
||||||
leftOnHoverCheck(entryNum, summaryDict.pathLeft, summaryDict.expectedOnHover);
|
leftOnHoverCheck(entryId, summaryDict.pathLeft, summaryDict.expectedOnHover);
|
||||||
|
|
||||||
cy.get(`#${entry.id}`).click();
|
cy.get(`#${entry.id}`).click();
|
||||||
|
|
||||||
@@ -183,7 +188,3 @@ function getProtocolDict(protocol, protocolText) {
|
|||||||
expectedOnHover: protocol.toLowerCase()
|
expectedOnHover: protocol.toLowerCase()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function getEntryNumById (id) {
|
|
||||||
return parseInt(id.split('-')[1]);
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -15,15 +15,11 @@ function checkEntries() {
|
|||||||
checkThatAllEntriesShown();
|
checkThatAllEntriesShown();
|
||||||
resizeToHugeMizu();
|
resizeToHugeMizu();
|
||||||
|
|
||||||
cy.get('#total-entries').then(number => {
|
cy.get('#list [id^=entry]').each(entryElement => {
|
||||||
const numOfEntries = parseInt(number.text());
|
entryElement.click();
|
||||||
[...Array(numOfEntries).keys()].map(checkEntry);
|
cy.get('#tbody-Headers').should('be.visible');
|
||||||
|
isValueExistsInElement(false, 'Ignored-User-Agent', '#tbody-Headers');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkEntry(entryIndex) {
|
|
||||||
cy.get(`#entry-${entryIndex}`).click();
|
|
||||||
cy.get('#tbody-Headers').should('be.visible');
|
|
||||||
isValueExistsInElement(false, 'Ignored-User-Agent', '#tbody-Headers');
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import {findLineAndCheck, getExpectedDetailsDict} from "../testHelpers/StatusBarHelper";
|
import {findLineAndCheck, getExpectedDetailsDict} from "../testHelpers/StatusBarHelper";
|
||||||
import {
|
import {
|
||||||
|
getEntryId,
|
||||||
leftOnHoverCheck,
|
leftOnHoverCheck,
|
||||||
leftTextCheck,
|
leftTextCheck,
|
||||||
resizeToHugeMizu,
|
resizeToHugeMizu,
|
||||||
@@ -148,9 +149,6 @@ function checkFilterNoResults(filterName) {
|
|||||||
// the DOM should show 0 entries
|
// the DOM should show 0 entries
|
||||||
cy.get('#entries-length').should('have.text', '0');
|
cy.get('#entries-length').should('have.text', '0');
|
||||||
|
|
||||||
// going through every potential entry and verifies that it doesn't exist
|
|
||||||
[...Array(parseInt(totalEntries)).keys()].map(shouldNotExist);
|
|
||||||
|
|
||||||
cy.get('[title="Fetch old records"]').click();
|
cy.get('[title="Fetch old records"]').click();
|
||||||
cy.get('#noMoreDataTop', {timeout: refreshWaitTimeout}).should('be.visible');
|
cy.get('#noMoreDataTop', {timeout: refreshWaitTimeout}).should('be.visible');
|
||||||
cy.get('#entries-length').should('have.text', '0'); // after loading all entries there should still be 0 entries
|
cy.get('#entries-length').should('have.text', '0'); // after loading all entries there should still be 0 entries
|
||||||
@@ -162,10 +160,6 @@ function checkFilterNoResults(filterName) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function shouldNotExist(entryNum) {
|
|
||||||
cy.get(`entry-${entryNum}`).should('not.exist');
|
|
||||||
}
|
|
||||||
|
|
||||||
function checkIllegalFilter(illegalFilterName) {
|
function checkIllegalFilter(illegalFilterName) {
|
||||||
it(`should show red search bar with the input: ${illegalFilterName}`, function () {
|
it(`should show red search bar with the input: ${illegalFilterName}`, function () {
|
||||||
cy.reload();
|
cy.reload();
|
||||||
@@ -185,30 +179,44 @@ function checkIllegalFilter(illegalFilterName) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function checkFilter(filterDetails){
|
|
||||||
const {name, leftSidePath, rightSidePath, rightSideExpectedText, leftSideExpectedText, applyByEnter} = filterDetails;
|
function checkFilter(filterDetails) {
|
||||||
|
const {
|
||||||
|
name,
|
||||||
|
leftSidePath,
|
||||||
|
rightSidePath,
|
||||||
|
rightSideExpectedText,
|
||||||
|
leftSideExpectedText,
|
||||||
|
applyByEnter
|
||||||
|
} = filterDetails;
|
||||||
|
|
||||||
const entriesForDeeperCheck = 5;
|
const entriesForDeeperCheck = 5;
|
||||||
|
|
||||||
it(`checking the filter: ${name}`, function () {
|
it(`checking the filter: ${name}`, function () {
|
||||||
cy.get('#total-entries').should('not.have.text', '0').then(number => {
|
cy.get('#total-entries').should('not.have.text', '0').then(number => {
|
||||||
const totalEntries = number.text();
|
const totalEntries = number.text();
|
||||||
|
|
||||||
// checks the hover on the last entry (the only one in DOM at the beginning)
|
cy.get(`#list [id^=entry]`).last().then(elem => {
|
||||||
leftOnHoverCheck(totalEntries - 1, leftSidePath, name);
|
const element = elem[0];
|
||||||
|
const entryId = getEntryId(element.id);
|
||||||
|
// checks the hover on the last entry (the only one in DOM at the beginning)
|
||||||
|
leftOnHoverCheck(entryId, leftSidePath, name);
|
||||||
|
|
||||||
cy.get('.w-tc-editor-text').clear();
|
cy.get('.w-tc-editor-text').clear();
|
||||||
// applying the filter with alt+enter or with the button
|
// applying the filter with alt+enter or with the button
|
||||||
cy.get('.w-tc-editor-text').type(`${name}${applyByEnter ? '{alt+enter}' : ''}`);
|
cy.get('.w-tc-editor-text').type(`${name}${applyByEnter ? '{alt+enter}' : ''}`);
|
||||||
cy.get('.w-tc-editor').should('have.attr', 'style').and('include', Cypress.env('greenFilterColor'));
|
cy.get('.w-tc-editor').should('have.attr', 'style').and('include', Cypress.env('greenFilterColor'));
|
||||||
if (!applyByEnter)
|
if (!applyByEnter)
|
||||||
cy.get('[type="submit"]').click();
|
cy.get('[type="submit"]').click();
|
||||||
|
|
||||||
// only one entry in DOM after filtering, checking all checks on it
|
// only one entry in DOM after filtering, checking all checks on it
|
||||||
leftTextCheck(totalEntries - 1, leftSidePath, leftSideExpectedText);
|
leftTextCheck(entryId, leftSidePath, leftSideExpectedText);
|
||||||
leftOnHoverCheck(totalEntries - 1, leftSidePath, name);
|
leftOnHoverCheck(entryId, leftSidePath, name);
|
||||||
rightTextCheck(rightSidePath, rightSideExpectedText);
|
|
||||||
rightOnHoverCheck(rightSidePath, name);
|
rightTextCheck(rightSidePath, rightSideExpectedText);
|
||||||
checkRightSideResponseBody();
|
rightOnHoverCheck(rightSidePath, name);
|
||||||
|
checkRightSideResponseBody();
|
||||||
|
});
|
||||||
|
|
||||||
cy.get('[title="Fetch old records"]').click();
|
cy.get('[title="Fetch old records"]').click();
|
||||||
resizeToHugeMizu();
|
resizeToHugeMizu();
|
||||||
@@ -217,28 +225,33 @@ function checkFilter(filterDetails){
|
|||||||
cy.get('#entries-length', {timeout: refreshWaitTimeout}).should('have.text', totalEntries);
|
cy.get('#entries-length', {timeout: refreshWaitTimeout}).should('have.text', totalEntries);
|
||||||
|
|
||||||
// checking only 'leftTextCheck' on all entries because the rest of the checks require more time
|
// checking only 'leftTextCheck' on all entries because the rest of the checks require more time
|
||||||
[...Array(parseInt(totalEntries)).keys()].forEach(entryNum => {
|
cy.get(`#list [id^=entry]`).each(elem => {
|
||||||
leftTextCheck(entryNum, leftSidePath, leftSideExpectedText);
|
const element = elem[0];
|
||||||
|
let entryId = getEntryId(element.id);
|
||||||
|
leftTextCheck(entryId, leftSidePath, leftSideExpectedText);
|
||||||
});
|
});
|
||||||
|
|
||||||
// making the other 3 checks on the first X entries (longer time for each check)
|
// making the other 3 checks on the first X entries (longer time for each check)
|
||||||
deeperChcek(leftSidePath, rightSidePath, name, leftSideExpectedText, rightSideExpectedText, entriesForDeeperCheck);
|
deeperCheck(leftSidePath, rightSidePath, name, leftSideExpectedText, rightSideExpectedText, entriesForDeeperCheck);
|
||||||
|
|
||||||
// reloading then waiting for the entries number to load
|
// reloading then waiting for the entries number to load
|
||||||
resizeToNormalMizu();
|
resizeToNormalMizu();
|
||||||
cy.reload();
|
cy.reload();
|
||||||
cy.get('#total-entries', {timeout: refreshWaitTimeout}).should('have.text', totalEntries);
|
cy.get('#total-entries', {timeout: refreshWaitTimeout}).should('have.text', totalEntries);
|
||||||
});
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function deeperChcek(leftSidePath, rightSidePath, filterName, leftSideExpectedText, rightSideExpectedText, entriesNumToCheck) {
|
function deeperCheck(leftSidePath, rightSidePath, filterName, leftSideExpectedText, rightSideExpectedText, entriesNumToCheck) {
|
||||||
[...Array(entriesNumToCheck).keys()].forEach(entryNum => {
|
cy.get(`#list [id^=entry]`).each((element, index) => {
|
||||||
leftOnHoverCheck(entryNum, leftSidePath, filterName);
|
if (index < entriesNumToCheck) {
|
||||||
|
const entryId = getEntryId(element[0].id);
|
||||||
|
leftOnHoverCheck(entryId, leftSidePath, filterName);
|
||||||
|
|
||||||
cy.get(`#list #entry-${entryNum}`).click();
|
cy.get(`#list #entry-${entryId}`).click();
|
||||||
rightTextCheck(rightSidePath, rightSideExpectedText);
|
rightTextCheck(rightSidePath, rightSideExpectedText);
|
||||||
rightOnHoverCheck(rightSidePath, filterName);
|
rightOnHoverCheck(rightSidePath, filterName);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,12 +15,13 @@ require (
|
|||||||
github.com/go-playground/validator/v10 v10.10.0
|
github.com/go-playground/validator/v10 v10.10.0
|
||||||
github.com/google/uuid v1.3.0
|
github.com/google/uuid v1.3.0
|
||||||
github.com/gorilla/websocket v1.4.2
|
github.com/gorilla/websocket v1.4.2
|
||||||
|
github.com/jinzhu/copier v0.3.5
|
||||||
github.com/nav-inc/datetime v0.1.3
|
github.com/nav-inc/datetime v0.1.3
|
||||||
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7
|
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7
|
||||||
github.com/orcaman/concurrent-map v1.0.0
|
github.com/orcaman/concurrent-map v1.0.0
|
||||||
github.com/patrickmn/go-cache v2.1.0+incompatible
|
github.com/patrickmn/go-cache v2.1.0+incompatible
|
||||||
github.com/stretchr/testify v1.7.0
|
github.com/stretchr/testify v1.7.0
|
||||||
github.com/up9inc/basenine/client/go v0.0.0-20220326121918-785f3061c8ce
|
github.com/up9inc/basenine/client/go v0.0.0-20220419100955-e2ca51087607
|
||||||
github.com/up9inc/mizu/shared v0.0.0
|
github.com/up9inc/mizu/shared v0.0.0
|
||||||
github.com/up9inc/mizu/tap v0.0.0
|
github.com/up9inc/mizu/tap v0.0.0
|
||||||
github.com/up9inc/mizu/tap/api v0.0.0
|
github.com/up9inc/mizu/tap/api v0.0.0
|
||||||
@@ -48,7 +49,6 @@ require (
|
|||||||
github.com/PuerkitoBio/purell v1.1.1 // indirect
|
github.com/PuerkitoBio/purell v1.1.1 // indirect
|
||||||
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
|
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
|
||||||
github.com/beevik/etree v1.1.0 // indirect
|
github.com/beevik/etree v1.1.0 // indirect
|
||||||
github.com/bradleyfalzon/tlsx v0.0.0-20170624122154-28fd0e59bac4 // indirect
|
|
||||||
github.com/chai2010/gettext-go v0.0.0-20160711120539-c6fed771bfd5 // indirect
|
github.com/chai2010/gettext-go v0.0.0-20160711120539-c6fed771bfd5 // indirect
|
||||||
github.com/chanced/dynamic v0.0.0-20211210164248-f8fadb1d735b // indirect
|
github.com/chanced/dynamic v0.0.0-20211210164248-f8fadb1d735b // indirect
|
||||||
github.com/cilium/ebpf v0.8.0 // indirect
|
github.com/cilium/ebpf v0.8.0 // indirect
|
||||||
|
|||||||
@@ -108,8 +108,6 @@ github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6r
|
|||||||
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
|
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
|
||||||
github.com/bketelsen/crypt v0.0.4/go.mod h1:aI6NrJ0pMGgvZKL1iVgXLnfIFJtfV+bKCoqOes/6LfM=
|
github.com/bketelsen/crypt v0.0.4/go.mod h1:aI6NrJ0pMGgvZKL1iVgXLnfIFJtfV+bKCoqOes/6LfM=
|
||||||
github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk=
|
github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk=
|
||||||
github.com/bradleyfalzon/tlsx v0.0.0-20170624122154-28fd0e59bac4 h1:NJOOlc6ZJjix0A1rAU+nxruZtR8KboG1848yqpIUo4M=
|
|
||||||
github.com/bradleyfalzon/tlsx v0.0.0-20170624122154-28fd0e59bac4/go.mod h1:DQPxZS994Ld1Y8uwnJT+dRL04XPD0cElP/pHH/zEBHM=
|
|
||||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||||
github.com/census-instrumentation/opencensus-proto v0.3.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
github.com/census-instrumentation/opencensus-proto v0.3.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||||
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
|
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
|
||||||
@@ -428,6 +426,8 @@ github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH
|
|||||||
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
|
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
|
||||||
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
|
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
|
||||||
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
|
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
|
||||||
|
github.com/jinzhu/copier v0.3.5 h1:GlvfUwHk62RokgqVNvYsku0TATCF7bAHVwEXoBh3iJg=
|
||||||
|
github.com/jinzhu/copier v0.3.5/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg=
|
||||||
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
|
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
|
||||||
github.com/jonboulle/clockwork v0.2.2/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8=
|
github.com/jonboulle/clockwork v0.2.2/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8=
|
||||||
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
|
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
|
||||||
@@ -681,8 +681,8 @@ github.com/ugorji/go v1.2.6/go.mod h1:anCg0y61KIhDlPZmnH+so+RQbysYVyDko0IMgJv0Nn
|
|||||||
github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
|
github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
|
||||||
github.com/ugorji/go/codec v1.2.6 h1:7kbGefxLoDBuYXOms4yD7223OpNMMPNPZxXk5TvFcyQ=
|
github.com/ugorji/go/codec v1.2.6 h1:7kbGefxLoDBuYXOms4yD7223OpNMMPNPZxXk5TvFcyQ=
|
||||||
github.com/ugorji/go/codec v1.2.6/go.mod h1:V6TCNZ4PHqoHGFZuSG1W8nrCzzdgA2DozYxWFFpvxTw=
|
github.com/ugorji/go/codec v1.2.6/go.mod h1:V6TCNZ4PHqoHGFZuSG1W8nrCzzdgA2DozYxWFFpvxTw=
|
||||||
github.com/up9inc/basenine/client/go v0.0.0-20220326121918-785f3061c8ce h1:vMTCpKItc9OyTLJXocNaq2NcBU5EnurJgTVOYb8W8dw=
|
github.com/up9inc/basenine/client/go v0.0.0-20220419100955-e2ca51087607 h1:UqxUSkOYOmsLZWQtMSk02ttnhdRwBRLOLt2aDiS9tEk=
|
||||||
github.com/up9inc/basenine/client/go v0.0.0-20220326121918-785f3061c8ce/go.mod h1:SvJGPoa/6erhUQV7kvHBwM/0x5LyO6XaG2lUaCaKiUI=
|
github.com/up9inc/basenine/client/go v0.0.0-20220419100955-e2ca51087607/go.mod h1:SvJGPoa/6erhUQV7kvHBwM/0x5LyO6XaG2lUaCaKiUI=
|
||||||
github.com/vishvananda/netns v0.0.0-20211101163701-50045581ed74 h1:gga7acRE695APm9hlsSMoOoE65U4/TcqNj90mc69Rlg=
|
github.com/vishvananda/netns v0.0.0-20211101163701-50045581ed74 h1:gga7acRE695APm9hlsSMoOoE65U4/TcqNj90mc69Rlg=
|
||||||
github.com/vishvananda/netns v0.0.0-20211101163701-50045581ed74/go.mod h1:DD4vA1DwXk04H54A1oHXtwZmA0grkVMdPxx/VGLCah0=
|
github.com/vishvananda/netns v0.0.0-20211101163701-50045581ed74/go.mod h1:DD4vA1DwXk04H54A1oHXtwZmA0grkVMdPxx/VGLCah0=
|
||||||
github.com/wI2L/jsondiff v0.1.1 h1:r2TkoEet7E4JMO5+s1RCY2R0LrNPNHY6hbDeow2hRHw=
|
github.com/wI2L/jsondiff v0.1.1 h1:r2TkoEet7E4JMO5+s1RCY2R0LrNPNHY6hbDeow2hRHw=
|
||||||
|
|||||||
@@ -199,7 +199,7 @@ func runInHarReaderMode() {
|
|||||||
func enableExpFeatureIfNeeded() {
|
func enableExpFeatureIfNeeded() {
|
||||||
if config.Config.OAS {
|
if config.Config.OAS {
|
||||||
oasGenerator := dependency.GetInstance(dependency.OasGeneratorDependency).(oas.OasGenerator)
|
oasGenerator := dependency.GetInstance(dependency.OasGeneratorDependency).(oas.OasGenerator)
|
||||||
oasGenerator.Start()
|
oasGenerator.Start(nil)
|
||||||
}
|
}
|
||||||
if config.Config.ServiceMap {
|
if config.Config.ServiceMap {
|
||||||
serviceMapGenerator := dependency.GetInstance(dependency.ServiceMapGeneratorDependency).(servicemap.ServiceMap)
|
serviceMapGenerator := dependency.GetInstance(dependency.ServiceMapGeneratorDependency).(servicemap.ServiceMap)
|
||||||
@@ -320,6 +320,7 @@ func dialSocketWithRetry(socketAddress string, retryAmount int, retryDelay time.
|
|||||||
for i := 1; i < retryAmount; i++ {
|
for i := 1; i < retryAmount; i++ {
|
||||||
socketConnection, _, err := dialer.Dial(socketAddress, nil)
|
socketConnection, _, err := dialer.Dial(socketAddress, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
lastErr = err
|
||||||
if i < retryAmount {
|
if i < retryAmount {
|
||||||
logger.Log.Infof("socket connection to %s failed: %v, retrying %d out of %d in %d seconds...", socketAddress, err, i, retryAmount, retryDelay/time.Second)
|
logger.Log.Infof("socket connection to %s failed: %v, retrying %d out of %d in %d seconds...", socketAddress, err, i, retryAmount, retryDelay/time.Second)
|
||||||
time.Sleep(retryDelay)
|
time.Sleep(retryDelay)
|
||||||
@@ -371,7 +372,7 @@ func handleIncomingMessageAsTapper(socketConnection *websocket.Conn) {
|
|||||||
|
|
||||||
func initializeDependencies() {
|
func initializeDependencies() {
|
||||||
dependency.RegisterGenerator(dependency.ServiceMapGeneratorDependency, func() interface{} { return servicemap.GetDefaultServiceMapInstance() })
|
dependency.RegisterGenerator(dependency.ServiceMapGeneratorDependency, func() interface{} { return servicemap.GetDefaultServiceMapInstance() })
|
||||||
dependency.RegisterGenerator(dependency.OasGeneratorDependency, func() interface{} { return oas.GetDefaultOasGeneratorInstance(nil) })
|
dependency.RegisterGenerator(dependency.OasGeneratorDependency, func() interface{} { return oas.GetDefaultOasGeneratorInstance() })
|
||||||
dependency.RegisterGenerator(dependency.EntriesProvider, func() interface{} { return &entries.BasenineEntriesProvider{} })
|
dependency.RegisterGenerator(dependency.EntriesProvider, func() interface{} { return &entries.BasenineEntriesProvider{} })
|
||||||
dependency.RegisterGenerator(dependency.EntriesSocketStreamer, func() interface{} { return &api.BasenineEntryStreamer{} })
|
dependency.RegisterGenerator(dependency.EntriesSocketStreamer, func() interface{} { return &api.BasenineEntryStreamer{} })
|
||||||
dependency.RegisterGenerator(dependency.EntryStreamerSocketConnector, func() interface{} { return &api.DefaultEntryStreamerSocketConnector{} })
|
dependency.RegisterGenerator(dependency.EntryStreamerSocketConnector, func() interface{} { return &api.DefaultEntryStreamerSocketConnector{} })
|
||||||
|
|||||||
@@ -5,13 +5,14 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/up9inc/mizu/agent/pkg/models"
|
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/up9inc/mizu/agent/pkg/models"
|
||||||
|
|
||||||
"github.com/up9inc/mizu/agent/pkg/dependency"
|
"github.com/up9inc/mizu/agent/pkg/dependency"
|
||||||
"github.com/up9inc/mizu/agent/pkg/elastic"
|
"github.com/up9inc/mizu/agent/pkg/elastic"
|
||||||
"github.com/up9inc/mizu/agent/pkg/har"
|
"github.com/up9inc/mizu/agent/pkg/har"
|
||||||
@@ -102,11 +103,19 @@ func startReadingChannel(outputItems <-chan *tapApi.OutputChannelItem, extension
|
|||||||
panic("Channel of captured messages is nil")
|
panic("Channel of captured messages is nil")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BasenineReconnect:
|
||||||
connection, err := basenine.NewConnection(shared.BasenineHost, shared.BaseninePort)
|
connection, err := basenine.NewConnection(shared.BasenineHost, shared.BaseninePort)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
logger.Log.Errorf("Can't establish a new connection to Basenine server: %v", err)
|
||||||
|
time.Sleep(shared.BasenineReconnectInterval * time.Second)
|
||||||
|
goto BasenineReconnect
|
||||||
|
}
|
||||||
|
if err = connection.InsertMode(); err != nil {
|
||||||
|
logger.Log.Errorf("Insert mode call failed: %v", err)
|
||||||
|
connection.Close()
|
||||||
|
time.Sleep(shared.BasenineReconnectInterval * time.Second)
|
||||||
|
goto BasenineReconnect
|
||||||
}
|
}
|
||||||
connection.InsertMode()
|
|
||||||
|
|
||||||
disableOASValidation := false
|
disableOASValidation := false
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
@@ -119,19 +128,24 @@ func startReadingChannel(outputItems <-chan *tapApi.OutputChannelItem, extension
|
|||||||
for item := range outputItems {
|
for item := range outputItems {
|
||||||
extension := extensionsMap[item.Protocol.Name]
|
extension := extensionsMap[item.Protocol.Name]
|
||||||
resolvedSource, resolvedDestionation, namespace := resolveIP(item.ConnectionInfo)
|
resolvedSource, resolvedDestionation, namespace := resolveIP(item.ConnectionInfo)
|
||||||
|
|
||||||
|
if namespace == "" && item.Namespace != tapApi.UNKNOWN_NAMESPACE {
|
||||||
|
namespace = item.Namespace
|
||||||
|
}
|
||||||
|
|
||||||
mizuEntry := extension.Dissector.Analyze(item, resolvedSource, resolvedDestionation, namespace)
|
mizuEntry := extension.Dissector.Analyze(item, resolvedSource, resolvedDestionation, namespace)
|
||||||
if extension.Protocol.Name == "http" {
|
if extension.Protocol.Name == "http" {
|
||||||
if !disableOASValidation {
|
if !disableOASValidation {
|
||||||
var httpPair tapApi.HTTPRequestResponsePair
|
var httpPair tapApi.HTTPRequestResponsePair
|
||||||
if err := json.Unmarshal([]byte(mizuEntry.HTTPPair), &httpPair); err != nil {
|
if err := json.Unmarshal([]byte(mizuEntry.HTTPPair), &httpPair); err != nil {
|
||||||
logger.Log.Error(err)
|
logger.Log.Error(err)
|
||||||
|
} else {
|
||||||
|
contract := handleOAS(ctx, doc, router, httpPair.Request.Payload.RawRequest, httpPair.Response.Payload.RawResponse, contractContent)
|
||||||
|
mizuEntry.ContractStatus = contract.Status
|
||||||
|
mizuEntry.ContractRequestReason = contract.RequestReason
|
||||||
|
mizuEntry.ContractResponseReason = contract.ResponseReason
|
||||||
|
mizuEntry.ContractContent = contract.Content
|
||||||
}
|
}
|
||||||
|
|
||||||
contract := handleOAS(ctx, doc, router, httpPair.Request.Payload.RawRequest, httpPair.Response.Payload.RawResponse, contractContent)
|
|
||||||
mizuEntry.ContractStatus = contract.Status
|
|
||||||
mizuEntry.ContractRequestReason = contract.RequestReason
|
|
||||||
mizuEntry.ContractResponseReason = contract.ResponseReason
|
|
||||||
mizuEntry.ContractContent = contract.Content
|
|
||||||
}
|
}
|
||||||
|
|
||||||
harEntry, err := har.NewEntry(mizuEntry.Request, mizuEntry.Response, mizuEntry.StartTime, mizuEntry.ElapsedTime)
|
harEntry, err := har.NewEntry(mizuEntry.Request, mizuEntry.Response, mizuEntry.StartTime, mizuEntry.ElapsedTime)
|
||||||
@@ -143,12 +157,18 @@ func startReadingChannel(outputItems <-chan *tapApi.OutputChannelItem, extension
|
|||||||
|
|
||||||
data, err := json.Marshal(mizuEntry)
|
data, err := json.Marshal(mizuEntry)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
logger.Log.Errorf("Error while marshaling entry: %v", err)
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
providers.EntryAdded(len(data))
|
providers.EntryAdded(len(data))
|
||||||
|
|
||||||
connection.SendText(string(data))
|
if err = connection.SendText(string(data)); err != nil {
|
||||||
|
logger.Log.Errorf("An error occured while inserting a new record to database: %v", err)
|
||||||
|
connection.Close()
|
||||||
|
time.Sleep(shared.BasenineReconnectInterval * time.Second)
|
||||||
|
goto BasenineReconnect
|
||||||
|
}
|
||||||
|
|
||||||
serviceMapGenerator := dependency.GetInstance(dependency.ServiceMapGeneratorDependency).(servicemap.ServiceMapSink)
|
serviceMapGenerator := dependency.GetInstance(dependency.ServiceMapGeneratorDependency).(servicemap.ServiceMapSink)
|
||||||
serviceMapGenerator.NewTCPEntry(mizuEntry.Source, mizuEntry.Destination, &item.Protocol)
|
serviceMapGenerator.NewTCPEntry(mizuEntry.Source, mizuEntry.Destination, &item.Protocol)
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ func (e *BasenineEntryStreamer) Get(ctx context.Context, socketId int, params *W
|
|||||||
|
|
||||||
connection, err := basenine.NewConnection(shared.BasenineHost, shared.BaseninePort)
|
connection, err := basenine.NewConnection(shared.BasenineHost, shared.BaseninePort)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Log.Errorf("failed to establish a connection to Basenine: %v", err)
|
logger.Log.Errorf("Failed to establish a connection to Basenine: %v", err)
|
||||||
entryStreamerSocketConnector.CleanupSocket(socketId)
|
entryStreamerSocketConnector.CleanupSocket(socketId)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -49,7 +49,7 @@ func (e *BasenineEntryStreamer) Get(ctx context.Context, socketId int, params *W
|
|||||||
var entry *tapApi.Entry
|
var entry *tapApi.Entry
|
||||||
err = json.Unmarshal(bytes, &entry)
|
err = json.Unmarshal(bytes, &entry)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Log.Debugf("error unmarshalling entry: %v", err.Error())
|
logger.Log.Debugf("Error unmarshalling entry: %v", err.Error())
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,7 +79,11 @@ func (e *BasenineEntryStreamer) Get(ctx context.Context, socketId int, params *W
|
|||||||
go handleDataChannel(connection, data)
|
go handleDataChannel(connection, data)
|
||||||
go handleMetaChannel(connection, meta)
|
go handleMetaChannel(connection, meta)
|
||||||
|
|
||||||
connection.Query(query, data, meta)
|
if err = connection.Query(query, data, meta); err != nil {
|
||||||
|
logger.Log.Errorf("Query mode call failed: %v", err)
|
||||||
|
entryStreamerSocketConnector.CleanupSocket(socketId)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
<-ctx.Done()
|
<-ctx.Done()
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ func ConfigureBasenineServer(host string, port string, dbSize int64, logLevel lo
|
|||||||
wait.WithProto("tcp"),
|
wait.WithProto("tcp"),
|
||||||
wait.WithWait(200*time.Millisecond),
|
wait.WithWait(200*time.Millisecond),
|
||||||
wait.WithBreak(50*time.Millisecond),
|
wait.WithBreak(50*time.Millisecond),
|
||||||
wait.WithDeadline(5*time.Second),
|
wait.WithDeadline(20*time.Second),
|
||||||
wait.WithDebug(logLevel == logging.DEBUG),
|
wait.WithDebug(logLevel == logging.DEBUG),
|
||||||
).Do([]string{fmt.Sprintf("%s:%s", host, port)}) {
|
).Do([]string{fmt.Sprintf("%s:%s", host, port)}) {
|
||||||
logger.Log.Panicf("Basenine is not available!")
|
logger.Log.Panicf("Basenine is not available!")
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package controllers
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"github.com/up9inc/mizu/agent/pkg/dependency"
|
"github.com/up9inc/mizu/agent/pkg/dependency"
|
||||||
"github.com/up9inc/mizu/agent/pkg/entries"
|
"github.com/up9inc/mizu/agent/pkg/entries"
|
||||||
@@ -69,7 +68,7 @@ func GetEntry(c *gin.Context) {
|
|||||||
c.JSON(http.StatusBadRequest, validationError)
|
c.JSON(http.StatusBadRequest, validationError)
|
||||||
}
|
}
|
||||||
|
|
||||||
id, _ := strconv.Atoi(c.Param("id"))
|
id := c.Param("id")
|
||||||
|
|
||||||
entriesProvider := dependency.GetInstance(dependency.EntriesProvider).(entries.EntriesProvider)
|
entriesProvider := dependency.GetInstance(dependency.EntriesProvider).(entries.EntriesProvider)
|
||||||
entry, err := entriesProvider.GetEntry(singleEntryRequest, id)
|
entry, err := entriesProvider.GetEntry(singleEntryRequest, id)
|
||||||
|
|||||||
@@ -58,12 +58,12 @@ func getRecorderAndContext() (*httptest.ResponseRecorder, *gin.Context) {
|
|||||||
receiveBuffer: bytes.NewBufferString("\n"),
|
receiveBuffer: bytes.NewBufferString("\n"),
|
||||||
}
|
}
|
||||||
dependency.RegisterGenerator(dependency.OasGeneratorDependency, func() interface{} {
|
dependency.RegisterGenerator(dependency.OasGeneratorDependency, func() interface{} {
|
||||||
return oas.GetDefaultOasGeneratorInstance(dummyConn)
|
return oas.GetDefaultOasGeneratorInstance()
|
||||||
})
|
})
|
||||||
|
|
||||||
recorder := httptest.NewRecorder()
|
recorder := httptest.NewRecorder()
|
||||||
c, _ := gin.CreateTestContext(recorder)
|
c, _ := gin.CreateTestContext(recorder)
|
||||||
oas.GetDefaultOasGeneratorInstance(dummyConn).Start()
|
oas.GetDefaultOasGeneratorInstance().Start(dummyConn)
|
||||||
oas.GetDefaultOasGeneratorInstance(dummyConn).GetServiceSpecs().Store("some", oas.NewGen("some"))
|
oas.GetDefaultOasGeneratorInstance().GetServiceSpecs().Store("some", oas.NewGen("some"))
|
||||||
return recorder, c
|
return recorder, c
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package controllers
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
core "k8s.io/api/core/v1"
|
core "k8s.io/api/core/v1"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
@@ -93,10 +94,6 @@ func GetGeneralStats(c *gin.Context) {
|
|||||||
c.JSON(http.StatusOK, providers.GetGeneralStats())
|
c.JSON(http.StatusOK, providers.GetGeneralStats())
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetRecentTLSLinks(c *gin.Context) {
|
|
||||||
c.JSON(http.StatusOK, providers.GetAllRecentTLSAddresses())
|
|
||||||
}
|
|
||||||
|
|
||||||
func GetCurrentResolvingInformation(c *gin.Context) {
|
func GetCurrentResolvingInformation(c *gin.Context) {
|
||||||
c.JSON(http.StatusOK, holder.GetResolver().GetMap())
|
c.JSON(http.StatusOK, holder.GetResolver().GetMap())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package entries
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
basenine "github.com/up9inc/basenine/client/go"
|
basenine "github.com/up9inc/basenine/client/go"
|
||||||
@@ -15,7 +16,7 @@ import (
|
|||||||
|
|
||||||
type EntriesProvider interface {
|
type EntriesProvider interface {
|
||||||
GetEntries(entriesRequest *models.EntriesRequest) ([]*tapApi.EntryWrapper, *basenine.Metadata, error)
|
GetEntries(entriesRequest *models.EntriesRequest) ([]*tapApi.EntryWrapper, *basenine.Metadata, error)
|
||||||
GetEntry(singleEntryRequest *models.SingleEntryRequest, entryId int) (*tapApi.EntryWrapper, error)
|
GetEntry(singleEntryRequest *models.SingleEntryRequest, entryId string) (*tapApi.EntryWrapper, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type BasenineEntriesProvider struct{}
|
type BasenineEntriesProvider struct{}
|
||||||
@@ -56,7 +57,7 @@ func (e *BasenineEntriesProvider) GetEntries(entriesRequest *models.EntriesReque
|
|||||||
return dataSlice, metadata, nil
|
return dataSlice, metadata, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *BasenineEntriesProvider) GetEntry(singleEntryRequest *models.SingleEntryRequest, entryId int) (*tapApi.EntryWrapper, error) {
|
func (e *BasenineEntriesProvider) GetEntry(singleEntryRequest *models.SingleEntryRequest, entryId string) (*tapApi.EntryWrapper, error) {
|
||||||
var entry *tapApi.Entry
|
var entry *tapApi.Entry
|
||||||
bytes, err := basenine.Single(shared.BasenineHost, shared.BaseninePort, entryId, singleEntryRequest.Query)
|
bytes, err := basenine.Single(shared.BasenineHost, shared.BaseninePort, entryId, singleEntryRequest.Query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -64,7 +65,7 @@ func (e *BasenineEntriesProvider) GetEntry(singleEntryRequest *models.SingleEntr
|
|||||||
}
|
}
|
||||||
err = json.Unmarshal(bytes, &entry)
|
err = json.Unmarshal(bytes, &entry)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, errors.New(string(bytes))
|
||||||
}
|
}
|
||||||
|
|
||||||
extension := app.ExtensionsMap[entry.Protocol.Name]
|
extension := app.ExtensionsMap[entry.Protocol.Name]
|
||||||
|
|||||||
@@ -9,11 +9,10 @@ import (
|
|||||||
|
|
||||||
basenine "github.com/up9inc/basenine/client/go"
|
basenine "github.com/up9inc/basenine/client/go"
|
||||||
"github.com/up9inc/mizu/shared"
|
"github.com/up9inc/mizu/shared"
|
||||||
"github.com/up9inc/mizu/tap"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type EntriesRequest struct {
|
type EntriesRequest struct {
|
||||||
LeftOff int `form:"leftOff" validate:"required,min=-1"`
|
LeftOff string `form:"leftOff" validate:"required"`
|
||||||
Direction int `form:"direction" validate:"required,oneof='1' '-1'"`
|
Direction int `form:"direction" validate:"required,oneof='1' '-1'"`
|
||||||
Query string `form:"query"`
|
Query string `form:"query"`
|
||||||
Limit int `form:"limit" validate:"required,min=1"`
|
Limit int `form:"limit" validate:"required,min=1"`
|
||||||
@@ -44,11 +43,6 @@ type WebSocketTappedEntryMessage struct {
|
|||||||
Data *tapApi.OutputChannelItem
|
Data *tapApi.OutputChannelItem
|
||||||
}
|
}
|
||||||
|
|
||||||
type WebsocketOutboundLinkMessage struct {
|
|
||||||
*shared.WebSocketMessageMetadata
|
|
||||||
Data *tap.OutboundLink
|
|
||||||
}
|
|
||||||
|
|
||||||
type AuthStatus struct {
|
type AuthStatus struct {
|
||||||
Email string `json:"email"`
|
Email string `json:"email"`
|
||||||
Model string `json:"model"`
|
Model string `json:"model"`
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import (
|
|||||||
"bufio"
|
"bufio"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/url"
|
"net/url"
|
||||||
@@ -124,13 +125,13 @@ func feedFromHAR(file string, isSync bool, gen *defaultOasGenerator) (uint, erro
|
|||||||
cnt := uint(0)
|
cnt := uint(0)
|
||||||
for _, entry := range harDoc.Log.Entries {
|
for _, entry := range harDoc.Log.Entries {
|
||||||
cnt += 1
|
cnt += 1
|
||||||
feedEntry(&entry, "", file, gen, cnt)
|
feedEntry(&entry, "", file, gen, fmt.Sprintf("%024d", cnt))
|
||||||
}
|
}
|
||||||
|
|
||||||
return cnt, nil
|
return cnt, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func feedEntry(entry *har.Entry, source string, file string, gen *defaultOasGenerator, cnt uint) {
|
func feedEntry(entry *har.Entry, source string, file string, gen *defaultOasGenerator, cnt string) {
|
||||||
entry.Comment = file
|
entry.Comment = file
|
||||||
if entry.Response.Status == 302 {
|
if entry.Response.Status == 302 {
|
||||||
logger.Log.Debugf("Dropped traffic entry due to permanent redirect status: %s", entry.StartedDateTime)
|
logger.Log.Debugf("Dropped traffic entry due to permanent redirect status: %s", entry.StartedDateTime)
|
||||||
@@ -192,7 +193,7 @@ func feedFromLDJSON(file string, isSync bool, gen *defaultOasGenerator) (uint, e
|
|||||||
logger.Log.Warningf("Failed decoding entry: %s", line)
|
logger.Log.Warningf("Failed decoding entry: %s", line)
|
||||||
} else {
|
} else {
|
||||||
cnt += 1
|
cnt += 1
|
||||||
feedEntry(&entry, source, file, gen, cnt)
|
feedEntry(&entry, source, file, gen, fmt.Sprintf("%024d", cnt))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
96
agent/pkg/oas/oas-samples/carts.json
Normal file
96
agent/pkg/oas/oas-samples/carts.json
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
{
|
||||||
|
"openapi": "3.1.0",
|
||||||
|
"info": {
|
||||||
|
"title": "http://carts",
|
||||||
|
"description": "Mizu observed 3 entries (0 failed), at 2.287 hits/s, average response time is 0.017 seconds",
|
||||||
|
"version": "1.0"
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "http://carts"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/carts/{cartId}/items": {
|
||||||
|
"get": {
|
||||||
|
"summary": "/carts/{cartId}/items",
|
||||||
|
"description": "Mizu observed 3 entries (0 failed), at 2.287 hits/s, average response time is 0.017 seconds",
|
||||||
|
"operationId": "84c9b926-1f73-4ab4-b381-3c124528959f",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "Successful call with status 200",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"example": [
|
||||||
|
{
|
||||||
|
"id": "60fe98fb86c0fc000869a90c",
|
||||||
|
"itemId": "3395a43e-2d88-40de-b95f-e00e1502085b",
|
||||||
|
"quantity": 1,
|
||||||
|
"unitPrice": 18
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"x-sample-entry": "000000000000000000000010"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-sample-entry": "000000000000000000000010"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-counters-per-source": {
|
||||||
|
"some-source": {
|
||||||
|
"entries": 3,
|
||||||
|
"failures": 0,
|
||||||
|
"firstSeen": 1627298058.3798368,
|
||||||
|
"lastSeen": 1627298065.2397773,
|
||||||
|
"sumRT": 0.05,
|
||||||
|
"sumDuration": 6.859940528869629
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-counters-total": {
|
||||||
|
"entries": 3,
|
||||||
|
"failures": 0,
|
||||||
|
"firstSeen": 1627298058.3798368,
|
||||||
|
"lastSeen": 1627298065.2397773,
|
||||||
|
"sumRT": 0.05,
|
||||||
|
"sumDuration": 6.859940528869629
|
||||||
|
},
|
||||||
|
"x-last-seen-ts": 1627298065.2397773,
|
||||||
|
"x-sample-entry": "000000000000000000000010"
|
||||||
|
},
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "cartId",
|
||||||
|
"in": "path",
|
||||||
|
"required": true,
|
||||||
|
"style": "simple",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"examples": {
|
||||||
|
"example #0": {
|
||||||
|
"value": "mHK0P7zTktmV1zv57iWAvCTd43FFMHap"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-sample-entry": "000000000000000000000010"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-counters-per-source": {
|
||||||
|
"some-source": {
|
||||||
|
"entries": 3,
|
||||||
|
"failures": 0,
|
||||||
|
"firstSeen": 1627298058.3798368,
|
||||||
|
"lastSeen": 1627298065.2397773,
|
||||||
|
"sumRT": 0.05,
|
||||||
|
"sumDuration": 6.859940528869629
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-counters-total": {
|
||||||
|
"entries": 3,
|
||||||
|
"failures": 0,
|
||||||
|
"firstSeen": 1627298058.3798368,
|
||||||
|
"lastSeen": 1627298065.2397773,
|
||||||
|
"sumRT": 0.05,
|
||||||
|
"sumDuration": 6.859940528869629
|
||||||
|
}
|
||||||
|
}
|
||||||
485
agent/pkg/oas/oas-samples/catalogue.json
Normal file
485
agent/pkg/oas/oas-samples/catalogue.json
Normal file
@@ -0,0 +1,485 @@
|
|||||||
|
{
|
||||||
|
"openapi": "3.1.0",
|
||||||
|
"info": {
|
||||||
|
"title": "Preloaded",
|
||||||
|
"description": "Test file for loading pre-existing OAS",
|
||||||
|
"version": "0.1"
|
||||||
|
},
|
||||||
|
"paths": {
|
||||||
|
"/catalogue": {
|
||||||
|
"get": {
|
||||||
|
"tags": [
|
||||||
|
"catalogue"
|
||||||
|
],
|
||||||
|
"summary": "/catalogue",
|
||||||
|
"description": "Mizu observed 3 entries (0 failed), at 2.647 hits/s, average response time is 0.008 seconds",
|
||||||
|
"operationId": "dd6c3dbe-6b6b-4ddd-baed-757e237ddb8a",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "page",
|
||||||
|
"in": "query",
|
||||||
|
"required": false,
|
||||||
|
"style": "form",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"examples": {
|
||||||
|
"example #0": {
|
||||||
|
"value": "1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-sample-entry": "000000000000000000000002"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "size",
|
||||||
|
"in": "query",
|
||||||
|
"required": true,
|
||||||
|
"style": "form",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"examples": {
|
||||||
|
"example #0": {
|
||||||
|
"value": "6"
|
||||||
|
},
|
||||||
|
"example #1": {
|
||||||
|
"value": "3"
|
||||||
|
},
|
||||||
|
"example #2": {
|
||||||
|
"value": "5"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-sample-entry": "000000000000000000000011"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "tags",
|
||||||
|
"in": "query",
|
||||||
|
"required": false,
|
||||||
|
"style": "form",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"examples": {
|
||||||
|
"example #0": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"example #1": {
|
||||||
|
"value": "blue"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-sample-entry": "000000000000000000000007"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "sort",
|
||||||
|
"in": "query",
|
||||||
|
"required": false,
|
||||||
|
"style": "form",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"examples": {
|
||||||
|
"example #0": {
|
||||||
|
"value": "id"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-sample-entry": "000000000000000000000007"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "Successful call with status 200",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"example": [
|
||||||
|
{
|
||||||
|
"count": 1,
|
||||||
|
"description": "Socks fit for a Messiah. You too can experience walking in water with these special edition beauties. Each hole is lovingly proggled to leave smooth edges. The only sock approved by a higher power.",
|
||||||
|
"id": "03fef6ac-1896-4ce8-bd69-b798f85c6e0b",
|
||||||
|
"imageUrl": [
|
||||||
|
"/catalogue/images/holy_1.jpeg",
|
||||||
|
"/catalogue/images/holy_2.jpeg"
|
||||||
|
],
|
||||||
|
"name": "Holy",
|
||||||
|
"price": 99.99,
|
||||||
|
"tag": [
|
||||||
|
"action",
|
||||||
|
"magic"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"count": 438,
|
||||||
|
"description": "proident occaecat irure et excepteur labore minim nisi amet irure",
|
||||||
|
"id": "3395a43e-2d88-40de-b95f-e00e1502085b",
|
||||||
|
"imageUrl": [
|
||||||
|
"/catalogue/images/colourful_socks.jpg",
|
||||||
|
"/catalogue/images/colourful_socks.jpg"
|
||||||
|
],
|
||||||
|
"name": "Colourful",
|
||||||
|
"price": 18,
|
||||||
|
"tag": [
|
||||||
|
"brown",
|
||||||
|
"blue"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"count": 820,
|
||||||
|
"description": "Ready for action. Engineers: be ready to smash that next bug! Be ready, with these super-action-sport-masterpieces. This particular engineer was chased away from the office with a stick.",
|
||||||
|
"id": "510a0d7e-8e83-4193-b483-e27e09ddc34d",
|
||||||
|
"imageUrl": [
|
||||||
|
"/catalogue/images/puma_1.jpeg",
|
||||||
|
"/catalogue/images/puma_2.jpeg"
|
||||||
|
],
|
||||||
|
"name": "SuperSport XL",
|
||||||
|
"price": 15,
|
||||||
|
"tag": [
|
||||||
|
"sport",
|
||||||
|
"formal",
|
||||||
|
"black"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"count": 738,
|
||||||
|
"description": "A mature sock, crossed, with an air of nonchalance.",
|
||||||
|
"id": "808a2de1-1aaa-4c25-a9b9-6612e8f29a38",
|
||||||
|
"imageUrl": [
|
||||||
|
"/catalogue/images/cross_1.jpeg",
|
||||||
|
"/catalogue/images/cross_2.jpeg"
|
||||||
|
],
|
||||||
|
"name": "Crossed",
|
||||||
|
"price": 17.32,
|
||||||
|
"tag": [
|
||||||
|
"blue",
|
||||||
|
"action",
|
||||||
|
"red",
|
||||||
|
"formal"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"count": 808,
|
||||||
|
"description": "enim officia aliqua excepteur esse deserunt quis aliquip nostrud anim",
|
||||||
|
"id": "819e1fbf-8b7e-4f6d-811f-693534916a8b",
|
||||||
|
"imageUrl": [
|
||||||
|
"/catalogue/images/WAT.jpg",
|
||||||
|
"/catalogue/images/WAT2.jpg"
|
||||||
|
],
|
||||||
|
"name": "Figueroa",
|
||||||
|
"price": 14,
|
||||||
|
"tag": [
|
||||||
|
"green",
|
||||||
|
"formal",
|
||||||
|
"blue"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"count": 175,
|
||||||
|
"description": "consequat amet cupidatat minim laborum tempor elit ex consequat in",
|
||||||
|
"id": "837ab141-399e-4c1f-9abc-bace40296bac",
|
||||||
|
"imageUrl": [
|
||||||
|
"/catalogue/images/catsocks.jpg",
|
||||||
|
"/catalogue/images/catsocks2.jpg"
|
||||||
|
],
|
||||||
|
"name": "Cat socks",
|
||||||
|
"price": 15,
|
||||||
|
"tag": [
|
||||||
|
"brown",
|
||||||
|
"formal",
|
||||||
|
"green"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"x-sample-entry": "000000000000000000000011"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-sample-entry": "000000000000000000000011"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-counters-per-source": {
|
||||||
|
"some-source": {
|
||||||
|
"entries": 3,
|
||||||
|
"failures": 0,
|
||||||
|
"firstSeen": 1627298057.7849188,
|
||||||
|
"lastSeen": 1627298065.7258668,
|
||||||
|
"sumRT": 0.024999999999999998,
|
||||||
|
"sumDuration": 7.940948009490967
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-counters-total": {
|
||||||
|
"entries": 3,
|
||||||
|
"failures": 0,
|
||||||
|
"firstSeen": 1627298057.7849188,
|
||||||
|
"lastSeen": 1627298065.7258668,
|
||||||
|
"sumRT": 0.024999999999999998,
|
||||||
|
"sumDuration": 7.940948009490967
|
||||||
|
},
|
||||||
|
"x-last-seen-ts": 1627298065.7258668,
|
||||||
|
"x-sample-entry": "000000000000000000000011"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/catalogue/size": {
|
||||||
|
"get": {
|
||||||
|
"tags": [
|
||||||
|
"catalogue"
|
||||||
|
],
|
||||||
|
"summary": "/catalogue/size",
|
||||||
|
"description": "Mizu observed 1 entries (0 failed), at 0.000 hits/s, average response time is 0.013 seconds",
|
||||||
|
"operationId": "2315e69d-9d66-48cf-b3d3-fec9c30bd28b",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "tags",
|
||||||
|
"in": "query",
|
||||||
|
"required": true,
|
||||||
|
"style": "form",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"examples": {
|
||||||
|
"example #0": {
|
||||||
|
"value": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-sample-entry": "000000000000000000000001"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "x-some",
|
||||||
|
"in": "header",
|
||||||
|
"required": true,
|
||||||
|
"style": "simple",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"examples": {
|
||||||
|
"example #0": {
|
||||||
|
"value": "demo val"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-sample-entry": "000000000000000000000001"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "Successful call with status 200",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"example": {
|
||||||
|
"err": null,
|
||||||
|
"size": 9
|
||||||
|
},
|
||||||
|
"x-sample-entry": "000000000000000000000001"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-sample-entry": "000000000000000000000001"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-counters-per-source": {
|
||||||
|
"some-source": {
|
||||||
|
"entries": 1,
|
||||||
|
"failures": 0,
|
||||||
|
"firstSeen": 1627298057.7841518,
|
||||||
|
"lastSeen": 1627298057.7841518,
|
||||||
|
"sumRT": 0.013,
|
||||||
|
"sumDuration": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-counters-total": {
|
||||||
|
"entries": 1,
|
||||||
|
"failures": 0,
|
||||||
|
"firstSeen": 1627298057.7841518,
|
||||||
|
"lastSeen": 1627298057.7841518,
|
||||||
|
"sumRT": 0.013,
|
||||||
|
"sumDuration": 0
|
||||||
|
},
|
||||||
|
"x-last-seen-ts": 1627298057.7841518,
|
||||||
|
"x-sample-entry": "000000000000000000000001"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/catalogue/{id}": {
|
||||||
|
"get": {
|
||||||
|
"tags": [
|
||||||
|
"catalogue"
|
||||||
|
],
|
||||||
|
"summary": "/catalogue/{id}",
|
||||||
|
"description": "Mizu observed 4 entries (0 failed), at 1.899 hits/s, average response time is 0.003 seconds",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "non-required-header",
|
||||||
|
"in": "header",
|
||||||
|
"required": false,
|
||||||
|
"style": "simple",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"example": "some-uuid-maybe"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "x-some",
|
||||||
|
"in": "header",
|
||||||
|
"required": false,
|
||||||
|
"style": "simple",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"examples": {
|
||||||
|
"example #0": {
|
||||||
|
"value": "demoval"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-sample-entry": "000000000000000000000004"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "Successful call with status 200",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"example": {
|
||||||
|
"count": 438,
|
||||||
|
"description": "proident occaecat irure et excepteur labore minim nisi amet irure",
|
||||||
|
"id": "3395a43e-2d88-40de-b95f-e00e1502085b",
|
||||||
|
"imageUrl": [
|
||||||
|
"/catalogue/images/colourful_socks.jpg",
|
||||||
|
"/catalogue/images/colourful_socks.jpg"
|
||||||
|
],
|
||||||
|
"name": "Colourful",
|
||||||
|
"price": 18,
|
||||||
|
"tag": [
|
||||||
|
"brown",
|
||||||
|
"blue"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"x-sample-entry": "000000000000000000000012"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-sample-entry": "000000000000000000000012"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-counters-per-source": {
|
||||||
|
"some-source": {
|
||||||
|
"entries": 4,
|
||||||
|
"failures": 0,
|
||||||
|
"firstSeen": 1627298058.1315014,
|
||||||
|
"lastSeen": 1627298065.7293031,
|
||||||
|
"sumRT": 0.013999999999999999,
|
||||||
|
"sumDuration": 7.597801685333252
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-counters-total": {
|
||||||
|
"entries": 4,
|
||||||
|
"failures": 0,
|
||||||
|
"firstSeen": 1627298058.1315014,
|
||||||
|
"lastSeen": 1627298065.7293031,
|
||||||
|
"sumRT": 0.013999999999999999,
|
||||||
|
"sumDuration": 7.597801685333252
|
||||||
|
},
|
||||||
|
"x-last-seen-ts": 1627298065.7293031,
|
||||||
|
"x-sample-entry": "000000000000000000000012"
|
||||||
|
},
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true,
|
||||||
|
"style": "simple",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"examples": {
|
||||||
|
"example #0": {
|
||||||
|
"value": "3395a43e-2d88-40de-b95f-e00e1502085b"
|
||||||
|
},
|
||||||
|
"example #1": {
|
||||||
|
"value": "808a2de1-1aaa-4c25-a9b9-6612e8f29a38"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"example": "some-uuid-maybe",
|
||||||
|
"x-sample-entry": "000000000000000000000012"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"/catalogue/{id}/details": {
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true,
|
||||||
|
"style": "simple",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"example": "some-uuid-maybe"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"/tags": {
|
||||||
|
"get": {
|
||||||
|
"summary": "/tags",
|
||||||
|
"description": "Mizu observed 1 entries (0 failed), at 0.000 hits/s, average response time is 0.007 seconds",
|
||||||
|
"operationId": "c4d7d0ed-1a78-4370-a049-efe3abc631a6",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "Successful call with status 200",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"example": {
|
||||||
|
"err": null,
|
||||||
|
"tags": [
|
||||||
|
"brown",
|
||||||
|
"geek",
|
||||||
|
"formal",
|
||||||
|
"blue",
|
||||||
|
"skin",
|
||||||
|
"red",
|
||||||
|
"action",
|
||||||
|
"sport",
|
||||||
|
"black",
|
||||||
|
"magic",
|
||||||
|
"green"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"x-sample-entry": "000000000000000000000003"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-sample-entry": "000000000000000000000003"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-counters-per-source": {
|
||||||
|
"some-source": {
|
||||||
|
"entries": 1,
|
||||||
|
"failures": 0,
|
||||||
|
"firstSeen": 1627298057.7841816,
|
||||||
|
"lastSeen": 1627298057.7841816,
|
||||||
|
"sumRT": 0.007,
|
||||||
|
"sumDuration": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-counters-total": {
|
||||||
|
"entries": 1,
|
||||||
|
"failures": 0,
|
||||||
|
"firstSeen": 1627298057.7841816,
|
||||||
|
"lastSeen": 1627298057.7841816,
|
||||||
|
"sumRT": 0.007,
|
||||||
|
"sumDuration": 0
|
||||||
|
},
|
||||||
|
"x-last-seen-ts": 1627298057.7841816,
|
||||||
|
"x-sample-entry": "000000000000000000000003"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-counters-per-source": {
|
||||||
|
"some-source": {
|
||||||
|
"entries": 9,
|
||||||
|
"failures": 0,
|
||||||
|
"firstSeen": 1627298057.7841518,
|
||||||
|
"lastSeen": 1627298065.7293031,
|
||||||
|
"sumRT": 0.05899999999999999,
|
||||||
|
"sumDuration": 15.538749694824219
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-counters-total": {
|
||||||
|
"entries": 9,
|
||||||
|
"failures": 0,
|
||||||
|
"firstSeen": 1627298057.7841518,
|
||||||
|
"lastSeen": 1627298065.7293031,
|
||||||
|
"sumRT": 0.05899999999999999,
|
||||||
|
"sumDuration": 15.538749694824219
|
||||||
|
}
|
||||||
|
}
|
||||||
897
agent/pkg/oas/oas-samples/httpbin.org.json
Normal file
897
agent/pkg/oas/oas-samples/httpbin.org.json
Normal file
@@ -0,0 +1,897 @@
|
|||||||
|
{
|
||||||
|
"openapi": "3.1.0",
|
||||||
|
"info": {
|
||||||
|
"title": "https://httpbin.org",
|
||||||
|
"description": "Mizu observed 19 entries (0 failed), at 0.106 hits/s, average response time is 0.172 seconds",
|
||||||
|
"version": "1.0"
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "https://httpbin.org"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/appears-once": {
|
||||||
|
"get": {
|
||||||
|
"summary": "/appears-once",
|
||||||
|
"description": "Mizu observed 1 entries (0 failed), at 0.000 hits/s, average response time is 0.630 seconds",
|
||||||
|
"operationId": "2d34623e-fde8-4720-8390-9a7439051755",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "Successful call with status 200",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"example": null,
|
||||||
|
"x-sample-entry": "000000000000000000000004"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-sample-entry": "000000000000000000000004"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-counters-per-source": {
|
||||||
|
"": {
|
||||||
|
"entries": 1,
|
||||||
|
"failures": 0,
|
||||||
|
"firstSeen": 1567750580.0471218,
|
||||||
|
"lastSeen": 1567750580.0471218,
|
||||||
|
"sumRT": 0.63,
|
||||||
|
"sumDuration": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-counters-total": {
|
||||||
|
"entries": 1,
|
||||||
|
"failures": 0,
|
||||||
|
"firstSeen": 1567750580.0471218,
|
||||||
|
"lastSeen": 1567750580.0471218,
|
||||||
|
"sumRT": 0.63,
|
||||||
|
"sumDuration": 0
|
||||||
|
},
|
||||||
|
"x-last-seen-ts": 1567750580.0471218,
|
||||||
|
"x-sample-entry": "000000000000000000000004"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/appears-twice": {
|
||||||
|
"get": {
|
||||||
|
"summary": "/appears-twice",
|
||||||
|
"description": "Mizu observed 2 entries (0 failed), at 0.500 hits/s, average response time is 0.630 seconds",
|
||||||
|
"operationId": "9c5330f3-8062-468b-b5a3-df1ad82b4846",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "Successful call with status 200",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"example": null,
|
||||||
|
"x-sample-entry": "000000000000000000000006"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-sample-entry": "000000000000000000000006"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-counters-per-source": {
|
||||||
|
"": {
|
||||||
|
"entries": 2,
|
||||||
|
"failures": 0,
|
||||||
|
"firstSeen": 1567750580.7471218,
|
||||||
|
"lastSeen": 1567750581.7471218,
|
||||||
|
"sumRT": 1.26,
|
||||||
|
"sumDuration": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-counters-total": {
|
||||||
|
"entries": 2,
|
||||||
|
"failures": 0,
|
||||||
|
"firstSeen": 1567750580.7471218,
|
||||||
|
"lastSeen": 1567750581.7471218,
|
||||||
|
"sumRT": 1.26,
|
||||||
|
"sumDuration": 1
|
||||||
|
},
|
||||||
|
"x-last-seen-ts": 1567750581.7471218,
|
||||||
|
"x-sample-entry": "000000000000000000000006"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/body-optional": {
|
||||||
|
"post": {
|
||||||
|
"summary": "/body-optional",
|
||||||
|
"description": "Mizu observed 3 entries (0 failed), at 0.003 hits/s, average response time is 0.001 seconds",
|
||||||
|
"operationId": "34f3d66c-b1f7-4dca-9cab-987fcc8ae472",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "Successful call with status 200",
|
||||||
|
"content": {
|
||||||
|
"": {
|
||||||
|
"x-sample-entry": "000000000000000000000012"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-sample-entry": "000000000000000000000012"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-counters-per-source": {
|
||||||
|
"": {
|
||||||
|
"entries": 3,
|
||||||
|
"failures": 0,
|
||||||
|
"firstSeen": 1567750581.7471218,
|
||||||
|
"lastSeen": 1567750581.757122,
|
||||||
|
"sumRT": 0.003,
|
||||||
|
"sumDuration": 0.010000228881835938
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-counters-total": {
|
||||||
|
"entries": 3,
|
||||||
|
"failures": 0,
|
||||||
|
"firstSeen": 1567750581.7471218,
|
||||||
|
"lastSeen": 1567750581.757122,
|
||||||
|
"sumRT": 0.003,
|
||||||
|
"sumDuration": 0.010000228881835938
|
||||||
|
},
|
||||||
|
"x-last-seen-ts": 1567750581.757122,
|
||||||
|
"x-sample-entry": "000000000000000000000012",
|
||||||
|
"requestBody": {
|
||||||
|
"description": "Generic request body",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"example": "{\"key\", \"val\"}",
|
||||||
|
"x-sample-entry": "000000000000000000000011"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-sample-entry": "000000000000000000000012"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/body-required": {
|
||||||
|
"post": {
|
||||||
|
"summary": "/body-required",
|
||||||
|
"description": "Mizu observed 1 entries (0 failed), at 0.000 hits/s, average response time is 0.001 seconds",
|
||||||
|
"operationId": "ff6add53-ab1c-4d4e-b590-0835fa318276",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "Successful call with status 200",
|
||||||
|
"content": {
|
||||||
|
"": {
|
||||||
|
"x-sample-entry": "000000000000000000000013"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-sample-entry": "000000000000000000000013"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-counters-per-source": {
|
||||||
|
"": {
|
||||||
|
"entries": 1,
|
||||||
|
"failures": 0,
|
||||||
|
"firstSeen": 1567750581.757122,
|
||||||
|
"lastSeen": 1567750581.757122,
|
||||||
|
"sumRT": 0.001,
|
||||||
|
"sumDuration": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-counters-total": {
|
||||||
|
"entries": 1,
|
||||||
|
"failures": 0,
|
||||||
|
"firstSeen": 1567750581.757122,
|
||||||
|
"lastSeen": 1567750581.757122,
|
||||||
|
"sumRT": 0.001,
|
||||||
|
"sumDuration": 0
|
||||||
|
},
|
||||||
|
"x-last-seen-ts": 1567750581.757122,
|
||||||
|
"x-sample-entry": "000000000000000000000013",
|
||||||
|
"requestBody": {
|
||||||
|
"description": "Generic request body",
|
||||||
|
"content": {
|
||||||
|
"": {
|
||||||
|
"example": "body exists",
|
||||||
|
"x-sample-entry": "000000000000000000000013"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": true,
|
||||||
|
"x-sample-entry": "000000000000000000000013"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/form-multipart": {
|
||||||
|
"post": {
|
||||||
|
"summary": "/form-multipart",
|
||||||
|
"description": "Mizu observed 1 entries (0 failed), at 0.000 hits/s, average response time is 0.001 seconds",
|
||||||
|
"operationId": "153f0925-9fc7-4e9f-9d33-f1470f25f0f7",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "Successful call with status 200",
|
||||||
|
"content": {
|
||||||
|
"": {
|
||||||
|
"example": {},
|
||||||
|
"x-sample-entry": "000000000000000000000009"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-sample-entry": "000000000000000000000009"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-counters-per-source": {
|
||||||
|
"": {
|
||||||
|
"entries": 1,
|
||||||
|
"failures": 0,
|
||||||
|
"firstSeen": 1567750582.7471218,
|
||||||
|
"lastSeen": 1567750582.7471218,
|
||||||
|
"sumRT": 0.001,
|
||||||
|
"sumDuration": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-counters-total": {
|
||||||
|
"entries": 1,
|
||||||
|
"failures": 0,
|
||||||
|
"firstSeen": 1567750582.7471218,
|
||||||
|
"lastSeen": 1567750582.7471218,
|
||||||
|
"sumRT": 0.001,
|
||||||
|
"sumDuration": 0
|
||||||
|
},
|
||||||
|
"x-last-seen-ts": 1567750582.7471218,
|
||||||
|
"x-sample-entry": "000000000000000000000009",
|
||||||
|
"requestBody": {
|
||||||
|
"description": "Generic request body",
|
||||||
|
"content": {
|
||||||
|
"multipart/form-data": {
|
||||||
|
"schema": {
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"file",
|
||||||
|
"path"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"file": {
|
||||||
|
"type": "string",
|
||||||
|
"contentMediaType": "application/json",
|
||||||
|
"examples": [
|
||||||
|
"{\"functions\": 123}"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"path": {
|
||||||
|
"type": "string",
|
||||||
|
"examples": [
|
||||||
|
"/content/components"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"example": "--BOUNDARY\r\nContent-Disposition: form-data; name=\"file\"; filename=\"metadata.json\"\r\nContent-Type: application/json\r\n\r\n{\"functions\": 123}\r\n--BOUNDARY\r\nContent-Disposition: form-data; name=\"path\"\r\n\r\n/content/components\r\n--BOUNDARY--\r\n",
|
||||||
|
"x-sample-entry": "000000000000000000000009"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": true,
|
||||||
|
"x-sample-entry": "000000000000000000000009"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/form-urlencoded": {
|
||||||
|
"post": {
|
||||||
|
"summary": "/form-urlencoded",
|
||||||
|
"description": "Mizu observed 2 entries (0 failed), at 0.500 hits/s, average response time is 0.001 seconds",
|
||||||
|
"operationId": "c92189f5-5636-46eb-ac71-92b17941a568",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "Successful call with status 200",
|
||||||
|
"content": {
|
||||||
|
"": {
|
||||||
|
"x-sample-entry": "000000000000000000000008"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-sample-entry": "000000000000000000000008"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-counters-per-source": {
|
||||||
|
"": {
|
||||||
|
"entries": 2,
|
||||||
|
"failures": 0,
|
||||||
|
"firstSeen": 1567750580.7471218,
|
||||||
|
"lastSeen": 1567750581.7471218,
|
||||||
|
"sumRT": 0.002,
|
||||||
|
"sumDuration": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-counters-total": {
|
||||||
|
"entries": 2,
|
||||||
|
"failures": 0,
|
||||||
|
"firstSeen": 1567750580.7471218,
|
||||||
|
"lastSeen": 1567750581.7471218,
|
||||||
|
"sumRT": 0.002,
|
||||||
|
"sumDuration": 1
|
||||||
|
},
|
||||||
|
"x-last-seen-ts": 1567750581.7471218,
|
||||||
|
"x-sample-entry": "000000000000000000000008",
|
||||||
|
"requestBody": {
|
||||||
|
"description": "Generic request body",
|
||||||
|
"content": {
|
||||||
|
"application/x-www-form-urlencoded": {
|
||||||
|
"schema": {
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"agent-id",
|
||||||
|
"callback-url",
|
||||||
|
"token"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"agent-id": {
|
||||||
|
"type": "string",
|
||||||
|
"examples": [
|
||||||
|
"ade"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"callback-url": {
|
||||||
|
"type": "string",
|
||||||
|
"examples": [
|
||||||
|
""
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"optional": {
|
||||||
|
"type": "string",
|
||||||
|
"examples": [
|
||||||
|
"another"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"token": {
|
||||||
|
"type": "string",
|
||||||
|
"examples": [
|
||||||
|
"sometoken",
|
||||||
|
"sometoken-second-val"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"example": "agent-id=ade\u0026callback-url=\u0026token=sometoken",
|
||||||
|
"x-sample-entry": "000000000000000000000008"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": true,
|
||||||
|
"x-sample-entry": "000000000000000000000008"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/param-patterns/prefix-gibberish-fine/{prefixgibberishfineId}": {
|
||||||
|
"get": {
|
||||||
|
"tags": [
|
||||||
|
"param-patterns"
|
||||||
|
],
|
||||||
|
"summary": "/param-patterns/prefix-gibberish-fine/{prefixgibberishfineId}",
|
||||||
|
"description": "Mizu observed 1 entries (0 failed), at 0.000 hits/s, average response time is 0.001 seconds",
|
||||||
|
"operationId": "85270437-7aae-4a5b-b988-3662092463d0",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "Successful call with status 200",
|
||||||
|
"content": {
|
||||||
|
"": {
|
||||||
|
"x-sample-entry": "000000000000000000000014"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-sample-entry": "000000000000000000000014"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-counters-per-source": {
|
||||||
|
"": {
|
||||||
|
"entries": 1,
|
||||||
|
"failures": 0,
|
||||||
|
"firstSeen": 1567750582,
|
||||||
|
"lastSeen": 1567750582,
|
||||||
|
"sumRT": 0.001,
|
||||||
|
"sumDuration": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-counters-total": {
|
||||||
|
"entries": 1,
|
||||||
|
"failures": 0,
|
||||||
|
"firstSeen": 1567750582,
|
||||||
|
"lastSeen": 1567750582,
|
||||||
|
"sumRT": 0.001,
|
||||||
|
"sumDuration": 0
|
||||||
|
},
|
||||||
|
"x-last-seen-ts": 1567750582,
|
||||||
|
"x-sample-entry": "000000000000000000000014"
|
||||||
|
},
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "prefixgibberishfineId",
|
||||||
|
"in": "path",
|
||||||
|
"required": true,
|
||||||
|
"style": "simple",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"examples": {
|
||||||
|
"example #0": {
|
||||||
|
"value": "234324"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-sample-entry": "000000000000000000000014"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"/param-patterns/{parampatternId}": {
|
||||||
|
"get": {
|
||||||
|
"tags": [
|
||||||
|
"param-patterns"
|
||||||
|
],
|
||||||
|
"summary": "/param-patterns/{parampatternId}",
|
||||||
|
"description": "Mizu observed 2 entries (0 failed), at 0.000 hits/s, average response time is 0.001 seconds",
|
||||||
|
"operationId": "da597734-1cf5-4d3b-917b-6b02dacf7b7b",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "Successful call with status 200",
|
||||||
|
"content": {
|
||||||
|
"": {
|
||||||
|
"x-sample-entry": "000000000000000000000018"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-sample-entry": "000000000000000000000018"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-counters-per-source": {
|
||||||
|
"": {
|
||||||
|
"entries": 2,
|
||||||
|
"failures": 0,
|
||||||
|
"firstSeen": 1567750582.000003,
|
||||||
|
"lastSeen": 1567750582.000004,
|
||||||
|
"sumRT": 0.002,
|
||||||
|
"sumDuration": 9.5367431640625e-7
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-counters-total": {
|
||||||
|
"entries": 2,
|
||||||
|
"failures": 0,
|
||||||
|
"firstSeen": 1567750582.000003,
|
||||||
|
"lastSeen": 1567750582.000004,
|
||||||
|
"sumRT": 0.002,
|
||||||
|
"sumDuration": 9.5367431640625e-7
|
||||||
|
},
|
||||||
|
"x-last-seen-ts": 1567750582.000004,
|
||||||
|
"x-sample-entry": "000000000000000000000018"
|
||||||
|
},
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "parampatternId",
|
||||||
|
"in": "path",
|
||||||
|
"required": true,
|
||||||
|
"style": "simple",
|
||||||
|
"schema": {
|
||||||
|
"type": "string",
|
||||||
|
"pattern": "^prefix-gibberish-.+"
|
||||||
|
},
|
||||||
|
"examples": {
|
||||||
|
"example #0": {
|
||||||
|
"value": "prefix-gibberish-sfdlasdfkadf87sd93284q24r"
|
||||||
|
},
|
||||||
|
"example #1": {
|
||||||
|
"value": "prefix-gibberish-adslkfasdf89sa7dfasddafa8a98sd7kansdf"
|
||||||
|
},
|
||||||
|
"example #2": {
|
||||||
|
"value": "prefix-gibberish-4jk5l2345h2452l4352435jlk45"
|
||||||
|
},
|
||||||
|
"example #3": {
|
||||||
|
"value": "prefix-gibberish-84395h2j4k35hj243j5h2kl34h54k"
|
||||||
|
},
|
||||||
|
"example #4": {
|
||||||
|
"value": "prefix-gibberish-afterwards"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-sample-entry": "000000000000000000000019"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"/param-patterns/{parampatternId}/1": {
|
||||||
|
"get": {
|
||||||
|
"tags": [
|
||||||
|
"param-patterns"
|
||||||
|
],
|
||||||
|
"summary": "/param-patterns/{parampatternId}/1",
|
||||||
|
"description": "Mizu observed 1 entries (0 failed), at 0.000 hits/s, average response time is 0.001 seconds",
|
||||||
|
"operationId": "e965a245-9cfc-48ed-94e1-f765eadb3960",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "Successful call with status 200",
|
||||||
|
"content": {
|
||||||
|
"": {
|
||||||
|
"x-sample-entry": "000000000000000000000015"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-sample-entry": "000000000000000000000015"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-counters-per-source": {
|
||||||
|
"": {
|
||||||
|
"entries": 1,
|
||||||
|
"failures": 0,
|
||||||
|
"firstSeen": 1567750582.000001,
|
||||||
|
"lastSeen": 1567750582.000001,
|
||||||
|
"sumRT": 0.001,
|
||||||
|
"sumDuration": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-counters-total": {
|
||||||
|
"entries": 1,
|
||||||
|
"failures": 0,
|
||||||
|
"firstSeen": 1567750582.000001,
|
||||||
|
"lastSeen": 1567750582.000001,
|
||||||
|
"sumRT": 0.001,
|
||||||
|
"sumDuration": 0
|
||||||
|
},
|
||||||
|
"x-last-seen-ts": 1567750582.000001,
|
||||||
|
"x-sample-entry": "000000000000000000000015"
|
||||||
|
},
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "parampatternId",
|
||||||
|
"in": "path",
|
||||||
|
"required": true,
|
||||||
|
"style": "simple",
|
||||||
|
"schema": {
|
||||||
|
"type": "string",
|
||||||
|
"pattern": "^prefix-gibberish-.+"
|
||||||
|
},
|
||||||
|
"examples": {
|
||||||
|
"example #0": {
|
||||||
|
"value": "prefix-gibberish-sfdlasdfkadf87sd93284q24r"
|
||||||
|
},
|
||||||
|
"example #1": {
|
||||||
|
"value": "prefix-gibberish-adslkfasdf89sa7dfasddafa8a98sd7kansdf"
|
||||||
|
},
|
||||||
|
"example #2": {
|
||||||
|
"value": "prefix-gibberish-4jk5l2345h2452l4352435jlk45"
|
||||||
|
},
|
||||||
|
"example #3": {
|
||||||
|
"value": "prefix-gibberish-84395h2j4k35hj243j5h2kl34h54k"
|
||||||
|
},
|
||||||
|
"example #4": {
|
||||||
|
"value": "prefix-gibberish-afterwards"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-sample-entry": "000000000000000000000019"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"/param-patterns/{parampatternId}/static": {
|
||||||
|
"get": {
|
||||||
|
"tags": [
|
||||||
|
"param-patterns"
|
||||||
|
],
|
||||||
|
"summary": "/param-patterns/{parampatternId}/static",
|
||||||
|
"description": "Mizu observed 1 entries (0 failed), at 0.000 hits/s, average response time is 0.001 seconds",
|
||||||
|
"operationId": "7af420dc-f8b7-450f-8f6f-18b039aa3cde",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "Successful call with status 200",
|
||||||
|
"content": {
|
||||||
|
"": {
|
||||||
|
"x-sample-entry": "000000000000000000000016"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-sample-entry": "000000000000000000000016"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-counters-per-source": {
|
||||||
|
"": {
|
||||||
|
"entries": 1,
|
||||||
|
"failures": 0,
|
||||||
|
"firstSeen": 1567750582.000002,
|
||||||
|
"lastSeen": 1567750582.000002,
|
||||||
|
"sumRT": 0.001,
|
||||||
|
"sumDuration": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-counters-total": {
|
||||||
|
"entries": 1,
|
||||||
|
"failures": 0,
|
||||||
|
"firstSeen": 1567750582.000002,
|
||||||
|
"lastSeen": 1567750582.000002,
|
||||||
|
"sumRT": 0.001,
|
||||||
|
"sumDuration": 0
|
||||||
|
},
|
||||||
|
"x-last-seen-ts": 1567750582.000002,
|
||||||
|
"x-sample-entry": "000000000000000000000016"
|
||||||
|
},
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "parampatternId",
|
||||||
|
"in": "path",
|
||||||
|
"required": true,
|
||||||
|
"style": "simple",
|
||||||
|
"schema": {
|
||||||
|
"type": "string",
|
||||||
|
"pattern": "^prefix-gibberish-.+"
|
||||||
|
},
|
||||||
|
"examples": {
|
||||||
|
"example #0": {
|
||||||
|
"value": "prefix-gibberish-sfdlasdfkadf87sd93284q24r"
|
||||||
|
},
|
||||||
|
"example #1": {
|
||||||
|
"value": "prefix-gibberish-adslkfasdf89sa7dfasddafa8a98sd7kansdf"
|
||||||
|
},
|
||||||
|
"example #2": {
|
||||||
|
"value": "prefix-gibberish-4jk5l2345h2452l4352435jlk45"
|
||||||
|
},
|
||||||
|
"example #3": {
|
||||||
|
"value": "prefix-gibberish-84395h2j4k35hj243j5h2kl34h54k"
|
||||||
|
},
|
||||||
|
"example #4": {
|
||||||
|
"value": "prefix-gibberish-afterwards"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-sample-entry": "000000000000000000000019"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"/param-patterns/{parampatternId}/{param1}": {
|
||||||
|
"get": {
|
||||||
|
"tags": [
|
||||||
|
"param-patterns"
|
||||||
|
],
|
||||||
|
"summary": "/param-patterns/{parampatternId}/{param1}",
|
||||||
|
"description": "Mizu observed 1 entries (0 failed), at 0.000 hits/s, average response time is 0.001 seconds",
|
||||||
|
"operationId": "02a1771d-2d50-4a8c-8be2-29c7e59b8435",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "Successful call with status 200",
|
||||||
|
"content": {
|
||||||
|
"": {
|
||||||
|
"x-sample-entry": "000000000000000000000019"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-sample-entry": "000000000000000000000019"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-counters-per-source": {
|
||||||
|
"": {
|
||||||
|
"entries": 1,
|
||||||
|
"failures": 0,
|
||||||
|
"firstSeen": 1567750582.000002,
|
||||||
|
"lastSeen": 1567750582.000002,
|
||||||
|
"sumRT": 0.001,
|
||||||
|
"sumDuration": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-counters-total": {
|
||||||
|
"entries": 1,
|
||||||
|
"failures": 0,
|
||||||
|
"firstSeen": 1567750582.000002,
|
||||||
|
"lastSeen": 1567750582.000002,
|
||||||
|
"sumRT": 0.001,
|
||||||
|
"sumDuration": 0
|
||||||
|
},
|
||||||
|
"x-last-seen-ts": 1567750582.000002,
|
||||||
|
"x-sample-entry": "000000000000000000000019"
|
||||||
|
},
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "param1",
|
||||||
|
"in": "path",
|
||||||
|
"required": true,
|
||||||
|
"style": "simple",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"examples": {
|
||||||
|
"example #0": {
|
||||||
|
"value": "23421"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-sample-entry": "000000000000000000000019"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "parampatternId",
|
||||||
|
"in": "path",
|
||||||
|
"required": true,
|
||||||
|
"style": "simple",
|
||||||
|
"schema": {
|
||||||
|
"type": "string",
|
||||||
|
"pattern": "^prefix-gibberish-.+"
|
||||||
|
},
|
||||||
|
"examples": {
|
||||||
|
"example #0": {
|
||||||
|
"value": "prefix-gibberish-sfdlasdfkadf87sd93284q24r"
|
||||||
|
},
|
||||||
|
"example #1": {
|
||||||
|
"value": "prefix-gibberish-adslkfasdf89sa7dfasddafa8a98sd7kansdf"
|
||||||
|
},
|
||||||
|
"example #2": {
|
||||||
|
"value": "prefix-gibberish-4jk5l2345h2452l4352435jlk45"
|
||||||
|
},
|
||||||
|
"example #3": {
|
||||||
|
"value": "prefix-gibberish-84395h2j4k35hj243j5h2kl34h54k"
|
||||||
|
},
|
||||||
|
"example #4": {
|
||||||
|
"value": "prefix-gibberish-afterwards"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-sample-entry": "000000000000000000000019"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"/{Id}": {
|
||||||
|
"get": {
|
||||||
|
"summary": "/{Id}",
|
||||||
|
"description": "Mizu observed 1 entries (0 failed), at 0.000 hits/s, average response time is 0.630 seconds",
|
||||||
|
"operationId": "77ec4910-d47a-46a5-8234-fb80a11034b4",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "Successful call with status 200",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"example": null,
|
||||||
|
"x-sample-entry": "000000000000000000000003"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-sample-entry": "000000000000000000000003"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-counters-per-source": {
|
||||||
|
"": {
|
||||||
|
"entries": 1,
|
||||||
|
"failures": 0,
|
||||||
|
"firstSeen": 1567750579.7471218,
|
||||||
|
"lastSeen": 1567750579.7471218,
|
||||||
|
"sumRT": 0.63,
|
||||||
|
"sumDuration": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-counters-total": {
|
||||||
|
"entries": 1,
|
||||||
|
"failures": 0,
|
||||||
|
"firstSeen": 1567750579.7471218,
|
||||||
|
"lastSeen": 1567750579.7471218,
|
||||||
|
"sumRT": 0.63,
|
||||||
|
"sumDuration": 0
|
||||||
|
},
|
||||||
|
"x-last-seen-ts": 1567750579.7471218,
|
||||||
|
"x-sample-entry": "000000000000000000000003"
|
||||||
|
},
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "Id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true,
|
||||||
|
"style": "simple",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"examples": {
|
||||||
|
"example #0": {
|
||||||
|
"value": "e21f7112-3d3b-4632-9da3-a4af2e0e9166"
|
||||||
|
},
|
||||||
|
"example #1": {
|
||||||
|
"value": "952bea17-3776-11ea-9341-42010a84012a"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-sample-entry": "000000000000000000000003"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"/{Id}/sub1": {
|
||||||
|
"get": {
|
||||||
|
"summary": "/{Id}/sub1",
|
||||||
|
"description": "Mizu observed 1 entries (0 failed), at 0.000 hits/s, average response time is 0.111 seconds",
|
||||||
|
"operationId": "198675eb-9faf-407b-83fa-0483a730bbbe",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "Successful call with status 200",
|
||||||
|
"content": {
|
||||||
|
"text/html": {
|
||||||
|
"x-sample-entry": "000000000000000000000001"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-sample-entry": "000000000000000000000001"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-counters-per-source": {
|
||||||
|
"": {
|
||||||
|
"entries": 1,
|
||||||
|
"failures": 0,
|
||||||
|
"firstSeen": 1567750483.864529,
|
||||||
|
"lastSeen": 1567750483.864529,
|
||||||
|
"sumRT": 0.111,
|
||||||
|
"sumDuration": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-counters-total": {
|
||||||
|
"entries": 1,
|
||||||
|
"failures": 0,
|
||||||
|
"firstSeen": 1567750483.864529,
|
||||||
|
"lastSeen": 1567750483.864529,
|
||||||
|
"sumRT": 0.111,
|
||||||
|
"sumDuration": 0
|
||||||
|
},
|
||||||
|
"x-last-seen-ts": 1567750483.864529,
|
||||||
|
"x-sample-entry": "000000000000000000000001"
|
||||||
|
},
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "Id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true,
|
||||||
|
"style": "simple",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"examples": {
|
||||||
|
"example #0": {
|
||||||
|
"value": "e21f7112-3d3b-4632-9da3-a4af2e0e9166"
|
||||||
|
},
|
||||||
|
"example #1": {
|
||||||
|
"value": "952bea17-3776-11ea-9341-42010a84012a"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-sample-entry": "000000000000000000000003"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"/{Id}/sub2": {
|
||||||
|
"get": {
|
||||||
|
"summary": "/{Id}/sub2",
|
||||||
|
"description": "Mizu observed 1 entries (0 failed), at 0.000 hits/s, average response time is 0.630 seconds",
|
||||||
|
"operationId": "31d880f1-152f-4dd6-84a7-463e13b694a5",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "Successful call with status 200",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"example": null,
|
||||||
|
"x-sample-entry": "000000000000000000000002"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-sample-entry": "000000000000000000000002"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-counters-per-source": {
|
||||||
|
"": {
|
||||||
|
"entries": 1,
|
||||||
|
"failures": 0,
|
||||||
|
"firstSeen": 1567750578.7471218,
|
||||||
|
"lastSeen": 1567750578.7471218,
|
||||||
|
"sumRT": 0.63,
|
||||||
|
"sumDuration": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-counters-total": {
|
||||||
|
"entries": 1,
|
||||||
|
"failures": 0,
|
||||||
|
"firstSeen": 1567750578.7471218,
|
||||||
|
"lastSeen": 1567750578.7471218,
|
||||||
|
"sumRT": 0.63,
|
||||||
|
"sumDuration": 0
|
||||||
|
},
|
||||||
|
"x-last-seen-ts": 1567750578.7471218,
|
||||||
|
"x-sample-entry": "000000000000000000000002"
|
||||||
|
},
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "Id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true,
|
||||||
|
"style": "simple",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"examples": {
|
||||||
|
"example #0": {
|
||||||
|
"value": "e21f7112-3d3b-4632-9da3-a4af2e0e9166"
|
||||||
|
},
|
||||||
|
"example #1": {
|
||||||
|
"value": "952bea17-3776-11ea-9341-42010a84012a"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-sample-entry": "000000000000000000000003"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-counters-per-source": {
|
||||||
|
"": {
|
||||||
|
"entries": 19,
|
||||||
|
"failures": 0,
|
||||||
|
"firstSeen": 1567750483.864529,
|
||||||
|
"lastSeen": 1567750582.7471218,
|
||||||
|
"sumRT": 3.273999999999999,
|
||||||
|
"sumDuration": 2.0100011825561523
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-counters-total": {
|
||||||
|
"entries": 19,
|
||||||
|
"failures": 0,
|
||||||
|
"firstSeen": 1567750483.864529,
|
||||||
|
"lastSeen": 1567750582.7471218,
|
||||||
|
"sumRT": 3.273999999999999,
|
||||||
|
"sumDuration": 2.0100011825561523
|
||||||
|
}
|
||||||
|
}
|
||||||
1787
agent/pkg/oas/oas-samples/trcc-api-service.json
Normal file
1787
agent/pkg/oas/oas-samples/trcc-api-service.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -3,12 +3,13 @@ package oas
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"net/url"
|
||||||
|
"sync"
|
||||||
|
|
||||||
basenine "github.com/up9inc/basenine/client/go"
|
basenine "github.com/up9inc/basenine/client/go"
|
||||||
"github.com/up9inc/mizu/agent/pkg/har"
|
"github.com/up9inc/mizu/agent/pkg/har"
|
||||||
"github.com/up9inc/mizu/shared"
|
"github.com/up9inc/mizu/shared"
|
||||||
"github.com/up9inc/mizu/tap/api"
|
"github.com/up9inc/mizu/tap/api"
|
||||||
"net/url"
|
|
||||||
"sync"
|
|
||||||
|
|
||||||
"github.com/up9inc/mizu/shared/logger"
|
"github.com/up9inc/mizu/shared/logger"
|
||||||
)
|
)
|
||||||
@@ -19,40 +20,58 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type OasGenerator interface {
|
type OasGenerator interface {
|
||||||
Start()
|
Start(conn *basenine.Connection)
|
||||||
Stop()
|
Stop()
|
||||||
IsStarted() bool
|
IsStarted() bool
|
||||||
Reset()
|
|
||||||
GetServiceSpecs() *sync.Map
|
GetServiceSpecs() *sync.Map
|
||||||
SetEntriesQuery(query string)
|
SetEntriesQuery(query string) bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type defaultOasGenerator struct {
|
type defaultOasGenerator struct {
|
||||||
started bool
|
started bool
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
cancel context.CancelFunc
|
cancel context.CancelFunc
|
||||||
serviceSpecs *sync.Map
|
serviceSpecs *sync.Map
|
||||||
dbConn *basenine.Connection
|
dbConn *basenine.Connection
|
||||||
|
dbMutex sync.Mutex
|
||||||
entriesQuery string
|
entriesQuery string
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetDefaultOasGeneratorInstance(conn *basenine.Connection) *defaultOasGenerator {
|
func GetDefaultOasGeneratorInstance() *defaultOasGenerator {
|
||||||
syncOnce.Do(func() {
|
syncOnce.Do(func() {
|
||||||
instance = NewDefaultOasGenerator(conn)
|
instance = NewDefaultOasGenerator()
|
||||||
logger.Log.Debug("OAS Generator Initialized")
|
logger.Log.Debug("OAS Generator Initialized")
|
||||||
})
|
})
|
||||||
return instance
|
return instance
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *defaultOasGenerator) Start() {
|
func (g *defaultOasGenerator) Start(conn *basenine.Connection) {
|
||||||
if g.started {
|
if g.started {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if g.dbConn == nil {
|
||||||
|
if conn == nil {
|
||||||
|
logger.Log.Infof("Creating new DB connection for OAS generator to address %s:%s", shared.BasenineHost, shared.BaseninePort)
|
||||||
|
newConn, err := basenine.NewConnection(shared.BasenineHost, shared.BaseninePort)
|
||||||
|
if err != nil {
|
||||||
|
logger.Log.Error("Error connecting to DB for OAS generator, err: %v", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
conn = newConn
|
||||||
|
}
|
||||||
|
|
||||||
|
g.dbConn = conn
|
||||||
|
}
|
||||||
|
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
g.cancel = cancel
|
g.cancel = cancel
|
||||||
g.ctx = ctx
|
g.ctx = ctx
|
||||||
g.serviceSpecs = &sync.Map{}
|
g.serviceSpecs = &sync.Map{}
|
||||||
|
|
||||||
g.started = true
|
g.started = true
|
||||||
|
|
||||||
go g.runGenerator()
|
go g.runGenerator()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,9 +79,17 @@ func (g *defaultOasGenerator) Stop() {
|
|||||||
if !g.started {
|
if !g.started {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
g.cancel()
|
|
||||||
g.Reset()
|
|
||||||
g.started = false
|
g.started = false
|
||||||
|
|
||||||
|
g.cancel()
|
||||||
|
g.reset()
|
||||||
|
|
||||||
|
g.dbMutex.Lock()
|
||||||
|
defer g.dbMutex.Unlock()
|
||||||
|
if g.dbConn != nil {
|
||||||
|
g.dbConn.Close()
|
||||||
|
g.dbConn = nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *defaultOasGenerator) IsStarted() bool {
|
func (g *defaultOasGenerator) IsStarted() bool {
|
||||||
@@ -70,17 +97,23 @@ func (g *defaultOasGenerator) IsStarted() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (g *defaultOasGenerator) runGenerator() {
|
func (g *defaultOasGenerator) runGenerator() {
|
||||||
// Make []byte channels to recieve the data and the meta
|
// Make []byte channels to receive the data and the meta
|
||||||
dataChan := make(chan []byte)
|
dataChan := make(chan []byte)
|
||||||
metaChan := make(chan []byte)
|
metaChan := make(chan []byte)
|
||||||
|
|
||||||
|
g.dbMutex.Lock()
|
||||||
|
defer g.dbMutex.Unlock()
|
||||||
logger.Log.Infof("Querying DB for OAS generator with query '%s'", g.entriesQuery)
|
logger.Log.Infof("Querying DB for OAS generator with query '%s'", g.entriesQuery)
|
||||||
g.dbConn.Query(g.entriesQuery, dataChan, metaChan)
|
if err := g.dbConn.Query(g.entriesQuery, dataChan, metaChan); err != nil {
|
||||||
|
logger.Log.Errorf("Query mode call failed: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-g.ctx.Done():
|
case <-g.ctx.Done():
|
||||||
logger.Log.Infof("OAS Generator was canceled")
|
logger.Log.Infof("OAS Generator was canceled")
|
||||||
|
close(dataChan)
|
||||||
|
close(metaChan)
|
||||||
return
|
return
|
||||||
|
|
||||||
case metaBytes, ok := <-metaChan:
|
case metaBytes, ok := <-metaChan:
|
||||||
@@ -148,7 +181,7 @@ func (g *defaultOasGenerator) handleHARWithSource(entryWSource *EntryWithSource)
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.Log.Debugf("Handled entry %d as opId: %s", entryWSource.Id, opId) // TODO: set opId back to entry?
|
logger.Log.Debugf("Handled entry %s as opId: %s", entryWSource.Id, opId) // TODO: set opId back to entry?
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *defaultOasGenerator) getGen(dest string, urlStr string) *SpecGen {
|
func (g *defaultOasGenerator) getGen(dest string, urlStr string) *SpecGen {
|
||||||
@@ -168,7 +201,7 @@ func (g *defaultOasGenerator) getGen(dest string, urlStr string) *SpecGen {
|
|||||||
return gen
|
return gen
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *defaultOasGenerator) Reset() {
|
func (g *defaultOasGenerator) reset() {
|
||||||
g.serviceSpecs = &sync.Map{}
|
g.serviceSpecs = &sync.Map{}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,25 +209,18 @@ func (g *defaultOasGenerator) GetServiceSpecs() *sync.Map {
|
|||||||
return g.serviceSpecs
|
return g.serviceSpecs
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *defaultOasGenerator) SetEntriesQuery(query string) {
|
func (g *defaultOasGenerator) SetEntriesQuery(query string) bool {
|
||||||
|
changed := g.entriesQuery != query
|
||||||
g.entriesQuery = query
|
g.entriesQuery = query
|
||||||
|
return changed
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewDefaultOasGenerator(conn *basenine.Connection) *defaultOasGenerator {
|
func NewDefaultOasGenerator() *defaultOasGenerator {
|
||||||
if conn == nil {
|
|
||||||
logger.Log.Infof("Creating new DB connection for OAS generator to address %s:%s", shared.BasenineHost, shared.BaseninePort)
|
|
||||||
newConn, err := basenine.NewConnection(shared.BasenineHost, shared.BaseninePort)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
conn = newConn
|
|
||||||
}
|
|
||||||
|
|
||||||
return &defaultOasGenerator{
|
return &defaultOasGenerator{
|
||||||
started: false,
|
started: false,
|
||||||
ctx: nil,
|
ctx: nil,
|
||||||
cancel: nil,
|
cancel: nil,
|
||||||
serviceSpecs: nil,
|
serviceSpecs: nil,
|
||||||
dbConn: conn,
|
dbConn: nil,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,14 +3,12 @@ package oas
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"github.com/up9inc/mizu/agent/pkg/har"
|
"github.com/up9inc/mizu/agent/pkg/har"
|
||||||
"sync"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestOASGen(t *testing.T) {
|
func TestOASGen(t *testing.T) {
|
||||||
gen := new(defaultOasGenerator)
|
gen := new(defaultOasGenerator)
|
||||||
gen.dbConn = GetFakeDBConn(`{"startedDateTime": "20000101","request": {"url": "https://host/path", "method": "GET"}, "response": {"status": 200}}`)
|
|
||||||
gen.serviceSpecs = &sync.Map{}
|
|
||||||
|
|
||||||
e := new(har.Entry)
|
e := new(har.Entry)
|
||||||
err := json.Unmarshal([]byte(`{"startedDateTime": "20000101","request": {"url": "https://host/path", "method": "GET"}, "response": {"status": 200}}`), e)
|
err := json.Unmarshal([]byte(`{"startedDateTime": "20000101","request": {"url": "https://host/path", "method": "GET"}, "response": {"status": 200}}`), e)
|
||||||
@@ -22,7 +20,9 @@ func TestOASGen(t *testing.T) {
|
|||||||
Destination: "some",
|
Destination: "some",
|
||||||
Entry: *e,
|
Entry: *e,
|
||||||
}
|
}
|
||||||
gen.Start()
|
|
||||||
|
dummyConn := GetFakeDBConn(`{"startedDateTime": "20000101","request": {"url": "https://host/path", "method": "GET"}, "response": {"status": 200}}`)
|
||||||
|
gen.Start(dummyConn)
|
||||||
gen.handleHARWithSource(ews)
|
gen.handleHARWithSource(ews)
|
||||||
g, ok := gen.serviceSpecs.Load("some")
|
g, ok := gen.serviceSpecs.Load("some")
|
||||||
if !ok {
|
if !ok {
|
||||||
@@ -39,5 +39,8 @@ func TestOASGen(t *testing.T) {
|
|||||||
if !gen.IsStarted() {
|
if !gen.IsStarted() {
|
||||||
t.Errorf("Should be started")
|
t.Errorf("Should be started")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
time.Sleep(100 * time.Millisecond)
|
||||||
|
|
||||||
gen.Stop()
|
gen.Stop()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,10 +3,6 @@ package oas
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"github.com/chanced/openapi"
|
|
||||||
"github.com/google/uuid"
|
|
||||||
"github.com/nav-inc/datetime"
|
|
||||||
"github.com/up9inc/mizu/shared/logger"
|
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"mime"
|
"mime"
|
||||||
@@ -18,6 +14,11 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
"github.com/chanced/openapi"
|
||||||
|
"github.com/google/uuid"
|
||||||
|
"github.com/nav-inc/datetime"
|
||||||
|
"github.com/up9inc/mizu/shared/logger"
|
||||||
|
|
||||||
"github.com/up9inc/mizu/agent/pkg/har"
|
"github.com/up9inc/mizu/agent/pkg/har"
|
||||||
|
|
||||||
"time"
|
"time"
|
||||||
@@ -32,7 +33,7 @@ type EntryWithSource struct {
|
|||||||
Source string
|
Source string
|
||||||
Destination string
|
Destination string
|
||||||
Entry har.Entry
|
Entry har.Entry
|
||||||
Id uint
|
Id string
|
||||||
}
|
}
|
||||||
|
|
||||||
type reqResp struct { // hello, generics in Go
|
type reqResp struct { // hello, generics in Go
|
||||||
@@ -67,7 +68,7 @@ func (g *SpecGen) StartFromSpec(oas *openapi.OpenAPI) {
|
|||||||
g.tree = new(Node)
|
g.tree = new(Node)
|
||||||
for pathStr, pathObj := range oas.Paths.Items {
|
for pathStr, pathObj := range oas.Paths.Items {
|
||||||
pathSplit := strings.Split(string(pathStr), "/")
|
pathSplit := strings.Split(string(pathStr), "/")
|
||||||
g.tree.getOrSet(pathSplit, pathObj, 0)
|
g.tree.getOrSet(pathSplit, pathObj, "")
|
||||||
|
|
||||||
// clean "last entry timestamp" markers from the past
|
// clean "last entry timestamp" markers from the past
|
||||||
for _, pathAndOp := range g.tree.listOps() {
|
for _, pathAndOp := range g.tree.listOps() {
|
||||||
@@ -341,7 +342,7 @@ func handleCounters(opObj *openapi.Operation, success bool, entryWithSource *Ent
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleRequest(req *har.Request, opObj *openapi.Operation, isSuccess bool, sampleId uint) error {
|
func handleRequest(req *har.Request, opObj *openapi.Operation, isSuccess bool, sampleId string) error {
|
||||||
// TODO: we don't handle the situation when header/qstr param can be defined on pathObj level. Also the path param defined on opObj
|
// TODO: we don't handle the situation when header/qstr param can be defined on pathObj level. Also the path param defined on opObj
|
||||||
urlParsed, err := url.Parse(req.URL)
|
urlParsed, err := url.Parse(req.URL)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -401,7 +402,7 @@ func handleRequest(req *har.Request, opObj *openapi.Operation, isSuccess bool, s
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleResponse(resp *har.Response, opObj *openapi.Operation, isSuccess bool, sampleId uint) error {
|
func handleResponse(resp *har.Response, opObj *openapi.Operation, isSuccess bool, sampleId string) error {
|
||||||
// TODO: we don't support "default" response
|
// TODO: we don't support "default" response
|
||||||
respObj, err := getResponseObj(resp, opObj, isSuccess)
|
respObj, err := getResponseObj(resp, opObj, isSuccess)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -422,7 +423,7 @@ func handleResponse(resp *har.Response, opObj *openapi.Operation, isSuccess bool
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleRespHeaders(reqHeaders []har.Header, respObj *openapi.ResponseObj, sampleId uint) {
|
func handleRespHeaders(reqHeaders []har.Header, respObj *openapi.ResponseObj, sampleId string) {
|
||||||
visited := map[string]*openapi.HeaderObj{}
|
visited := map[string]*openapi.HeaderObj{}
|
||||||
for _, pair := range reqHeaders {
|
for _, pair := range reqHeaders {
|
||||||
if isHeaderIgnored(pair.Name) {
|
if isHeaderIgnored(pair.Name) {
|
||||||
@@ -466,7 +467,7 @@ func handleRespHeaders(reqHeaders []har.Header, respObj *openapi.ResponseObj, sa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func fillContent(reqResp reqResp, respContent openapi.Content, ctype string, sampleId uint) (*openapi.MediaType, error) {
|
func fillContent(reqResp reqResp, respContent openapi.Content, ctype string, sampleId string) (*openapi.MediaType, error) {
|
||||||
content, found := respContent[ctype]
|
content, found := respContent[ctype]
|
||||||
if !found {
|
if !found {
|
||||||
respContent[ctype] = &openapi.MediaType{}
|
respContent[ctype] = &openapi.MediaType{}
|
||||||
|
|||||||
@@ -61,8 +61,7 @@ func TestEntries(t *testing.T) {
|
|||||||
t.FailNow()
|
t.FailNow()
|
||||||
}
|
}
|
||||||
|
|
||||||
dummyConn := GetFakeDBConn("\n")
|
gen := NewDefaultOasGenerator()
|
||||||
gen := NewDefaultOasGenerator(dummyConn)
|
|
||||||
gen.serviceSpecs = new(sync.Map)
|
gen.serviceSpecs = new(sync.Map)
|
||||||
loadStartingOAS("test_artifacts/catalogue.json", "catalogue", gen.serviceSpecs)
|
loadStartingOAS("test_artifacts/catalogue.json", "catalogue", gen.serviceSpecs)
|
||||||
loadStartingOAS("test_artifacts/trcc.json", "trcc-api-service", gen.serviceSpecs)
|
loadStartingOAS("test_artifacts/trcc.json", "trcc-api-service", gen.serviceSpecs)
|
||||||
@@ -136,8 +135,7 @@ func TestEntries(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestFileSingle(t *testing.T) {
|
func TestFileSingle(t *testing.T) {
|
||||||
dummyConn := GetFakeDBConn("\n")
|
gen := NewDefaultOasGenerator()
|
||||||
gen := NewDefaultOasGenerator(dummyConn)
|
|
||||||
gen.serviceSpecs = new(sync.Map)
|
gen.serviceSpecs = new(sync.Map)
|
||||||
// loadStartingOAS()
|
// loadStartingOAS()
|
||||||
file := "test_artifacts/params.har"
|
file := "test_artifacts/params.har"
|
||||||
@@ -227,8 +225,7 @@ func loadStartingOAS(file string, label string, specs *sync.Map) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestEntriesNegative(t *testing.T) {
|
func TestEntriesNegative(t *testing.T) {
|
||||||
dummyConn := GetFakeDBConn("\n")
|
gen := NewDefaultOasGenerator()
|
||||||
gen := NewDefaultOasGenerator(dummyConn)
|
|
||||||
gen.serviceSpecs = new(sync.Map)
|
gen.serviceSpecs = new(sync.Map)
|
||||||
files := []string{"invalid"}
|
files := []string{"invalid"}
|
||||||
_, err := feedEntries(files, false, gen)
|
_, err := feedEntries(files, false, gen)
|
||||||
@@ -239,8 +236,7 @@ func TestEntriesNegative(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestEntriesPositive(t *testing.T) {
|
func TestEntriesPositive(t *testing.T) {
|
||||||
dummyConn := GetFakeDBConn("\n")
|
gen := NewDefaultOasGenerator()
|
||||||
gen := NewDefaultOasGenerator(dummyConn)
|
|
||||||
gen.serviceSpecs = new(sync.Map)
|
gen.serviceSpecs = new(sync.Map)
|
||||||
files := []string{"test_artifacts/params.har"}
|
files := []string{"test_artifacts/params.har"}
|
||||||
_, err := feedEntries(files, false, gen)
|
_, err := feedEntries(files, false, gen)
|
||||||
|
|||||||
@@ -22,10 +22,10 @@
|
|||||||
"content": {
|
"content": {
|
||||||
"application/json": {
|
"application/json": {
|
||||||
"example": null,
|
"example": null,
|
||||||
"x-sample-entry": 4
|
"x-sample-entry": "000000000000000000000004"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"x-sample-entry": 4
|
"x-sample-entry": "000000000000000000000004"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"x-counters-per-source": {
|
"x-counters-per-source": {
|
||||||
@@ -47,7 +47,7 @@
|
|||||||
"sumDuration": 0
|
"sumDuration": 0
|
||||||
},
|
},
|
||||||
"x-last-seen-ts": 1567750580.04,
|
"x-last-seen-ts": 1567750580.04,
|
||||||
"x-sample-entry": 4
|
"x-sample-entry": "000000000000000000000004"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/appears-twice": {
|
"/appears-twice": {
|
||||||
@@ -61,10 +61,10 @@
|
|||||||
"content": {
|
"content": {
|
||||||
"application/json": {
|
"application/json": {
|
||||||
"example": null,
|
"example": null,
|
||||||
"x-sample-entry": 6
|
"x-sample-entry": "000000000000000000000006"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"x-sample-entry": 6
|
"x-sample-entry": "000000000000000000000006"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"x-counters-per-source": {
|
"x-counters-per-source": {
|
||||||
@@ -86,7 +86,7 @@
|
|||||||
"sumDuration": 1
|
"sumDuration": 1
|
||||||
},
|
},
|
||||||
"x-last-seen-ts": 1567750581.74,
|
"x-last-seen-ts": 1567750581.74,
|
||||||
"x-sample-entry": 6
|
"x-sample-entry": "000000000000000000000006"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/body-optional": {
|
"/body-optional": {
|
||||||
@@ -99,10 +99,10 @@
|
|||||||
"description": "Successful call with status 200",
|
"description": "Successful call with status 200",
|
||||||
"content": {
|
"content": {
|
||||||
"": {
|
"": {
|
||||||
"x-sample-entry": 12
|
"x-sample-entry": "000000000000000000000012"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"x-sample-entry": 12
|
"x-sample-entry": "000000000000000000000012"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"x-counters-per-source": {
|
"x-counters-per-source": {
|
||||||
@@ -124,16 +124,16 @@
|
|||||||
"sumDuration": 0.01
|
"sumDuration": 0.01
|
||||||
},
|
},
|
||||||
"x-last-seen-ts": 1567750581.75,
|
"x-last-seen-ts": 1567750581.75,
|
||||||
"x-sample-entry": 12,
|
"x-sample-entry": "000000000000000000000012",
|
||||||
"requestBody": {
|
"requestBody": {
|
||||||
"description": "Generic request body",
|
"description": "Generic request body",
|
||||||
"content": {
|
"content": {
|
||||||
"application/json": {
|
"application/json": {
|
||||||
"example": "{\"key\", \"val\"}",
|
"example": "{\"key\", \"val\"}",
|
||||||
"x-sample-entry": 11
|
"x-sample-entry": "000000000000000000000011"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"x-sample-entry": 12
|
"x-sample-entry": "000000000000000000000012"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -147,10 +147,10 @@
|
|||||||
"description": "Successful call with status 200",
|
"description": "Successful call with status 200",
|
||||||
"content": {
|
"content": {
|
||||||
"": {
|
"": {
|
||||||
"x-sample-entry": 13
|
"x-sample-entry": "000000000000000000000013"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"x-sample-entry": 13
|
"x-sample-entry": "000000000000000000000013"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"x-counters-per-source": {
|
"x-counters-per-source": {
|
||||||
@@ -172,17 +172,17 @@
|
|||||||
"sumDuration": 0
|
"sumDuration": 0
|
||||||
},
|
},
|
||||||
"x-last-seen-ts": 1567750581.75,
|
"x-last-seen-ts": 1567750581.75,
|
||||||
"x-sample-entry": 13,
|
"x-sample-entry": "000000000000000000000013",
|
||||||
"requestBody": {
|
"requestBody": {
|
||||||
"description": "Generic request body",
|
"description": "Generic request body",
|
||||||
"content": {
|
"content": {
|
||||||
"": {
|
"": {
|
||||||
"example": "body exists",
|
"example": "body exists",
|
||||||
"x-sample-entry": 13
|
"x-sample-entry": "000000000000000000000013"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": true,
|
"required": true,
|
||||||
"x-sample-entry": 13
|
"x-sample-entry": "000000000000000000000013"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -197,10 +197,10 @@
|
|||||||
"content": {
|
"content": {
|
||||||
"": {
|
"": {
|
||||||
"example": {},
|
"example": {},
|
||||||
"x-sample-entry": 9
|
"x-sample-entry": "000000000000000000000009"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"x-sample-entry": 9
|
"x-sample-entry": "000000000000000000000009"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"x-counters-per-source": {
|
"x-counters-per-source": {
|
||||||
@@ -222,7 +222,7 @@
|
|||||||
"sumDuration": 0
|
"sumDuration": 0
|
||||||
},
|
},
|
||||||
"x-last-seen-ts": 1567750582.74,
|
"x-last-seen-ts": 1567750582.74,
|
||||||
"x-sample-entry": 9,
|
"x-sample-entry": "000000000000000000000009",
|
||||||
"requestBody": {
|
"requestBody": {
|
||||||
"description": "Generic request body",
|
"description": "Generic request body",
|
||||||
"content": {
|
"content": {
|
||||||
@@ -250,11 +250,11 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"example": "--BOUNDARY\r\nContent-Disposition: form-data; name=\"file\"; filename=\"metadata.json\"\r\nContent-Type: application/json\r\n\r\n{\"functions\": 123}\r\n--BOUNDARY\r\nContent-Disposition: form-data; name=\"path\"\r\n\r\n/content/components\r\n--BOUNDARY--\r\n",
|
"example": "--BOUNDARY\r\nContent-Disposition: form-data; name=\"file\"; filename=\"metadata.json\"\r\nContent-Type: application/json\r\n\r\n{\"functions\": 123}\r\n--BOUNDARY\r\nContent-Disposition: form-data; name=\"path\"\r\n\r\n/content/components\r\n--BOUNDARY--\r\n",
|
||||||
"x-sample-entry": 9
|
"x-sample-entry": "000000000000000000000009"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": true,
|
"required": true,
|
||||||
"x-sample-entry": 9
|
"x-sample-entry": "000000000000000000000009"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -268,10 +268,10 @@
|
|||||||
"description": "Successful call with status 200",
|
"description": "Successful call with status 200",
|
||||||
"content": {
|
"content": {
|
||||||
"": {
|
"": {
|
||||||
"x-sample-entry": 8
|
"x-sample-entry": "000000000000000000000008"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"x-sample-entry": 8
|
"x-sample-entry": "000000000000000000000008"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"x-counters-per-source": {
|
"x-counters-per-source": {
|
||||||
@@ -293,7 +293,7 @@
|
|||||||
"sumDuration": 1
|
"sumDuration": 1
|
||||||
},
|
},
|
||||||
"x-last-seen-ts": 1567750581.74,
|
"x-last-seen-ts": 1567750581.74,
|
||||||
"x-sample-entry": 8,
|
"x-sample-entry": "000000000000000000000008",
|
||||||
"requestBody": {
|
"requestBody": {
|
||||||
"description": "Generic request body",
|
"description": "Generic request body",
|
||||||
"content": {
|
"content": {
|
||||||
@@ -334,11 +334,11 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"example": "agent-id=ade\u0026callback-url=\u0026token=sometoken",
|
"example": "agent-id=ade\u0026callback-url=\u0026token=sometoken",
|
||||||
"x-sample-entry": 8
|
"x-sample-entry": "000000000000000000000008"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": true,
|
"required": true,
|
||||||
"x-sample-entry": 8
|
"x-sample-entry": "000000000000000000000008"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -355,10 +355,10 @@
|
|||||||
"description": "Successful call with status 200",
|
"description": "Successful call with status 200",
|
||||||
"content": {
|
"content": {
|
||||||
"": {
|
"": {
|
||||||
"x-sample-entry": 14
|
"x-sample-entry": "000000000000000000000014"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"x-sample-entry": 14
|
"x-sample-entry": "000000000000000000000014"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"x-counters-per-source": {
|
"x-counters-per-source": {
|
||||||
@@ -380,7 +380,7 @@
|
|||||||
"sumDuration": 0
|
"sumDuration": 0
|
||||||
},
|
},
|
||||||
"x-last-seen-ts": 1567750582,
|
"x-last-seen-ts": 1567750582,
|
||||||
"x-sample-entry": 14
|
"x-sample-entry": "000000000000000000000014"
|
||||||
},
|
},
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
@@ -396,7 +396,7 @@
|
|||||||
"value": "234324"
|
"value": "234324"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"x-sample-entry": 14
|
"x-sample-entry": "000000000000000000000014"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -413,10 +413,10 @@
|
|||||||
"description": "Successful call with status 200",
|
"description": "Successful call with status 200",
|
||||||
"content": {
|
"content": {
|
||||||
"": {
|
"": {
|
||||||
"x-sample-entry": 18
|
"x-sample-entry": "000000000000000000000018"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"x-sample-entry": 18
|
"x-sample-entry": "000000000000000000000018"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"x-counters-per-source": {
|
"x-counters-per-source": {
|
||||||
@@ -438,7 +438,7 @@
|
|||||||
"sumDuration": 9.53e-7
|
"sumDuration": 9.53e-7
|
||||||
},
|
},
|
||||||
"x-last-seen-ts": 1567750582.00,
|
"x-last-seen-ts": 1567750582.00,
|
||||||
"x-sample-entry": 18
|
"x-sample-entry": "000000000000000000000018"
|
||||||
},
|
},
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
@@ -467,7 +467,7 @@
|
|||||||
"value": "prefix-gibberish-afterwards"
|
"value": "prefix-gibberish-afterwards"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"x-sample-entry": 19
|
"x-sample-entry": "000000000000000000000019"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -484,10 +484,10 @@
|
|||||||
"description": "Successful call with status 200",
|
"description": "Successful call with status 200",
|
||||||
"content": {
|
"content": {
|
||||||
"": {
|
"": {
|
||||||
"x-sample-entry": 15
|
"x-sample-entry": "000000000000000000000015"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"x-sample-entry": 15
|
"x-sample-entry": "000000000000000000000015"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"x-counters-per-source": {
|
"x-counters-per-source": {
|
||||||
@@ -509,7 +509,7 @@
|
|||||||
"sumDuration": 0
|
"sumDuration": 0
|
||||||
},
|
},
|
||||||
"x-last-seen-ts": 1567750582.00,
|
"x-last-seen-ts": 1567750582.00,
|
||||||
"x-sample-entry": 15
|
"x-sample-entry": "000000000000000000000015"
|
||||||
},
|
},
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
@@ -538,7 +538,7 @@
|
|||||||
"value": "prefix-gibberish-afterwards"
|
"value": "prefix-gibberish-afterwards"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"x-sample-entry": 19
|
"x-sample-entry": "000000000000000000000019"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -555,10 +555,10 @@
|
|||||||
"description": "Successful call with status 200",
|
"description": "Successful call with status 200",
|
||||||
"content": {
|
"content": {
|
||||||
"": {
|
"": {
|
||||||
"x-sample-entry": 16
|
"x-sample-entry": "000000000000000000000016"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"x-sample-entry": 16
|
"x-sample-entry": "000000000000000000000016"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"x-counters-per-source": {
|
"x-counters-per-source": {
|
||||||
@@ -580,7 +580,7 @@
|
|||||||
"sumDuration": 0
|
"sumDuration": 0
|
||||||
},
|
},
|
||||||
"x-last-seen-ts": 1567750582.00,
|
"x-last-seen-ts": 1567750582.00,
|
||||||
"x-sample-entry": 16
|
"x-sample-entry": "000000000000000000000016"
|
||||||
},
|
},
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
@@ -609,7 +609,7 @@
|
|||||||
"value": "prefix-gibberish-afterwards"
|
"value": "prefix-gibberish-afterwards"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"x-sample-entry": 19
|
"x-sample-entry": "000000000000000000000019"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -626,10 +626,10 @@
|
|||||||
"description": "Successful call with status 200",
|
"description": "Successful call with status 200",
|
||||||
"content": {
|
"content": {
|
||||||
"": {
|
"": {
|
||||||
"x-sample-entry": 19
|
"x-sample-entry": "000000000000000000000019"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"x-sample-entry": 19
|
"x-sample-entry": "000000000000000000000019"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"x-counters-per-source": {
|
"x-counters-per-source": {
|
||||||
@@ -651,7 +651,7 @@
|
|||||||
"sumDuration": 0
|
"sumDuration": 0
|
||||||
},
|
},
|
||||||
"x-last-seen-ts": 1567750582.00,
|
"x-last-seen-ts": 1567750582.00,
|
||||||
"x-sample-entry": 19
|
"x-sample-entry": "000000000000000000000019"
|
||||||
},
|
},
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
@@ -667,7 +667,7 @@
|
|||||||
"value": "23421"
|
"value": "23421"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"x-sample-entry": 19
|
"x-sample-entry": "000000000000000000000019"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "parampatternId",
|
"name": "parampatternId",
|
||||||
@@ -695,7 +695,7 @@
|
|||||||
"value": "prefix-gibberish-afterwards"
|
"value": "prefix-gibberish-afterwards"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"x-sample-entry": 19
|
"x-sample-entry": "000000000000000000000019"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -710,10 +710,10 @@
|
|||||||
"content": {
|
"content": {
|
||||||
"application/json": {
|
"application/json": {
|
||||||
"example": null,
|
"example": null,
|
||||||
"x-sample-entry": 3
|
"x-sample-entry": "000000000000000000000003"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"x-sample-entry": 3
|
"x-sample-entry": "000000000000000000000003"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"x-counters-per-source": {
|
"x-counters-per-source": {
|
||||||
@@ -735,7 +735,7 @@
|
|||||||
"sumDuration": 0
|
"sumDuration": 0
|
||||||
},
|
},
|
||||||
"x-last-seen-ts": 1567750579.74,
|
"x-last-seen-ts": 1567750579.74,
|
||||||
"x-sample-entry": 3
|
"x-sample-entry": "000000000000000000000003"
|
||||||
},
|
},
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
@@ -754,7 +754,7 @@
|
|||||||
"value": "<UUID4>"
|
"value": "<UUID4>"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"x-sample-entry": 3
|
"x-sample-entry": "000000000000000000000003"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -768,10 +768,10 @@
|
|||||||
"description": "Successful call with status 200",
|
"description": "Successful call with status 200",
|
||||||
"content": {
|
"content": {
|
||||||
"text/html": {
|
"text/html": {
|
||||||
"x-sample-entry": 1
|
"x-sample-entry": "000000000000000000000001"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"x-sample-entry": 1
|
"x-sample-entry": "000000000000000000000001"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"x-counters-per-source": {
|
"x-counters-per-source": {
|
||||||
@@ -793,7 +793,7 @@
|
|||||||
"sumDuration": 0
|
"sumDuration": 0
|
||||||
},
|
},
|
||||||
"x-last-seen-ts": 1567750483.86,
|
"x-last-seen-ts": 1567750483.86,
|
||||||
"x-sample-entry": 1
|
"x-sample-entry": "000000000000000000000001"
|
||||||
},
|
},
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
@@ -812,7 +812,7 @@
|
|||||||
"value": "<UUID4>"
|
"value": "<UUID4>"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"x-sample-entry": 3
|
"x-sample-entry": "000000000000000000000003"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -827,10 +827,10 @@
|
|||||||
"content": {
|
"content": {
|
||||||
"application/json": {
|
"application/json": {
|
||||||
"example": null,
|
"example": null,
|
||||||
"x-sample-entry": 2
|
"x-sample-entry": "000000000000000000000002"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"x-sample-entry": 2
|
"x-sample-entry": "000000000000000000000002"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"x-counters-per-source": {
|
"x-counters-per-source": {
|
||||||
@@ -852,7 +852,7 @@
|
|||||||
"sumDuration": 0
|
"sumDuration": 0
|
||||||
},
|
},
|
||||||
"x-last-seen-ts": 1567750578.74,
|
"x-last-seen-ts": 1567750578.74,
|
||||||
"x-sample-entry": 2
|
"x-sample-entry": "000000000000000000000002"
|
||||||
},
|
},
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
@@ -871,7 +871,7 @@
|
|||||||
"value": "<UUID4>"
|
"value": "<UUID4>"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"x-sample-entry": 3
|
"x-sample-entry": "000000000000000000000003"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,12 +2,13 @@ package oas
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"github.com/chanced/openapi"
|
|
||||||
"github.com/up9inc/mizu/shared/logger"
|
|
||||||
"net/url"
|
"net/url"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/chanced/openapi"
|
||||||
|
"github.com/up9inc/mizu/shared/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
type NodePath = []string
|
type NodePath = []string
|
||||||
@@ -20,7 +21,7 @@ type Node struct {
|
|||||||
children []*Node
|
children []*Node
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Node) getOrSet(path NodePath, existingPathObj *openapi.PathObj, sampleId uint) (node *Node) {
|
func (n *Node) getOrSet(path NodePath, existingPathObj *openapi.PathObj, sampleId string) (node *Node) {
|
||||||
if existingPathObj == nil {
|
if existingPathObj == nil {
|
||||||
panic("Invalid function call")
|
panic("Invalid function call")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package oas
|
package oas
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
@@ -23,7 +24,7 @@ func TestTree(t *testing.T) {
|
|||||||
for i, tc := range testCases {
|
for i, tc := range testCases {
|
||||||
split := strings.Split(tc.inp, "/")
|
split := strings.Split(tc.inp, "/")
|
||||||
pathObj := new(openapi.PathObj)
|
pathObj := new(openapi.PathObj)
|
||||||
node := tree.getOrSet(split, pathObj, uint(i))
|
node := tree.getOrSet(split, pathObj, fmt.Sprintf("%024d", i))
|
||||||
|
|
||||||
fillPathParams(node, pathObj)
|
fillPathParams(node, pathObj)
|
||||||
|
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ type nvParams struct {
|
|||||||
GeneralizeName func(name string) string
|
GeneralizeName func(name string) string
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleNameVals(gw nvParams, params **openapi.ParameterList, checkIgnore bool, sampleId uint) {
|
func handleNameVals(gw nvParams, params **openapi.ParameterList, checkIgnore bool, sampleId string) {
|
||||||
visited := map[string]*openapi.ParameterObj{}
|
visited := map[string]*openapi.ParameterObj{}
|
||||||
for _, pair := range gw.Pairs {
|
for _, pair := range gw.Pairs {
|
||||||
if (checkIgnore && gw.IsIgnored(pair.Name)) || pair.Name == "" {
|
if (checkIgnore && gw.IsIgnored(pair.Name)) || pair.Name == "" {
|
||||||
@@ -477,8 +477,8 @@ func intersectSliceWithMap(required []string, names map[string]struct{}) []strin
|
|||||||
return required
|
return required
|
||||||
}
|
}
|
||||||
|
|
||||||
func setSampleID(extensions *openapi.Extensions, id uint) {
|
func setSampleID(extensions *openapi.Extensions, id string) {
|
||||||
if id > 0 {
|
if id != "" {
|
||||||
if *extensions == nil {
|
if *extensions == nil {
|
||||||
*extensions = openapi.Extensions{}
|
*extensions = openapi.Extensions{}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ func TestAnyJSON(t *testing.T) {
|
|||||||
} else if tc.inp == "null" && any != nil {
|
} else if tc.inp == "null" && any != nil {
|
||||||
t.Errorf("null has to parse as nil (but got %s)", any)
|
t.Errorf("null has to parse as nil (but got %s)", any)
|
||||||
} else {
|
} else {
|
||||||
t.Logf("%s => %s", tc.inp, any)
|
t.Logf("%s => %v", tc.inp, any)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,19 +4,13 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/patrickmn/go-cache"
|
|
||||||
"github.com/up9inc/mizu/agent/pkg/models"
|
"github.com/up9inc/mizu/agent/pkg/models"
|
||||||
"github.com/up9inc/mizu/shared"
|
"github.com/up9inc/mizu/shared"
|
||||||
"github.com/up9inc/mizu/tap"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const tlsLinkRetainmentTime = time.Minute * 15
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
authStatus *models.AuthStatus
|
authStatus *models.AuthStatus
|
||||||
RecentTLSLinks = cache.New(tlsLinkRetainmentTime, tlsLinkRetainmentTime)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetAuthStatus() (*models.AuthStatus, error) {
|
func GetAuthStatus() (*models.AuthStatus, error) {
|
||||||
@@ -51,16 +45,3 @@ func GetAuthStatus() (*models.AuthStatus, error) {
|
|||||||
|
|
||||||
return authStatus, nil
|
return authStatus, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetAllRecentTLSAddresses() []string {
|
|
||||||
recentTLSLinks := make([]string, 0)
|
|
||||||
|
|
||||||
for _, outboundLinkItem := range RecentTLSLinks.Items() {
|
|
||||||
outboundLink, castOk := outboundLinkItem.Object.(*tap.OutboundLink)
|
|
||||||
if castOk {
|
|
||||||
recentTLSLinks = append(recentTLSLinks, outboundLink.DstIP)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return recentTLSLinks
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -21,7 +21,5 @@ func StatusRoutes(ginApp *gin.Engine) {
|
|||||||
|
|
||||||
routeGroup.GET("/general", controllers.GetGeneralStats) // get general stats about entries in DB
|
routeGroup.GET("/general", controllers.GetGeneralStats) // get general stats about entries in DB
|
||||||
|
|
||||||
routeGroup.GET("/recentTLSLinks", controllers.GetRecentTLSLinks)
|
|
||||||
|
|
||||||
routeGroup.GET("/resolving", controllers.GetCurrentResolvingInformation)
|
routeGroup.GET("/resolving", controllers.GetCurrentResolvingInformation)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package servicemap
|
package servicemap
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/jinzhu/copier"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/up9inc/mizu/shared/logger"
|
"github.com/up9inc/mizu/shared/logger"
|
||||||
@@ -183,8 +184,12 @@ func (s *defaultServiceMap) NewTCPEntry(src *tapApi.TCP, dst *tapApi.TCP, p *tap
|
|||||||
if len(src.Name) == 0 {
|
if len(src.Name) == 0 {
|
||||||
srcEntry = &entryData{
|
srcEntry = &entryData{
|
||||||
key: key(src.IP),
|
key: key(src.IP),
|
||||||
entry: src,
|
entry: &tapApi.TCP{},
|
||||||
}
|
}
|
||||||
|
if err := copier.Copy(srcEntry.entry, src); err != nil {
|
||||||
|
logger.Log.Errorf("Error while copying src entry into src entry data")
|
||||||
|
}
|
||||||
|
|
||||||
srcEntry.entry.Name = UnresolvedNodeName
|
srcEntry.entry.Name = UnresolvedNodeName
|
||||||
} else {
|
} else {
|
||||||
srcEntry = &entryData{
|
srcEntry = &entryData{
|
||||||
@@ -196,8 +201,12 @@ func (s *defaultServiceMap) NewTCPEntry(src *tapApi.TCP, dst *tapApi.TCP, p *tap
|
|||||||
if len(dst.Name) == 0 {
|
if len(dst.Name) == 0 {
|
||||||
dstEntry = &entryData{
|
dstEntry = &entryData{
|
||||||
key: key(dst.IP),
|
key: key(dst.IP),
|
||||||
entry: dst,
|
entry: &tapApi.TCP{},
|
||||||
}
|
}
|
||||||
|
if err := copier.Copy(dstEntry.entry, dst); err != nil {
|
||||||
|
logger.Log.Errorf("Error while copying dst entry into dst entry data")
|
||||||
|
}
|
||||||
|
|
||||||
dstEntry.entry.Name = UnresolvedNodeName
|
dstEntry.entry.Name = UnresolvedNodeName
|
||||||
} else {
|
} else {
|
||||||
dstEntry = &entryData{
|
dstEntry = &entryData{
|
||||||
@@ -224,7 +233,8 @@ func (s *defaultServiceMap) GetStatus() ServiceMapStatus {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *defaultServiceMap) GetNodes() []ServiceMapNode {
|
func (s *defaultServiceMap) GetNodes() []ServiceMapNode {
|
||||||
var nodes []ServiceMapNode
|
nodes := []ServiceMapNode{}
|
||||||
|
|
||||||
for i, n := range s.graph.Nodes {
|
for i, n := range s.graph.Nodes {
|
||||||
nodes = append(nodes, ServiceMapNode{
|
nodes = append(nodes, ServiceMapNode{
|
||||||
Id: n.id,
|
Id: n.id,
|
||||||
@@ -234,11 +244,13 @@ func (s *defaultServiceMap) GetNodes() []ServiceMapNode {
|
|||||||
Count: n.count,
|
Count: n.count,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
return nodes
|
return nodes
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *defaultServiceMap) GetEdges() []ServiceMapEdge {
|
func (s *defaultServiceMap) GetEdges() []ServiceMapEdge {
|
||||||
var edges []ServiceMapEdge
|
edges := []ServiceMapEdge{}
|
||||||
|
|
||||||
for u, m := range s.graph.Edges {
|
for u, m := range s.graph.Edges {
|
||||||
for v := range m {
|
for v := range m {
|
||||||
for _, p := range s.graph.Edges[u][v].data {
|
for _, p := range s.graph.Edges[u][v].data {
|
||||||
@@ -263,6 +275,7 @@ func (s *defaultServiceMap) GetEdges() []ServiceMapEdge {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return edges
|
return edges
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -403,10 +403,10 @@ func (s *ServiceMapEnabledSuite) TestServiceMap() {
|
|||||||
assert.Equal(0, status.EdgeCount)
|
assert.Equal(0, status.EdgeCount)
|
||||||
|
|
||||||
// Nodes after reset
|
// Nodes after reset
|
||||||
assert.Equal([]ServiceMapNode(nil), nodes)
|
assert.Equal([]ServiceMapNode{}, nodes)
|
||||||
|
|
||||||
// Edges after reset
|
// Edges after reset
|
||||||
assert.Equal([]ServiceMapEdge(nil), edges)
|
assert.Equal([]ServiceMapEdge{}, edges)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestServiceMapSuite(t *testing.T) {
|
func TestServiceMapSuite(t *testing.T) {
|
||||||
|
|||||||
@@ -211,11 +211,15 @@ func syncEntriesImpl(token string, model string, envPrefix string, uploadInterva
|
|||||||
|
|
||||||
logger.Log.Infof("Getting entries from the database")
|
logger.Log.Infof("Getting entries from the database")
|
||||||
|
|
||||||
|
BasenineReconnect:
|
||||||
var connection *basenine.Connection
|
var connection *basenine.Connection
|
||||||
var err error
|
var err error
|
||||||
connection, err = basenine.NewConnection(shared.BasenineHost, shared.BaseninePort)
|
connection, err = basenine.NewConnection(shared.BasenineHost, shared.BaseninePort)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
logger.Log.Errorf("Can't establish a new connection to Basenine server: %v", err)
|
||||||
|
connection.Close()
|
||||||
|
time.Sleep(shared.BasenineReconnectInterval * time.Second)
|
||||||
|
goto BasenineReconnect
|
||||||
}
|
}
|
||||||
|
|
||||||
data := make(chan []byte)
|
data := make(chan []byte)
|
||||||
@@ -323,7 +327,12 @@ func syncEntriesImpl(token string, model string, envPrefix string, uploadInterva
|
|||||||
go handleMetaChannel(&wg, connection, meta)
|
go handleMetaChannel(&wg, connection, meta)
|
||||||
wg.Add(2)
|
wg.Add(2)
|
||||||
|
|
||||||
connection.Query(query, data, meta)
|
if err = connection.Query(query, data, meta); err != nil {
|
||||||
|
logger.Log.Errorf("Query mode call failed: %v", err)
|
||||||
|
connection.Close()
|
||||||
|
time.Sleep(shared.BasenineReconnectInterval * time.Second)
|
||||||
|
goto BasenineReconnect
|
||||||
|
}
|
||||||
|
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ require (
|
|||||||
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7
|
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7
|
||||||
github.com/spf13/cobra v1.3.0
|
github.com/spf13/cobra v1.3.0
|
||||||
github.com/spf13/pflag v1.0.5
|
github.com/spf13/pflag v1.0.5
|
||||||
github.com/up9inc/basenine/server/lib v0.0.0-20220326121918-785f3061c8ce
|
github.com/up9inc/basenine/server/lib v0.0.0-20220419100955-e2ca51087607
|
||||||
github.com/up9inc/mizu/shared v0.0.0
|
github.com/up9inc/mizu/shared v0.0.0
|
||||||
github.com/up9inc/mizu/tap/api v0.0.0
|
github.com/up9inc/mizu/tap/api v0.0.0
|
||||||
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8
|
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8
|
||||||
@@ -72,7 +72,7 @@ require (
|
|||||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||||
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
|
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
|
||||||
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
|
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
|
||||||
github.com/ohler55/ojg v1.12.13 // indirect
|
github.com/ohler55/ojg v1.14.0 // indirect
|
||||||
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
|
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
|
||||||
github.com/pkg/errors v0.9.1 // indirect
|
github.com/pkg/errors v0.9.1 // indirect
|
||||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||||
|
|||||||
@@ -487,8 +487,8 @@ github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWb
|
|||||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
||||||
github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78=
|
github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78=
|
||||||
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
|
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
|
||||||
github.com/ohler55/ojg v1.12.13 h1:FvfVpYzLgMraLcg3rrXiRXaihOP6fnzQNEU9YyZ/AmM=
|
github.com/ohler55/ojg v1.14.0 h1:DyHomsCwofNswmKj7BLMdx51xnKbXxgIo1rVWCaBcNk=
|
||||||
github.com/ohler55/ojg v1.12.13/go.mod h1:LBbIVRAgoFbYBXQhRhuEpaJIqq+goSO63/FQ+nyJU88=
|
github.com/ohler55/ojg v1.14.0/go.mod h1:3+GH+0PggMKocQtbZCrFifal3yRpHiBT4QUkxFJI6e8=
|
||||||
github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
|
github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
|
||||||
github.com/olekukonko/tablewriter v0.0.4/go.mod h1:zq6QwlOf5SlnkVbMSr5EoBv3636FWnp+qbPhuoO21uA=
|
github.com/olekukonko/tablewriter v0.0.4/go.mod h1:zq6QwlOf5SlnkVbMSr5EoBv3636FWnp+qbPhuoO21uA=
|
||||||
github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||||
@@ -600,8 +600,8 @@ github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69
|
|||||||
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
|
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
|
||||||
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM=
|
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM=
|
||||||
github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc=
|
github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc=
|
||||||
github.com/up9inc/basenine/server/lib v0.0.0-20220326121918-785f3061c8ce h1:PypqybjmuxftGkX4NmP4JAUyEykZj2r6W4r9lnRZ/kE=
|
github.com/up9inc/basenine/server/lib v0.0.0-20220419100955-e2ca51087607 h1:gCOwbfjsLslDw63yj/3l9d5TH7ikhIWHd7j0lE9U26U=
|
||||||
github.com/up9inc/basenine/server/lib v0.0.0-20220326121918-785f3061c8ce/go.mod h1:ZIkxWiJm65jYQIso9k+OZKhR7gQ1we2jNyE2kQX9IQI=
|
github.com/up9inc/basenine/server/lib v0.0.0-20220419100955-e2ca51087607/go.mod h1:v0hIh31iwDGbkkdeSSppdMNm1oIigfCA2mG2XajKnf8=
|
||||||
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
|
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
|
||||||
github.com/xlab/treeprint v0.0.0-20181112141820-a009c3971eca/go.mod h1:ce1O1j6UtZfjr22oyGxGLbauSBp2YVXpARAosm7dHBg=
|
github.com/xlab/treeprint v0.0.0-20181112141820-a009c3971eca/go.mod h1:ce1O1j6UtZfjr22oyGxGLbauSBp2YVXpARAosm7dHBg=
|
||||||
github.com/xlab/treeprint v1.1.0 h1:G/1DjNkPpfZCFt9CSh6b5/nY4VimlbHF3Rh4obvtzDk=
|
github.com/xlab/treeprint v1.1.0 h1:G/1DjNkPpfZCFt9CSh6b5/nY4VimlbHF3Rh4obvtzDk=
|
||||||
|
|||||||
@@ -1,19 +1,20 @@
|
|||||||
package shared
|
package shared
|
||||||
|
|
||||||
const (
|
const (
|
||||||
MizuFilteringOptionsEnvVar = "SENSITIVE_DATA_FILTERING_OPTIONS"
|
MizuFilteringOptionsEnvVar = "SENSITIVE_DATA_FILTERING_OPTIONS"
|
||||||
SyncEntriesConfigEnvVar = "SYNC_ENTRIES_CONFIG"
|
SyncEntriesConfigEnvVar = "SYNC_ENTRIES_CONFIG"
|
||||||
HostModeEnvVar = "HOST_MODE"
|
HostModeEnvVar = "HOST_MODE"
|
||||||
NodeNameEnvVar = "NODE_NAME"
|
NodeNameEnvVar = "NODE_NAME"
|
||||||
ConfigDirPath = "/app/config/"
|
ConfigDirPath = "/app/config/"
|
||||||
DataDirPath = "/app/data/"
|
DataDirPath = "/app/data/"
|
||||||
ValidationRulesFileName = "validation-rules.yaml"
|
ValidationRulesFileName = "validation-rules.yaml"
|
||||||
ContractFileName = "contract-oas.yaml"
|
ContractFileName = "contract-oas.yaml"
|
||||||
ConfigFileName = "mizu-config.json"
|
ConfigFileName = "mizu-config.json"
|
||||||
GoGCEnvVar = "GOGC"
|
GoGCEnvVar = "GOGC"
|
||||||
DefaultApiServerPort = 8899
|
DefaultApiServerPort = 8899
|
||||||
LogLevelEnvVar = "LOG_LEVEL"
|
LogLevelEnvVar = "LOG_LEVEL"
|
||||||
MizuAgentImageRepo = "docker.io/up9inc/mizu"
|
MizuAgentImageRepo = "docker.io/up9inc/mizu"
|
||||||
BasenineHost = "127.0.0.1"
|
BasenineHost = "127.0.0.1"
|
||||||
BaseninePort = "9099"
|
BaseninePort = "9099"
|
||||||
|
BasenineReconnectInterval = 3
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -329,7 +329,7 @@ func (tapperSyncer *MizuTapperSyncer) updateMizuTappers() error {
|
|||||||
TapperDaemonSetName,
|
TapperDaemonSetName,
|
||||||
tapperSyncer.config.AgentImage,
|
tapperSyncer.config.AgentImage,
|
||||||
TapperPodName,
|
TapperPodName,
|
||||||
fmt.Sprintf("%s.%s.svc.cluster.local", ApiServerPodName, tapperSyncer.config.MizuResourcesNamespace),
|
fmt.Sprintf("%s.%s.svc", ApiServerPodName, tapperSyncer.config.MizuResourcesNamespace),
|
||||||
nodeNames,
|
nodeNames,
|
||||||
serviceAccountName,
|
serviceAccountName,
|
||||||
tapperSyncer.config.TapperResources,
|
tapperSyncer.config.TapperResources,
|
||||||
|
|||||||
@@ -805,14 +805,20 @@ func (provider *Provider) ApplyMizuTapperDaemonSet(ctx context.Context, namespac
|
|||||||
agentResources := applyconfcore.ResourceRequirements().WithRequests(agentResourceRequests).WithLimits(agentResourceLimits)
|
agentResources := applyconfcore.ResourceRequirements().WithRequests(agentResourceRequests).WithLimits(agentResourceLimits)
|
||||||
agentContainer.WithResources(agentResources)
|
agentContainer.WithResources(agentResources)
|
||||||
|
|
||||||
nodeSelectorRequirement := applyconfcore.NodeSelectorRequirement()
|
matchFields := make([]*applyconfcore.NodeSelectorTermApplyConfiguration, 0)
|
||||||
nodeSelectorRequirement.WithKey("kubernetes.io/hostname")
|
for _, nodeName := range nodeNames {
|
||||||
nodeSelectorRequirement.WithOperator(core.NodeSelectorOpIn)
|
nodeSelectorRequirement := applyconfcore.NodeSelectorRequirement()
|
||||||
nodeSelectorRequirement.WithValues(nodeNames...)
|
nodeSelectorRequirement.WithKey("metadata.name")
|
||||||
nodeSelectorTerm := applyconfcore.NodeSelectorTerm()
|
nodeSelectorRequirement.WithOperator(core.NodeSelectorOpIn)
|
||||||
nodeSelectorTerm.WithMatchExpressions(nodeSelectorRequirement)
|
nodeSelectorRequirement.WithValues(nodeName)
|
||||||
|
|
||||||
|
nodeSelectorTerm := applyconfcore.NodeSelectorTerm()
|
||||||
|
nodeSelectorTerm.WithMatchFields(nodeSelectorRequirement)
|
||||||
|
matchFields = append(matchFields, nodeSelectorTerm)
|
||||||
|
}
|
||||||
|
|
||||||
nodeSelector := applyconfcore.NodeSelector()
|
nodeSelector := applyconfcore.NodeSelector()
|
||||||
nodeSelector.WithNodeSelectorTerms(nodeSelectorTerm)
|
nodeSelector.WithNodeSelectorTerms(matchFields...)
|
||||||
nodeAffinity := applyconfcore.NodeAffinity()
|
nodeAffinity := applyconfcore.NodeAffinity()
|
||||||
nodeAffinity.WithRequiredDuringSchedulingIgnoredDuringExecution(nodeSelector)
|
nodeAffinity.WithRequiredDuringSchedulingIgnoredDuringExecution(nodeSelector)
|
||||||
affinity := applyconfcore.Affinity()
|
affinity := applyconfcore.Affinity()
|
||||||
|
|||||||
@@ -26,7 +26,8 @@ func GetNodeHostToTappedPodsMap(tappedPods []core.Pod) shared.NodeToPodsMap {
|
|||||||
func getMinimizedPod(fullPod core.Pod) core.Pod {
|
func getMinimizedPod(fullPod core.Pod) core.Pod {
|
||||||
return core.Pod{
|
return core.Pod{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: fullPod.Name,
|
Name: fullPod.Name,
|
||||||
|
Namespace: fullPod.Namespace,
|
||||||
},
|
},
|
||||||
Status: core.PodStatus{
|
Status: core.PodStatus{
|
||||||
PodIP: fullPod.Status.PodIP,
|
PodIP: fullPod.Status.PodIP,
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ const (
|
|||||||
WebSocketMessageTypeUpdateStatus WebSocketMessageType = "status"
|
WebSocketMessageTypeUpdateStatus WebSocketMessageType = "status"
|
||||||
WebSocketMessageTypeUpdateTappedPods WebSocketMessageType = "tappedPods"
|
WebSocketMessageTypeUpdateTappedPods WebSocketMessageType = "tappedPods"
|
||||||
WebSocketMessageTypeAnalyzeStatus WebSocketMessageType = "analyzeStatus"
|
WebSocketMessageTypeAnalyzeStatus WebSocketMessageType = "analyzeStatus"
|
||||||
WebsocketMessageTypeOutboundLink WebSocketMessageType = "outboundLink"
|
|
||||||
WebSocketMessageTypeToast WebSocketMessageType = "toast"
|
WebSocketMessageTypeToast WebSocketMessageType = "toast"
|
||||||
WebSocketMessageTypeQueryMetadata WebSocketMessageType = "queryMetadata"
|
WebSocketMessageTypeQueryMetadata WebSocketMessageType = "queryMetadata"
|
||||||
WebSocketMessageTypeStartTime WebSocketMessageType = "startTime"
|
WebSocketMessageTypeStartTime WebSocketMessageType = "startTime"
|
||||||
@@ -92,7 +91,7 @@ func (np NodeToPodsMap) Summary() map[string][]string {
|
|||||||
summary := make(map[string][]string)
|
summary := make(map[string][]string)
|
||||||
for node, pods := range np {
|
for node, pods := range np {
|
||||||
for _, pod := range pods {
|
for _, pod := range pods {
|
||||||
summary[node] = append(summary[node], pod.Namespace + "/" + pod.Name)
|
summary[node] = append(summary[node], pod.Namespace+"/"+pod.Name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const mizuTestEnvVar = "MIZU_TEST"
|
const mizuTestEnvVar = "MIZU_TEST"
|
||||||
|
const UNKNOWN_NAMESPACE = ""
|
||||||
|
|
||||||
var UnknownIp net.IP = net.IP{0, 0, 0, 0}
|
var UnknownIp net.IP = net.IP{0, 0, 0, 0}
|
||||||
var UnknownPort uint16 = 0
|
var UnknownPort uint16 = 0
|
||||||
@@ -92,14 +93,15 @@ type RequestResponsePair struct {
|
|||||||
Response GenericMessage `json:"response"`
|
Response GenericMessage `json:"response"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// `Protocol` is modified in the later stages of data propagation. Therefore it's not a pointer.
|
|
||||||
type OutputChannelItem struct {
|
type OutputChannelItem struct {
|
||||||
|
// `Protocol` is modified in later stages of data propagation. Therefore, it's not a pointer.
|
||||||
Protocol Protocol
|
Protocol Protocol
|
||||||
Capture Capture
|
Capture Capture
|
||||||
Timestamp int64
|
Timestamp int64
|
||||||
ConnectionInfo *ConnectionInfo
|
ConnectionInfo *ConnectionInfo
|
||||||
Pair *RequestResponsePair
|
Pair *RequestResponsePair
|
||||||
Summary *BaseEntry
|
Summary *BaseEntry
|
||||||
|
Namespace string
|
||||||
}
|
}
|
||||||
|
|
||||||
type SuperTimer struct {
|
type SuperTimer struct {
|
||||||
@@ -156,12 +158,12 @@ func (e *Emitting) Emit(item *OutputChannelItem) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Entry struct {
|
type Entry struct {
|
||||||
Id uint `json:"id"`
|
Id string `json:"id"`
|
||||||
Protocol Protocol `json:"proto"`
|
Protocol Protocol `json:"proto"`
|
||||||
Capture Capture `json:"capture"`
|
Capture Capture `json:"capture"`
|
||||||
Source *TCP `json:"src"`
|
Source *TCP `json:"src"`
|
||||||
Destination *TCP `json:"dst"`
|
Destination *TCP `json:"dst"`
|
||||||
Namespace string `json:"namespace,omitempty"`
|
Namespace string `json:"namespace"`
|
||||||
Outgoing bool `json:"outgoing"`
|
Outgoing bool `json:"outgoing"`
|
||||||
Timestamp int64 `json:"timestamp"`
|
Timestamp int64 `json:"timestamp"`
|
||||||
StartTime time.Time `json:"startTime"`
|
StartTime time.Time `json:"startTime"`
|
||||||
@@ -188,7 +190,7 @@ type EntryWrapper struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type BaseEntry struct {
|
type BaseEntry struct {
|
||||||
Id uint `json:"id"`
|
Id string `json:"id"`
|
||||||
Protocol Protocol `json:"proto,omitempty"`
|
Protocol Protocol `json:"proto,omitempty"`
|
||||||
Capture Capture `json:"capture"`
|
Capture Capture `json:"capture"`
|
||||||
Summary string `json:"summary,omitempty"`
|
Summary string `json:"summary,omitempty"`
|
||||||
|
|||||||
@@ -13,4 +13,4 @@ test-pull-bin:
|
|||||||
|
|
||||||
test-pull-expect:
|
test-pull-expect:
|
||||||
@mkdir -p expect
|
@mkdir -p expect
|
||||||
@[ "${skipexpect}" ] && echo "Skipping downloading expected JSONs" || gsutil -o 'GSUtil:parallel_process_count=5' -o 'GSUtil:parallel_thread_count=5' -m cp -r gs://static.up9.io/mizu/test-pcap/expect5/amqp/\* expect
|
@[ "${skipexpect}" ] && echo "Skipping downloading expected JSONs" || gsutil -o 'GSUtil:parallel_process_count=5' -o 'GSUtil:parallel_thread_count=5' -m cp -r gs://static.up9.io/mizu/test-pcap/expect8/amqp/\* expect
|
||||||
|
|||||||
@@ -13,4 +13,4 @@ test-pull-bin:
|
|||||||
|
|
||||||
test-pull-expect:
|
test-pull-expect:
|
||||||
@mkdir -p expect
|
@mkdir -p expect
|
||||||
@[ "${skipexpect}" ] && echo "Skipping downloading expected JSONs" || gsutil -o 'GSUtil:parallel_process_count=5' -o 'GSUtil:parallel_thread_count=5' -m cp -r gs://static.up9.io/mizu/test-pcap/expect5/http/\* expect
|
@[ "${skipexpect}" ] && echo "Skipping downloading expected JSONs" || gsutil -o 'GSUtil:parallel_process_count=5' -o 'GSUtil:parallel_thread_count=5' -m cp -r gs://static.up9.io/mizu/test-pcap/expect8/http/\* expect
|
||||||
|
|||||||
@@ -28,26 +28,6 @@ const protoMinorHTTP2 = 0
|
|||||||
|
|
||||||
var maxHTTP2DataLen = 1 * 1024 * 1024 // 1MB
|
var maxHTTP2DataLen = 1 * 1024 * 1024 // 1MB
|
||||||
|
|
||||||
var grpcStatusCodes = []string{
|
|
||||||
"OK",
|
|
||||||
"CANCELLED",
|
|
||||||
"UNKNOWN",
|
|
||||||
"INVALID_ARGUMENT",
|
|
||||||
"DEADLINE_EXCEEDED",
|
|
||||||
"NOT_FOUND",
|
|
||||||
"ALREADY_EXISTS",
|
|
||||||
"PERMISSION_DENIED",
|
|
||||||
"RESOURCE_EXHAUSTED",
|
|
||||||
"FAILED_PRECONDITION",
|
|
||||||
"ABORTED",
|
|
||||||
"OUT_OF_RANGE",
|
|
||||||
"UNIMPLEMENTED",
|
|
||||||
"INTERNAL",
|
|
||||||
"UNAVAILABLE",
|
|
||||||
"DATA_LOSS",
|
|
||||||
"UNAUTHENTICATED",
|
|
||||||
}
|
|
||||||
|
|
||||||
type messageFragment struct {
|
type messageFragment struct {
|
||||||
headers []hpack.HeaderField
|
headers []hpack.HeaderField
|
||||||
data []byte
|
data []byte
|
||||||
@@ -142,18 +122,8 @@ func (ga *Http2Assembler) readMessage() (streamID uint32, messageHTTP1 interface
|
|||||||
|
|
||||||
// gRPC detection
|
// gRPC detection
|
||||||
grpcStatus := headersHTTP1.Get("Grpc-Status")
|
grpcStatus := headersHTTP1.Get("Grpc-Status")
|
||||||
if grpcStatus != "" {
|
if grpcStatus != "" || strings.Contains(headersHTTP1.Get("Content-Type"), "application/grpc") {
|
||||||
isGrpc = true
|
isGrpc = true
|
||||||
status = grpcStatus
|
|
||||||
}
|
|
||||||
|
|
||||||
if strings.Contains(headersHTTP1.Get("Content-Type"), "application/grpc") {
|
|
||||||
isGrpc = true
|
|
||||||
grpcPath := headersHTTP1.Get(":path")
|
|
||||||
pathSegments := strings.Split(grpcPath, "/")
|
|
||||||
if len(pathSegments) > 0 {
|
|
||||||
method = pathSegments[len(pathSegments)-1]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if method != "" {
|
if method != "" {
|
||||||
|
|||||||
@@ -248,11 +248,6 @@ func (d dissecting) Analyze(item *api.OutputChannelItem, resolvedSource string,
|
|||||||
reqDetails["_queryStringMerged"] = mapSliceMergeRepeatedKeys(reqDetails["_queryString"].([]interface{}))
|
reqDetails["_queryStringMerged"] = mapSliceMergeRepeatedKeys(reqDetails["_queryString"].([]interface{}))
|
||||||
reqDetails["queryString"] = mapSliceRebuildAsMap(reqDetails["_queryStringMerged"].([]interface{}))
|
reqDetails["queryString"] = mapSliceRebuildAsMap(reqDetails["_queryStringMerged"].([]interface{}))
|
||||||
|
|
||||||
statusCode := int(resDetails["status"].(float64))
|
|
||||||
if item.Protocol.Abbreviation == "gRPC" {
|
|
||||||
resDetails["statusText"] = grpcStatusCodes[statusCode]
|
|
||||||
}
|
|
||||||
|
|
||||||
elapsedTime := item.Pair.Response.CaptureTime.Sub(item.Pair.Request.CaptureTime).Round(time.Millisecond).Milliseconds()
|
elapsedTime := item.Pair.Response.CaptureTime.Sub(item.Pair.Request.CaptureTime).Round(time.Millisecond).Milliseconds()
|
||||||
if elapsedTime < 0 {
|
if elapsedTime < 0 {
|
||||||
elapsedTime = 0
|
elapsedTime = 0
|
||||||
|
|||||||
@@ -13,4 +13,4 @@ test-pull-bin:
|
|||||||
|
|
||||||
test-pull-expect:
|
test-pull-expect:
|
||||||
@mkdir -p expect
|
@mkdir -p expect
|
||||||
@[ "${skipexpect}" ] && echo "Skipping downloading expected JSONs" || gsutil -o 'GSUtil:parallel_process_count=5' -o 'GSUtil:parallel_thread_count=5' -m cp -r gs://static.up9.io/mizu/test-pcap/expect5/kafka/\* expect
|
@[ "${skipexpect}" ] && echo "Skipping downloading expected JSONs" || gsutil -o 'GSUtil:parallel_process_count=5' -o 'GSUtil:parallel_thread_count=5' -m cp -r gs://static.up9.io/mizu/test-pcap/expect8/kafka/\* expect
|
||||||
|
|||||||
@@ -13,4 +13,4 @@ test-pull-bin:
|
|||||||
|
|
||||||
test-pull-expect:
|
test-pull-expect:
|
||||||
@mkdir -p expect
|
@mkdir -p expect
|
||||||
@[ "${skipexpect}" ] && echo "Skipping downloading expected JSONs" || gsutil -o 'GSUtil:parallel_process_count=5' -o 'GSUtil:parallel_thread_count=5' -m cp -r gs://static.up9.io/mizu/test-pcap/expect5/redis/\* expect
|
@[ "${skipexpect}" ] && echo "Skipping downloading expected JSONs" || gsutil -o 'GSUtil:parallel_process_count=5' -o 'GSUtil:parallel_thread_count=5' -m cp -r gs://static.up9.io/mizu/test-pcap/expect8/redis/\* expect
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ module github.com/up9inc/mizu/tap
|
|||||||
go 1.17
|
go 1.17
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/bradleyfalzon/tlsx v0.0.0-20170624122154-28fd0e59bac4
|
|
||||||
github.com/cilium/ebpf v0.8.0
|
github.com/cilium/ebpf v0.8.0
|
||||||
github.com/go-errors/errors v1.4.2
|
github.com/go-errors/errors v1.4.2
|
||||||
github.com/google/gopacket v1.1.19
|
github.com/google/gopacket v1.1.19
|
||||||
|
|||||||
@@ -91,8 +91,6 @@ github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6r
|
|||||||
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
|
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
|
||||||
github.com/bketelsen/crypt v0.0.4/go.mod h1:aI6NrJ0pMGgvZKL1iVgXLnfIFJtfV+bKCoqOes/6LfM=
|
github.com/bketelsen/crypt v0.0.4/go.mod h1:aI6NrJ0pMGgvZKL1iVgXLnfIFJtfV+bKCoqOes/6LfM=
|
||||||
github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk=
|
github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk=
|
||||||
github.com/bradleyfalzon/tlsx v0.0.0-20170624122154-28fd0e59bac4 h1:NJOOlc6ZJjix0A1rAU+nxruZtR8KboG1848yqpIUo4M=
|
|
||||||
github.com/bradleyfalzon/tlsx v0.0.0-20170624122154-28fd0e59bac4/go.mod h1:DQPxZS994Ld1Y8uwnJT+dRL04XPD0cElP/pHH/zEBHM=
|
|
||||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||||
github.com/census-instrumentation/opencensus-proto v0.3.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
github.com/census-instrumentation/opencensus-proto v0.3.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||||
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
|
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
|
||||||
|
|||||||
@@ -29,21 +29,6 @@ func getLocalhostIPs() ([]string, error) {
|
|||||||
return myIPs, nil
|
return myIPs, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
//lint:ignore U1000 will be used in the future
|
|
||||||
func isPrivateIP(ipStr string) bool {
|
|
||||||
ip := net.ParseIP(ipStr)
|
|
||||||
if ip.IsLoopback() || ip.IsLinkLocalUnicast() || ip.IsLinkLocalMulticast() {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, block := range privateIPBlocks {
|
|
||||||
if block.Contains(ip) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
func initPrivateIPBlocks() {
|
func initPrivateIPBlocks() {
|
||||||
for _, cidr := range []string{
|
for _, cidr := range []string{
|
||||||
"127.0.0.0/8", // IPv4 loopback
|
"127.0.0.0/8", // IPv4 loopback
|
||||||
|
|||||||
@@ -1,39 +0,0 @@
|
|||||||
package tap
|
|
||||||
|
|
||||||
type OutboundLinkProtocol string
|
|
||||||
|
|
||||||
const (
|
|
||||||
TLSProtocol OutboundLinkProtocol = "tls"
|
|
||||||
)
|
|
||||||
|
|
||||||
type OutboundLink struct {
|
|
||||||
Src string
|
|
||||||
DstIP string
|
|
||||||
DstPort int
|
|
||||||
SuggestedResolvedName string
|
|
||||||
SuggestedProtocol OutboundLinkProtocol
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewOutboundLinkWriter() *OutboundLinkWriter {
|
|
||||||
return &OutboundLinkWriter{
|
|
||||||
OutChan: make(chan *OutboundLink),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
type OutboundLinkWriter struct {
|
|
||||||
OutChan chan *OutboundLink
|
|
||||||
}
|
|
||||||
|
|
||||||
func (olw *OutboundLinkWriter) WriteOutboundLink(src string, DstIP string, DstPort int, SuggestedResolvedName string, SuggestedProtocol OutboundLinkProtocol) {
|
|
||||||
olw.OutChan <- &OutboundLink{
|
|
||||||
Src: src,
|
|
||||||
DstIP: DstIP,
|
|
||||||
DstPort: DstPort,
|
|
||||||
SuggestedResolvedName: SuggestedResolvedName,
|
|
||||||
SuggestedProtocol: SuggestedProtocol,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (olw *OutboundLinkWriter) Stop() {
|
|
||||||
close(olw.OutChan)
|
|
||||||
}
|
|
||||||
@@ -27,9 +27,6 @@ import (
|
|||||||
|
|
||||||
const cleanPeriod = time.Second * 10
|
const cleanPeriod = time.Second * 10
|
||||||
|
|
||||||
//lint:ignore U1000 will be used in the future
|
|
||||||
var remoteOnlyOutboundPorts = []int{80, 443}
|
|
||||||
|
|
||||||
var maxcount = flag.Int64("c", -1, "Only grab this many packets, then exit")
|
var maxcount = flag.Int64("c", -1, "Only grab this many packets, then exit")
|
||||||
var decoder = flag.String("decoder", "", "Name of the decoder to use (default: guess from capture)")
|
var decoder = flag.String("decoder", "", "Name of the decoder to use (default: guess from capture)")
|
||||||
var statsevery = flag.Int("stats", 60, "Output statistics every N seconds")
|
var statsevery = flag.Int("stats", 60, "Output statistics every N seconds")
|
||||||
@@ -58,7 +55,7 @@ var tls = flag.Bool("tls", false, "Enable TLS tapper")
|
|||||||
var memprofile = flag.String("memprofile", "", "Write memory profile")
|
var memprofile = flag.String("memprofile", "", "Write memory profile")
|
||||||
|
|
||||||
type TapOpts struct {
|
type TapOpts struct {
|
||||||
HostMode bool
|
HostMode bool
|
||||||
}
|
}
|
||||||
|
|
||||||
var extensions []*api.Extension // global
|
var extensions []*api.Extension // global
|
||||||
@@ -68,24 +65,6 @@ var packetSourceManager *source.PacketSourceManager // global
|
|||||||
var mainPacketInputChan chan source.TcpPacketInfo // global
|
var mainPacketInputChan chan source.TcpPacketInfo // global
|
||||||
var tlsTapperInstance *tlstapper.TlsTapper // global
|
var tlsTapperInstance *tlstapper.TlsTapper // global
|
||||||
|
|
||||||
func inArrayInt(arr []int, valueToCheck int) bool {
|
|
||||||
for _, value := range arr {
|
|
||||||
if value == valueToCheck {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
func inArrayString(arr []string, valueToCheck string) bool {
|
|
||||||
for _, value := range arr {
|
|
||||||
if value == valueToCheck {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
func StartPassiveTapper(opts *TapOpts, outputItems chan *api.OutputChannelItem, extensionsRef []*api.Extension, options *api.TrafficFilteringOptions) {
|
func StartPassiveTapper(opts *TapOpts, outputItems chan *api.OutputChannelItem, extensionsRef []*api.Extension, options *api.TrafficFilteringOptions) {
|
||||||
extensions = extensionsRef
|
extensions = extensionsRef
|
||||||
filteringOptions = options
|
filteringOptions = options
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ const (
|
|||||||
MaxBufferedPagesTotalEnvVarName = "MAX_BUFFERED_PAGES_TOTAL"
|
MaxBufferedPagesTotalEnvVarName = "MAX_BUFFERED_PAGES_TOTAL"
|
||||||
MaxBufferedPagesPerConnectionEnvVarName = "MAX_BUFFERED_PAGES_PER_CONNECTION"
|
MaxBufferedPagesPerConnectionEnvVarName = "MAX_BUFFERED_PAGES_PER_CONNECTION"
|
||||||
TcpStreamChannelTimeoutMsEnvVarName = "TCP_STREAM_CHANNEL_TIMEOUT_MS"
|
TcpStreamChannelTimeoutMsEnvVarName = "TCP_STREAM_CHANNEL_TIMEOUT_MS"
|
||||||
|
CloseTimedoutTcpChannelsIntervalMsEnvVar = "CLOSE_TIMEDOUT_TCP_STREAM_CHANNELS_INTERVAL_MS"
|
||||||
MaxBufferedPagesTotalDefaultValue = 5000
|
MaxBufferedPagesTotalDefaultValue = 5000
|
||||||
MaxBufferedPagesPerConnectionDefaultValue = 5000
|
MaxBufferedPagesPerConnectionDefaultValue = 5000
|
||||||
TcpStreamChannelTimeoutMsDefaultValue = 10000
|
TcpStreamChannelTimeoutMsDefaultValue = 10000
|
||||||
|
|||||||
@@ -5,11 +5,12 @@ import (
|
|||||||
"runtime"
|
"runtime"
|
||||||
|
|
||||||
"github.com/up9inc/mizu/shared/logger"
|
"github.com/up9inc/mizu/shared/logger"
|
||||||
|
"github.com/up9inc/mizu/tap/api"
|
||||||
"github.com/vishvananda/netns"
|
"github.com/vishvananda/netns"
|
||||||
)
|
)
|
||||||
|
|
||||||
func newNetnsPacketSource(procfs string, pid string,
|
func newNetnsPacketSource(procfs string, pid string, interfaceName string,
|
||||||
interfaceName string, behaviour TcpPacketSourceBehaviour) (*tcpPacketSource, error) {
|
behaviour TcpPacketSourceBehaviour, origin api.Capture) (*tcpPacketSource, error) {
|
||||||
nsh, err := netns.GetFromPath(fmt.Sprintf("%s/%s/ns/net", procfs, pid))
|
nsh, err := netns.GetFromPath(fmt.Sprintf("%s/%s/ns/net", procfs, pid))
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -17,7 +18,7 @@ func newNetnsPacketSource(procfs string, pid string,
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
src, err := newPacketSourceFromNetnsHandle(pid, nsh, interfaceName, behaviour)
|
src, err := newPacketSourceFromNetnsHandle(pid, nsh, interfaceName, behaviour, origin)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Log.Errorf("Error starting netns packet source for %s - %w", pid, err)
|
logger.Log.Errorf("Error starting netns packet source for %s - %w", pid, err)
|
||||||
@@ -28,7 +29,7 @@ func newNetnsPacketSource(procfs string, pid string,
|
|||||||
}
|
}
|
||||||
|
|
||||||
func newPacketSourceFromNetnsHandle(pid string, nsh netns.NsHandle, interfaceName string,
|
func newPacketSourceFromNetnsHandle(pid string, nsh netns.NsHandle, interfaceName string,
|
||||||
behaviour TcpPacketSourceBehaviour) (*tcpPacketSource, error) {
|
behaviour TcpPacketSourceBehaviour, origin api.Capture) (*tcpPacketSource, error) {
|
||||||
|
|
||||||
done := make(chan *tcpPacketSource)
|
done := make(chan *tcpPacketSource)
|
||||||
errors := make(chan error)
|
errors := make(chan error)
|
||||||
@@ -57,7 +58,7 @@ func newPacketSourceFromNetnsHandle(pid string, nsh netns.NsHandle, interfaceNam
|
|||||||
}
|
}
|
||||||
|
|
||||||
name := fmt.Sprintf("netns-%s-%s", pid, interfaceName)
|
name := fmt.Sprintf("netns-%s-%s", pid, interfaceName)
|
||||||
src, err := newTcpPacketSource(name, "", interfaceName, behaviour)
|
src, err := newTcpPacketSource(name, "", interfaceName, behaviour, origin)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Log.Errorf("Error listening to PID %s - %w", pid, err)
|
logger.Log.Errorf("Error listening to PID %s - %w", pid, err)
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/up9inc/mizu/shared/logger"
|
"github.com/up9inc/mizu/shared/logger"
|
||||||
|
"github.com/up9inc/mizu/tap/api"
|
||||||
v1 "k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -37,10 +38,10 @@ func NewPacketSourceManager(procfs string, filename string, interfaceName string
|
|||||||
}
|
}
|
||||||
|
|
||||||
sourceManager.config = PacketSourceManagerConfig{
|
sourceManager.config = PacketSourceManagerConfig{
|
||||||
mtls: mtls,
|
mtls: mtls,
|
||||||
procfs: procfs,
|
procfs: procfs,
|
||||||
interfaceName: interfaceName,
|
interfaceName: interfaceName,
|
||||||
behaviour: behaviour,
|
behaviour: behaviour,
|
||||||
}
|
}
|
||||||
|
|
||||||
go hostSource.readPackets(ipdefrag, packets)
|
go hostSource.readPackets(ipdefrag, packets)
|
||||||
@@ -56,7 +57,7 @@ func newHostPacketSource(filename string, interfaceName string,
|
|||||||
name = fmt.Sprintf("file-%s", filename)
|
name = fmt.Sprintf("file-%s", filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
source, err := newTcpPacketSource(name, filename, interfaceName, behaviour)
|
source, err := newTcpPacketSource(name, filename, interfaceName, behaviour, api.Pcap)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -85,9 +86,9 @@ func (m *PacketSourceManager) updateMtlsPods(procfs string, pods []v1.Pod,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for pid := range relevantPids {
|
for pid, origin := range relevantPids {
|
||||||
if _, ok := m.sources[pid]; !ok {
|
if _, ok := m.sources[pid]; !ok {
|
||||||
source, err := newNetnsPacketSource(procfs, pid, interfaceName, behaviour)
|
source, err := newNetnsPacketSource(procfs, pid, interfaceName, behaviour, origin)
|
||||||
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
go source.readPackets(ipdefrag, packets)
|
go source.readPackets(ipdefrag, packets)
|
||||||
@@ -97,15 +98,15 @@ func (m *PacketSourceManager) updateMtlsPods(procfs string, pods []v1.Pod,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *PacketSourceManager) getRelevantPids(procfs string, pods []v1.Pod) map[string]bool {
|
func (m *PacketSourceManager) getRelevantPids(procfs string, pods []v1.Pod) map[string]api.Capture {
|
||||||
relevantPids := make(map[string]bool)
|
relevantPids := make(map[string]api.Capture)
|
||||||
relevantPids[hostSourcePid] = true
|
relevantPids[hostSourcePid] = api.Pcap
|
||||||
|
|
||||||
if envoyPids, err := discoverRelevantEnvoyPids(procfs, pods); err != nil {
|
if envoyPids, err := discoverRelevantEnvoyPids(procfs, pods); err != nil {
|
||||||
logger.Log.Warningf("Unable to discover envoy pids - %w", err)
|
logger.Log.Warningf("Unable to discover envoy pids - %w", err)
|
||||||
} else {
|
} else {
|
||||||
for _, pid := range envoyPids {
|
for _, pid := range envoyPids {
|
||||||
relevantPids[pid] = true
|
relevantPids[pid] = api.Envoy
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,7 +114,7 @@ func (m *PacketSourceManager) getRelevantPids(procfs string, pods []v1.Pod) map[
|
|||||||
logger.Log.Warningf("Unable to discover linkerd pids - %w", err)
|
logger.Log.Warningf("Unable to discover linkerd pids - %w", err)
|
||||||
} else {
|
} else {
|
||||||
for _, pid := range linkerdPids {
|
for _, pid := range linkerdPids {
|
||||||
relevantPids[pid] = true
|
relevantPids[pid] = api.Linkerd
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import (
|
|||||||
"github.com/google/gopacket/layers"
|
"github.com/google/gopacket/layers"
|
||||||
"github.com/google/gopacket/pcap"
|
"github.com/google/gopacket/pcap"
|
||||||
"github.com/up9inc/mizu/shared/logger"
|
"github.com/up9inc/mizu/shared/logger"
|
||||||
|
"github.com/up9inc/mizu/tap/api"
|
||||||
"github.com/up9inc/mizu/tap/diagnose"
|
"github.com/up9inc/mizu/tap/diagnose"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -19,6 +20,7 @@ type tcpPacketSource struct {
|
|||||||
defragger *ip4defrag.IPv4Defragmenter
|
defragger *ip4defrag.IPv4Defragmenter
|
||||||
Behaviour *TcpPacketSourceBehaviour
|
Behaviour *TcpPacketSourceBehaviour
|
||||||
name string
|
name string
|
||||||
|
Origin api.Capture
|
||||||
}
|
}
|
||||||
|
|
||||||
type TcpPacketSourceBehaviour struct {
|
type TcpPacketSourceBehaviour struct {
|
||||||
@@ -36,13 +38,14 @@ type TcpPacketInfo struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func newTcpPacketSource(name, filename string, interfaceName string,
|
func newTcpPacketSource(name, filename string, interfaceName string,
|
||||||
behaviour TcpPacketSourceBehaviour) (*tcpPacketSource, error) {
|
behaviour TcpPacketSourceBehaviour, origin api.Capture) (*tcpPacketSource, error) {
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
result := &tcpPacketSource{
|
result := &tcpPacketSource{
|
||||||
name: name,
|
name: name,
|
||||||
defragger: ip4defrag.NewIPv4Defragmenter(),
|
defragger: ip4defrag.NewIPv4Defragmenter(),
|
||||||
Behaviour: &behaviour,
|
Behaviour: &behaviour,
|
||||||
|
Origin: origin,
|
||||||
}
|
}
|
||||||
|
|
||||||
if filename != "" {
|
if filename != "" {
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ type tcpAssembler struct {
|
|||||||
// The assembler context
|
// The assembler context
|
||||||
type context struct {
|
type context struct {
|
||||||
CaptureInfo gopacket.CaptureInfo
|
CaptureInfo gopacket.CaptureInfo
|
||||||
|
Origin api.Capture
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *context) GetCaptureInfo() gopacket.CaptureInfo {
|
func (c *context) GetCaptureInfo() gopacket.CaptureInfo {
|
||||||
@@ -87,8 +88,10 @@ func (a *tcpAssembler) processPackets(dumpPacket bool, packets <-chan source.Tcp
|
|||||||
logger.Log.Fatalf("Failed to set network layer for checksum: %s", err)
|
logger.Log.Fatalf("Failed to set network layer for checksum: %s", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
c := context{
|
c := context{
|
||||||
CaptureInfo: packet.Metadata().CaptureInfo,
|
CaptureInfo: packet.Metadata().CaptureInfo,
|
||||||
|
Origin: packetInfo.Source.Origin,
|
||||||
}
|
}
|
||||||
diagnose.InternalStats.Totalsz += len(tcp.Payload)
|
diagnose.InternalStats.Totalsz += len(tcp.Payload)
|
||||||
a.assemblerMutex.Lock()
|
a.assemblerMutex.Lock()
|
||||||
|
|||||||
@@ -7,13 +7,10 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/bradleyfalzon/tlsx"
|
|
||||||
"github.com/up9inc/mizu/shared/logger"
|
"github.com/up9inc/mizu/shared/logger"
|
||||||
"github.com/up9inc/mizu/tap/api"
|
"github.com/up9inc/mizu/tap/api"
|
||||||
)
|
)
|
||||||
|
|
||||||
const checkTLSPacketAmount = 100
|
|
||||||
|
|
||||||
type tcpReaderDataMsg struct {
|
type tcpReaderDataMsg struct {
|
||||||
bytes []byte
|
bytes []byte
|
||||||
timestamp time.Time
|
timestamp time.Time
|
||||||
@@ -33,22 +30,21 @@ type ConnectionInfo struct {
|
|||||||
* Implements io.Reader interface (Read)
|
* Implements io.Reader interface (Read)
|
||||||
*/
|
*/
|
||||||
type tcpReader struct {
|
type tcpReader struct {
|
||||||
ident string
|
ident string
|
||||||
tcpID *api.TcpID
|
tcpID *api.TcpID
|
||||||
isClosed bool
|
isClosed bool
|
||||||
isClient bool
|
isClient bool
|
||||||
isOutgoing bool
|
isOutgoing bool
|
||||||
msgQueue chan tcpReaderDataMsg // Channel of captured reassembled tcp payload
|
msgQueue chan tcpReaderDataMsg // Channel of captured reassembled tcp payload
|
||||||
data []byte
|
data []byte
|
||||||
progress *api.ReadProgress
|
progress *api.ReadProgress
|
||||||
superTimer *api.SuperTimer
|
superTimer *api.SuperTimer
|
||||||
parent *tcpStream
|
parent *tcpStream
|
||||||
packetsSeen uint
|
packetsSeen uint
|
||||||
outboundLinkWriter *OutboundLinkWriter
|
extension *api.Extension
|
||||||
extension *api.Extension
|
emitter api.Emitter
|
||||||
emitter api.Emitter
|
counterPair *api.CounterPair
|
||||||
counterPair *api.CounterPair
|
reqResMatcher api.RequestResponseMatcher
|
||||||
reqResMatcher api.RequestResponseMatcher
|
|
||||||
sync.Mutex
|
sync.Mutex
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,16 +60,6 @@ func (h *tcpReader) Read(p []byte) (int, error) {
|
|||||||
if len(h.data) > 0 {
|
if len(h.data) > 0 {
|
||||||
h.packetsSeen += 1
|
h.packetsSeen += 1
|
||||||
}
|
}
|
||||||
if h.packetsSeen < checkTLSPacketAmount && len(msg.bytes) > 5 { // packets with less than 5 bytes cause tlsx to panic
|
|
||||||
clientHello := tlsx.ClientHello{}
|
|
||||||
err := clientHello.Unmarshall(msg.bytes)
|
|
||||||
if err == nil {
|
|
||||||
logger.Log.Debugf("Detected TLS client hello with SNI %s", clientHello.SNI)
|
|
||||||
// TODO: Throws `panic: runtime error: invalid memory address or nil pointer dereference` error.
|
|
||||||
// numericPort, _ := strconv.Atoi(h.tcpID.DstPort)
|
|
||||||
// h.outboundLinkWriter.WriteOutboundLink(h.tcpID.SrcIP, h.tcpID.DstIP, numericPort, clientHello.SNI, TLSProtocol)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if !ok || len(h.data) == 0 {
|
if !ok || len(h.data) == 0 {
|
||||||
return 0, io.EOF
|
return 0, io.EOF
|
||||||
@@ -98,8 +84,7 @@ func (h *tcpReader) Close() {
|
|||||||
func (h *tcpReader) run(wg *sync.WaitGroup) {
|
func (h *tcpReader) run(wg *sync.WaitGroup) {
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
b := bufio.NewReader(h)
|
b := bufio.NewReader(h)
|
||||||
// TODO: Add api.Pcap, api.Envoy and api.Linkerd distinction by refactoring NewPacketSourceManager method
|
err := h.extension.Dissector.Dissect(b, h.progress, h.parent.origin, h.isClient, h.tcpID, h.counterPair, h.superTimer, h.parent.superIdentifier, h.emitter, filteringOptions, h.reqResMatcher)
|
||||||
err := h.extension.Dissector.Dissect(b, h.progress, api.Pcap, h.isClient, h.tcpID, h.counterPair, h.superTimer, h.parent.superIdentifier, h.emitter, filteringOptions, h.reqResMatcher)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
_, err = io.Copy(ioutil.Discard, b)
|
_, err = io.Copy(ioutil.Discard, b)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ type tcpStream struct {
|
|||||||
clients []tcpReader
|
clients []tcpReader
|
||||||
servers []tcpReader
|
servers []tcpReader
|
||||||
ident string
|
ident string
|
||||||
|
origin api.Capture
|
||||||
sync.Mutex
|
sync.Mutex
|
||||||
streamsMap *tcpStreamMap
|
streamsMap *tcpStreamMap
|
||||||
}
|
}
|
||||||
@@ -70,6 +71,9 @@ func (t *tcpStream) Accept(tcp *layers.TCP, ci gopacket.CaptureInfo, dir reassem
|
|||||||
if !accept {
|
if !accept {
|
||||||
diagnose.InternalStats.RejectOpt++
|
diagnose.InternalStats.RejectOpt++
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*start = true
|
||||||
|
|
||||||
return accept
|
return accept
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,12 +20,11 @@ import (
|
|||||||
* Generates a new tcp stream for each new tcp connection. Closes the stream when the connection closes.
|
* Generates a new tcp stream for each new tcp connection. Closes the stream when the connection closes.
|
||||||
*/
|
*/
|
||||||
type tcpStreamFactory struct {
|
type tcpStreamFactory struct {
|
||||||
wg sync.WaitGroup
|
wg sync.WaitGroup
|
||||||
outboundLinkWriter *OutboundLinkWriter
|
Emitter api.Emitter
|
||||||
Emitter api.Emitter
|
streamsMap *tcpStreamMap
|
||||||
streamsMap *tcpStreamMap
|
ownIps []string
|
||||||
ownIps []string
|
opts *TapOpts
|
||||||
opts *TapOpts
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type tcpStreamWrapper struct {
|
type tcpStreamWrapper struct {
|
||||||
@@ -63,9 +62,6 @@ func (factory *tcpStreamFactory) New(net, transport gopacket.Flow, tcp *layers.T
|
|||||||
srcPort := transport.Src().String()
|
srcPort := transport.Src().String()
|
||||||
dstPort := transport.Dst().String()
|
dstPort := transport.Dst().String()
|
||||||
|
|
||||||
// if factory.shouldNotifyOnOutboundLink(dstIp, dstPort) {
|
|
||||||
// factory.outboundLinkWriter.WriteOutboundLink(net.Src().String(), dstIp, dstPort, "", "")
|
|
||||||
// }
|
|
||||||
props := factory.getStreamProps(srcIp, srcPort, dstIp, dstPort)
|
props := factory.getStreamProps(srcIp, srcPort, dstIp, dstPort)
|
||||||
isTapTarget := props.isTapTarget
|
isTapTarget := props.isTapTarget
|
||||||
stream := &tcpStream{
|
stream := &tcpStream{
|
||||||
@@ -78,6 +74,7 @@ func (factory *tcpStreamFactory) New(net, transport gopacket.Flow, tcp *layers.T
|
|||||||
optchecker: reassembly.NewTCPOptionCheck(),
|
optchecker: reassembly.NewTCPOptionCheck(),
|
||||||
superIdentifier: &api.SuperIdentifier{},
|
superIdentifier: &api.SuperIdentifier{},
|
||||||
streamsMap: factory.streamsMap,
|
streamsMap: factory.streamsMap,
|
||||||
|
origin: getPacketOrigin(ac),
|
||||||
}
|
}
|
||||||
if stream.isTapTarget {
|
if stream.isTapTarget {
|
||||||
stream.id = factory.streamsMap.nextId()
|
stream.id = factory.streamsMap.nextId()
|
||||||
@@ -98,14 +95,13 @@ func (factory *tcpStreamFactory) New(net, transport gopacket.Flow, tcp *layers.T
|
|||||||
SrcPort: srcPort,
|
SrcPort: srcPort,
|
||||||
DstPort: dstPort,
|
DstPort: dstPort,
|
||||||
},
|
},
|
||||||
parent: stream,
|
parent: stream,
|
||||||
isClient: true,
|
isClient: true,
|
||||||
isOutgoing: props.isOutgoing,
|
isOutgoing: props.isOutgoing,
|
||||||
outboundLinkWriter: factory.outboundLinkWriter,
|
extension: extension,
|
||||||
extension: extension,
|
emitter: factory.Emitter,
|
||||||
emitter: factory.Emitter,
|
counterPair: counterPair,
|
||||||
counterPair: counterPair,
|
reqResMatcher: reqResMatcher,
|
||||||
reqResMatcher: reqResMatcher,
|
|
||||||
})
|
})
|
||||||
stream.servers = append(stream.servers, tcpReader{
|
stream.servers = append(stream.servers, tcpReader{
|
||||||
msgQueue: make(chan tcpReaderDataMsg),
|
msgQueue: make(chan tcpReaderDataMsg),
|
||||||
@@ -118,14 +114,13 @@ func (factory *tcpStreamFactory) New(net, transport gopacket.Flow, tcp *layers.T
|
|||||||
SrcPort: transport.Dst().String(),
|
SrcPort: transport.Dst().String(),
|
||||||
DstPort: transport.Src().String(),
|
DstPort: transport.Src().String(),
|
||||||
},
|
},
|
||||||
parent: stream,
|
parent: stream,
|
||||||
isClient: false,
|
isClient: false,
|
||||||
isOutgoing: props.isOutgoing,
|
isOutgoing: props.isOutgoing,
|
||||||
outboundLinkWriter: factory.outboundLinkWriter,
|
extension: extension,
|
||||||
extension: extension,
|
emitter: factory.Emitter,
|
||||||
emitter: factory.Emitter,
|
counterPair: counterPair,
|
||||||
counterPair: counterPair,
|
reqResMatcher: reqResMatcher,
|
||||||
reqResMatcher: reqResMatcher,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
factory.streamsMap.Store(stream.id, &tcpStreamWrapper{
|
factory.streamsMap.Store(stream.id, &tcpStreamWrapper{
|
||||||
@@ -173,13 +168,15 @@ func (factory *tcpStreamFactory) getStreamProps(srcIP string, srcPort string, ds
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//lint:ignore U1000 will be used in the future
|
func getPacketOrigin(ac reassembly.AssemblerContext) api.Capture {
|
||||||
func (factory *tcpStreamFactory) shouldNotifyOnOutboundLink(dstIP string, dstPort int) bool {
|
c, ok := ac.(*context)
|
||||||
if inArrayInt(remoteOnlyOutboundPorts, dstPort) {
|
|
||||||
isDirectedHere := inArrayString(factory.ownIps, dstIP)
|
if !ok {
|
||||||
return !isDirectedHere && !isPrivateIP(dstIP)
|
// If ac is not our context, fallback to Pcap
|
||||||
|
return api.Pcap
|
||||||
}
|
}
|
||||||
return true
|
|
||||||
|
return c.Origin
|
||||||
}
|
}
|
||||||
|
|
||||||
type streamProps struct {
|
type streamProps struct {
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
package tap
|
package tap
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"os"
|
||||||
"runtime"
|
"runtime"
|
||||||
_debug "runtime/debug"
|
_debug "runtime/debug"
|
||||||
|
"strconv"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@@ -34,10 +36,35 @@ func (streamMap *tcpStreamMap) nextId() int64 {
|
|||||||
return streamMap.streamId
|
return streamMap.streamId
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (streamMap *tcpStreamMap) getCloseTimedoutTcpChannelsInterval() time.Duration {
|
||||||
|
defaultDuration := 1000 * time.Millisecond
|
||||||
|
rangeMin := 10
|
||||||
|
rangeMax := 10000
|
||||||
|
closeTimedoutTcpChannelsIntervalMsStr := os.Getenv(CloseTimedoutTcpChannelsIntervalMsEnvVar)
|
||||||
|
if closeTimedoutTcpChannelsIntervalMsStr == "" {
|
||||||
|
return defaultDuration
|
||||||
|
} else {
|
||||||
|
closeTimedoutTcpChannelsIntervalMs, err := strconv.Atoi(closeTimedoutTcpChannelsIntervalMsStr)
|
||||||
|
if err != nil {
|
||||||
|
logger.Log.Warningf("Error parsing environment variable %s: %v\n", CloseTimedoutTcpChannelsIntervalMsEnvVar, err)
|
||||||
|
return defaultDuration
|
||||||
|
} else {
|
||||||
|
if closeTimedoutTcpChannelsIntervalMs < rangeMin || closeTimedoutTcpChannelsIntervalMs > rangeMax {
|
||||||
|
logger.Log.Warningf("The value of environment variable %s is not in acceptable range: %d - %d\n", CloseTimedoutTcpChannelsIntervalMsEnvVar, rangeMin, rangeMax)
|
||||||
|
return defaultDuration
|
||||||
|
} else {
|
||||||
|
return time.Duration(closeTimedoutTcpChannelsIntervalMs) * time.Millisecond
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (streamMap *tcpStreamMap) closeTimedoutTcpStreamChannels() {
|
func (streamMap *tcpStreamMap) closeTimedoutTcpStreamChannels() {
|
||||||
tcpStreamChannelTimeout := GetTcpChannelTimeoutMs()
|
tcpStreamChannelTimeout := GetTcpChannelTimeoutMs()
|
||||||
|
closeTimedoutTcpChannelsIntervalMs := streamMap.getCloseTimedoutTcpChannelsInterval()
|
||||||
|
logger.Log.Infof("Using %d ms as the close timedout TCP stream channels interval", closeTimedoutTcpChannelsIntervalMs/time.Millisecond)
|
||||||
for {
|
for {
|
||||||
time.Sleep(10 * time.Millisecond)
|
time.Sleep(closeTimedoutTcpChannelsIntervalMs)
|
||||||
_debug.FreeOSMemory()
|
_debug.FreeOSMemory()
|
||||||
streamMap.streams.Range(func(key interface{}, value interface{}) bool {
|
streamMap.streams.Range(func(key interface{}, value interface{}) bool {
|
||||||
streamWrapper := value.(*tcpStreamWrapper)
|
streamWrapper := value.(*tcpStreamWrapper)
|
||||||
@@ -47,7 +74,7 @@ func (streamMap *tcpStreamMap) closeTimedoutTcpStreamChannels() {
|
|||||||
stream.Close()
|
stream.Close()
|
||||||
diagnose.AppStats.IncDroppedTcpStreams()
|
diagnose.AppStats.IncDroppedTcpStreams()
|
||||||
logger.Log.Debugf("Dropped an unidentified TCP stream because of timeout. Total dropped: %d Total Goroutines: %d Timeout (ms): %d",
|
logger.Log.Debugf("Dropped an unidentified TCP stream because of timeout. Total dropped: %d Total Goroutines: %d Timeout (ms): %d",
|
||||||
diagnose.AppStats.DroppedTcpStreams, runtime.NumGoroutine(), tcpStreamChannelTimeout/1000000)
|
diagnose.AppStats.DroppedTcpStreams, runtime.NumGoroutine(), tcpStreamChannelTimeout/time.Millisecond)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if !stream.superIdentifier.IsClosedOthers {
|
if !stream.superIdentifier.IsClosedOthers {
|
||||||
|
|||||||
13
tap/tlstapper/tls_emitter.go
Normal file
13
tap/tlstapper/tls_emitter.go
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
package tlstapper
|
||||||
|
|
||||||
|
import "github.com/up9inc/mizu/tap/api"
|
||||||
|
|
||||||
|
type tlsEmitter struct {
|
||||||
|
delegate api.Emitter
|
||||||
|
namespace string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *tlsEmitter) Emit(item *api.OutputChannelItem) {
|
||||||
|
item.Namespace = e.namespace
|
||||||
|
e.delegate.Emit(item)
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
|
"sync"
|
||||||
|
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
@@ -19,13 +20,14 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type tlsPoller struct {
|
type tlsPoller struct {
|
||||||
tls *TlsTapper
|
tls *TlsTapper
|
||||||
readers map[string]*tlsReader
|
readers map[string]*tlsReader
|
||||||
closedReaders chan string
|
closedReaders chan string
|
||||||
reqResMatcher api.RequestResponseMatcher
|
reqResMatcher api.RequestResponseMatcher
|
||||||
chunksReader *perf.Reader
|
chunksReader *perf.Reader
|
||||||
extension *api.Extension
|
extension *api.Extension
|
||||||
procfs string
|
procfs string
|
||||||
|
pidToNamespace sync.Map
|
||||||
}
|
}
|
||||||
|
|
||||||
func newTlsPoller(tls *TlsTapper, extension *api.Extension, procfs string) *tlsPoller {
|
func newTlsPoller(tls *TlsTapper, extension *api.Extension, procfs string) *tlsPoller {
|
||||||
@@ -151,16 +153,21 @@ func (p *tlsPoller) startNewTlsReader(chunk *tlsChunk, ip net.IP, port uint16, k
|
|||||||
|
|
||||||
tcpid := p.buildTcpId(chunk, ip, port)
|
tcpid := p.buildTcpId(chunk, ip, port)
|
||||||
|
|
||||||
go dissect(extension, reader, chunk.isRequest(), &tcpid, emitter, options, p.reqResMatcher)
|
tlsEmitter := &tlsEmitter{
|
||||||
|
delegate: emitter,
|
||||||
|
namespace: p.getNamespace(chunk.Pid),
|
||||||
|
}
|
||||||
|
|
||||||
|
go dissect(extension, reader, chunk.isRequest(), &tcpid, tlsEmitter, options, p.reqResMatcher)
|
||||||
return reader
|
return reader
|
||||||
}
|
}
|
||||||
|
|
||||||
func dissect(extension *api.Extension, reader *tlsReader, isRequest bool, tcpid *api.TcpID,
|
func dissect(extension *api.Extension, reader *tlsReader, isRequest bool, tcpid *api.TcpID,
|
||||||
emitter api.Emitter, options *api.TrafficFilteringOptions, reqResMatcher api.RequestResponseMatcher) {
|
tlsEmitter *tlsEmitter, options *api.TrafficFilteringOptions, reqResMatcher api.RequestResponseMatcher) {
|
||||||
b := bufio.NewReader(reader)
|
b := bufio.NewReader(reader)
|
||||||
|
|
||||||
err := extension.Dissector.Dissect(b, reader.progress, api.Ebpf, isRequest, tcpid, &api.CounterPair{},
|
err := extension.Dissector.Dissect(b, reader.progress, api.Ebpf, isRequest, tcpid, &api.CounterPair{},
|
||||||
&api.SuperTimer{}, &api.SuperIdentifier{}, emitter, options, reqResMatcher)
|
&api.SuperTimer{}, &api.SuperIdentifier{}, tlsEmitter, options, reqResMatcher)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Log.Warningf("Error dissecting TLS %v - %v", tcpid, err)
|
logger.Log.Warningf("Error dissecting TLS %v - %v", tcpid, err)
|
||||||
@@ -205,6 +212,33 @@ func (p *tlsPoller) buildTcpId(chunk *tlsChunk, ip net.IP, port uint16) api.TcpI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *tlsPoller) addPid(pid uint32, namespace string) {
|
||||||
|
p.pidToNamespace.Store(pid, namespace)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *tlsPoller) getNamespace(pid uint32) string {
|
||||||
|
namespaceIfc, ok := p.pidToNamespace.Load(pid)
|
||||||
|
|
||||||
|
if !ok {
|
||||||
|
return api.UNKNOWN_NAMESPACE
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace, ok := namespaceIfc.(string)
|
||||||
|
|
||||||
|
if !ok {
|
||||||
|
return api.UNKNOWN_NAMESPACE
|
||||||
|
}
|
||||||
|
|
||||||
|
return namespace
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *tlsPoller) clearPids() {
|
||||||
|
p.pidToNamespace.Range(func(key, v interface{}) bool {
|
||||||
|
p.pidToNamespace.Delete(key)
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
func (p *tlsPoller) logTls(chunk *tlsChunk, ip net.IP, port uint16) {
|
func (p *tlsPoller) logTls(chunk *tlsChunk, ip net.IP, port uint16) {
|
||||||
var flagsStr string
|
var flagsStr string
|
||||||
|
|
||||||
|
|||||||
@@ -24,11 +24,11 @@ func UpdateTapTargets(tls *TlsTapper, pods *[]v1.Pod, procfs string) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
tls.ClearPids()
|
tls.ClearPids()
|
||||||
|
|
||||||
for _, pid := range containerPids {
|
for pid, pod := range containerPids {
|
||||||
if err := tls.AddPid(procfs, pid); err != nil {
|
if err := tls.AddPid(procfs, pid, pod.Namespace); err != nil {
|
||||||
LogError(err)
|
LogError(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -36,8 +36,8 @@ func UpdateTapTargets(tls *TlsTapper, pods *[]v1.Pod, procfs string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func findContainerPids(procfs string, containerIds map[string]bool) ([]uint32, error) {
|
func findContainerPids(procfs string, containerIds map[string]v1.Pod) (map[uint32]v1.Pod, error) {
|
||||||
result := make([]uint32, 0)
|
result := make(map[uint32]v1.Pod)
|
||||||
|
|
||||||
pids, err := ioutil.ReadDir(procfs)
|
pids, err := ioutil.ReadDir(procfs)
|
||||||
|
|
||||||
@@ -63,7 +63,9 @@ func findContainerPids(procfs string, containerIds map[string]bool) ([]uint32, e
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, ok := containerIds[cgroup]; !ok {
|
pod, ok := containerIds[cgroup]
|
||||||
|
|
||||||
|
if !ok {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,14 +75,14 @@ func findContainerPids(procfs string, containerIds map[string]bool) ([]uint32, e
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
result = append(result, uint32(pidNumber))
|
result[uint32(pidNumber)] = pod
|
||||||
}
|
}
|
||||||
|
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func buildContainerIdsMap(pods *[]v1.Pod) map[string]bool {
|
func buildContainerIdsMap(pods *[]v1.Pod) map[string]v1.Pod {
|
||||||
result := make(map[string]bool)
|
result := make(map[string]v1.Pod)
|
||||||
|
|
||||||
for _, pod := range *pods {
|
for _, pod := range *pods {
|
||||||
for _, container := range pod.Status.ContainerStatuses {
|
for _, container := range pod.Status.ContainerStatuses {
|
||||||
@@ -91,7 +93,7 @@ func buildContainerIdsMap(pods *[]v1.Pod) map[string]bool {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
result[url.Host] = true
|
result[url.Host] = pod
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,14 +143,14 @@ func extractCgroup(lines []string) string {
|
|||||||
// /kubepods.slice/kubepods-burstable.slice/kubepods-burstable-pod3beae8e0_164d_4689_a087_efd902d8c2ab.slice/docker-<ID>.scope
|
// /kubepods.slice/kubepods-burstable.slice/kubepods-burstable-pod3beae8e0_164d_4689_a087_efd902d8c2ab.slice/docker-<ID>.scope
|
||||||
// /kubepods/besteffort/pod7709c1d5-447c-428f-bed9-8ddec35c93f4/<ID>
|
// /kubepods/besteffort/pod7709c1d5-447c-428f-bed9-8ddec35c93f4/<ID>
|
||||||
//
|
//
|
||||||
// This function extract the <ID> out of the cgroup path, the <ID> should match
|
// This function extract the <ID> out of the cgroup path, the <ID> should match
|
||||||
// the "Container ID:" field when running kubectl describe pod <POD>
|
// the "Container ID:" field when running kubectl describe pod <POD>
|
||||||
//
|
//
|
||||||
func normalizeCgroup(cgrouppath string) string {
|
func normalizeCgroup(cgrouppath string) string {
|
||||||
basename := strings.TrimSpace(path.Base(cgrouppath))
|
basename := strings.TrimSpace(path.Base(cgrouppath))
|
||||||
|
|
||||||
if strings.Contains(basename, "-") {
|
if strings.Contains(basename, "-") {
|
||||||
basename = basename[strings.Index(basename, "-") + 1:]
|
basename = basename[strings.Index(basename, "-")+1:]
|
||||||
}
|
}
|
||||||
|
|
||||||
if strings.Contains(basename, ".") {
|
if strings.Contains(basename, ".") {
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
package tlstapper
|
package tlstapper
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"sync"
|
||||||
|
|
||||||
"github.com/cilium/ebpf/rlimit"
|
"github.com/cilium/ebpf/rlimit"
|
||||||
"github.com/go-errors/errors"
|
"github.com/go-errors/errors"
|
||||||
"github.com/up9inc/mizu/shared/logger"
|
"github.com/up9inc/mizu/shared/logger"
|
||||||
"github.com/up9inc/mizu/tap/api"
|
"github.com/up9inc/mizu/tap/api"
|
||||||
"sync"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const GLOABL_TAP_PID = 0
|
const GLOABL_TAP_PID = 0
|
||||||
@@ -58,10 +59,10 @@ func (t *TlsTapper) PollForLogging() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (t *TlsTapper) GlobalTap(sslLibrary string) error {
|
func (t *TlsTapper) GlobalTap(sslLibrary string) error {
|
||||||
return t.tapPid(GLOABL_TAP_PID, sslLibrary)
|
return t.tapPid(GLOABL_TAP_PID, sslLibrary, api.UNKNOWN_NAMESPACE)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *TlsTapper) AddPid(procfs string, pid uint32) error {
|
func (t *TlsTapper) AddPid(procfs string, pid uint32, namespace string) error {
|
||||||
sslLibrary, err := findSsllib(procfs, pid)
|
sslLibrary, err := findSsllib(procfs, pid)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -69,7 +70,7 @@ func (t *TlsTapper) AddPid(procfs string, pid uint32) error {
|
|||||||
return nil // hide the error on purpose, its OK for a process to not use libssl.so
|
return nil // hide the error on purpose, its OK for a process to not use libssl.so
|
||||||
}
|
}
|
||||||
|
|
||||||
return t.tapPid(pid, sslLibrary)
|
return t.tapPid(pid, sslLibrary, namespace)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *TlsTapper) RemovePid(pid uint32) error {
|
func (t *TlsTapper) RemovePid(pid uint32) error {
|
||||||
@@ -85,12 +86,13 @@ func (t *TlsTapper) RemovePid(pid uint32) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (t *TlsTapper) ClearPids() {
|
func (t *TlsTapper) ClearPids() {
|
||||||
|
t.poller.clearPids()
|
||||||
t.registeredPids.Range(func(key, v interface{}) bool {
|
t.registeredPids.Range(func(key, v interface{}) bool {
|
||||||
pid := key.(uint32)
|
pid := key.(uint32)
|
||||||
if pid == GLOABL_TAP_PID {
|
if pid == GLOABL_TAP_PID {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := t.RemovePid(pid); err != nil {
|
if err := t.RemovePid(pid); err != nil {
|
||||||
LogError(err)
|
LogError(err)
|
||||||
}
|
}
|
||||||
@@ -133,7 +135,7 @@ func setupRLimit() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *TlsTapper) tapPid(pid uint32, sslLibrary string) error {
|
func (t *TlsTapper) tapPid(pid uint32, sslLibrary string, namespace string) error {
|
||||||
logger.Log.Infof("Tapping TLS (pid: %v) (sslLibrary: %v)", pid, sslLibrary)
|
logger.Log.Infof("Tapping TLS (pid: %v) (sslLibrary: %v)", pid, sslLibrary)
|
||||||
|
|
||||||
newSsl := sslHooks{}
|
newSsl := sslHooks{}
|
||||||
@@ -144,12 +146,14 @@ func (t *TlsTapper) tapPid(pid uint32, sslLibrary string) error {
|
|||||||
|
|
||||||
t.sslHooksStructs = append(t.sslHooksStructs, newSsl)
|
t.sslHooksStructs = append(t.sslHooksStructs, newSsl)
|
||||||
|
|
||||||
|
t.poller.addPid(pid, namespace)
|
||||||
|
|
||||||
pids := t.bpfObjects.tlsTapperMaps.PidsMap
|
pids := t.bpfObjects.tlsTapperMaps.PidsMap
|
||||||
|
|
||||||
if err := pids.Put(pid, uint32(1)); err != nil {
|
if err := pids.Put(pid, uint32(1)); err != nil {
|
||||||
return errors.Wrap(err, 0)
|
return errors.Wrap(err, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
t.registeredPids.Store(pid, true)
|
t.registeredPids.Store(pid, true)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@@ -54,11 +54,6 @@ export default class Api {
|
|||||||
return response.data;
|
return response.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
getRecentTLSLinks = async () => {
|
|
||||||
const response = await client.get("/status/recentTLSLinks");
|
|
||||||
return response.data;
|
|
||||||
}
|
|
||||||
|
|
||||||
getOasServices = async () => {
|
getOasServices = async () => {
|
||||||
const response = await client.get("/oas");
|
const response = await client.get("/oas");
|
||||||
return response.data;
|
return response.data;
|
||||||
@@ -121,4 +116,4 @@ export function getWebsocketUrl(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
return websocketUrl;
|
return websocketUrl;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,15 +26,16 @@
|
|||||||
"@material-ui/core": "^4.11.3",
|
"@material-ui/core": "^4.11.3",
|
||||||
"@material-ui/icons": "^4.11.2",
|
"@material-ui/icons": "^4.11.2",
|
||||||
"@material-ui/lab": "^4.0.0-alpha.60",
|
"@material-ui/lab": "^4.0.0-alpha.60",
|
||||||
|
"@types/jest": "^26.0.22",
|
||||||
|
"@types/node": "^12.20.10",
|
||||||
"node-sass": "^6.0.0",
|
"node-sass": "^6.0.0",
|
||||||
"react": "^17.0.2",
|
"react": "^17.0.2",
|
||||||
"react-dom": "^17.0.2",
|
|
||||||
"recoil": "^0.5.2",
|
|
||||||
"react-copy-to-clipboard": "^5.0.3",
|
"react-copy-to-clipboard": "^5.0.3",
|
||||||
"@types/jest": "^26.0.22",
|
"react-dom": "^17.0.2",
|
||||||
"@types/node": "^12.20.10"
|
"recoil": "^0.5.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@craco/craco": "^6.4.3",
|
||||||
"@types/lodash": "^4.14.179",
|
"@types/lodash": "^4.14.179",
|
||||||
"@uiw/react-textarea-code-editor": "^1.4.12",
|
"@uiw/react-textarea-code-editor": "^1.4.12",
|
||||||
"axios": "^0.25.0",
|
"axios": "^0.25.0",
|
||||||
@@ -48,8 +49,7 @@
|
|||||||
"moment": "^2.29.1",
|
"moment": "^2.29.1",
|
||||||
"node-fetch": "^3.1.1",
|
"node-fetch": "^3.1.1",
|
||||||
"numeral": "^2.0.6",
|
"numeral": "^2.0.6",
|
||||||
"protobuf-decoder": "^0.1.0",
|
"protobuf-decoder": "^0.1.2",
|
||||||
"react-resizable": "^3.0.4",
|
|
||||||
"react-graph-vis": "^1.0.7",
|
"react-graph-vis": "^1.0.7",
|
||||||
"react-lowlight": "^3.0.0",
|
"react-lowlight": "^3.0.0",
|
||||||
"react-router-dom": "^6.2.1",
|
"react-router-dom": "^6.2.1",
|
||||||
@@ -59,8 +59,7 @@
|
|||||||
"redoc": "^2.0.0-rc.59",
|
"redoc": "^2.0.0-rc.59",
|
||||||
"styled-components": "^5.3.3",
|
"styled-components": "^5.3.3",
|
||||||
"web-vitals": "^1.1.1",
|
"web-vitals": "^1.1.1",
|
||||||
"xml-formatter": "^2.6.0",
|
"xml-formatter": "^2.6.0"
|
||||||
"@craco/craco": "^6.4.3"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@rollup/plugin-node-resolve": "^13.1.3",
|
"@rollup/plugin-node-resolve": "^13.1.3",
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import openApiLogo from 'assets/openApiLogo.png'
|
|||||||
import { redocThemeOptions } from "./redocThemeOptions";
|
import { redocThemeOptions } from "./redocThemeOptions";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { Select } from "../UI/Select";
|
import { Select } from "../UI/Select";
|
||||||
|
import { TOAST_CONTAINER_ID } from "../../configs/Consts";
|
||||||
|
|
||||||
|
|
||||||
const modalStyle = {
|
const modalStyle = {
|
||||||
@@ -43,7 +44,7 @@ const OasModal = ({ openModal, handleCloseModal, getOasServices, getOasByService
|
|||||||
const data = await getOasByService(selectedService ? selectedService : oasServices[0]);
|
const data = await getOasByService(selectedService ? selectedService : oasServices[0]);
|
||||||
setSelectedServiceSpec(data);
|
setSelectedServiceSpec(data);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
toast.error("Error occurred while fetching service OAS spec");
|
toast.error("Error occurred while fetching service OAS spec", { containerId: TOAST_CONTAINER_ID });
|
||||||
console.error(e);
|
console.error(e);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
.modalContainer
|
.modalContainer
|
||||||
display: flex
|
display: flex
|
||||||
flex-wrap: nowrap
|
|
||||||
width: 100%
|
width: 100%
|
||||||
height: 100%
|
height: 100%
|
||||||
|
|
||||||
@@ -11,8 +10,6 @@
|
|||||||
|
|
||||||
.filterSection
|
.filterSection
|
||||||
flex: 15%
|
flex: 15%
|
||||||
border-right: 1px solid $blue-color
|
|
||||||
margin-right: 2%
|
|
||||||
height: 100%
|
height: 100%
|
||||||
|
|
||||||
.filters table
|
.filters table
|
||||||
@@ -38,6 +35,7 @@
|
|||||||
display: flex
|
display: flex
|
||||||
flex-direction: column
|
flex-direction: column
|
||||||
margin-right: 10px
|
margin-right: 10px
|
||||||
|
width: 100%
|
||||||
|
|
||||||
.servicesFilterSearch
|
.servicesFilterSearch
|
||||||
width: calc(100% - 10px)
|
width: calc(100% - 10px)
|
||||||
@@ -47,13 +45,13 @@
|
|||||||
margin-bottom: 5px
|
margin-bottom: 5px
|
||||||
|
|
||||||
.servicesFilter
|
.servicesFilter
|
||||||
margin-top: clamp(25px,15%,35px)
|
margin-top: 15px
|
||||||
height: 100%
|
height: 100%
|
||||||
overflow: hidden
|
overflow: hidden
|
||||||
|
|
||||||
& .servicesFilterList
|
& .servicesFilterList
|
||||||
overflow-y: auto
|
overflow-y: auto
|
||||||
height: 92%
|
height: calc(100% - 30px - 5px)
|
||||||
|
|
||||||
.separtorLine
|
.separtorLine
|
||||||
margin-top: 10px
|
margin-top: 10px
|
||||||
|
|||||||
@@ -12,9 +12,9 @@ import closeIcon from "assets/close.svg"
|
|||||||
import styles from './ServiceMapModal.module.sass'
|
import styles from './ServiceMapModal.module.sass'
|
||||||
import SelectList from "../UI/SelectList";
|
import SelectList from "../UI/SelectList";
|
||||||
import { GraphData, ServiceMapGraph } from "./ServiceMapModalTypes"
|
import { GraphData, ServiceMapGraph } from "./ServiceMapModalTypes"
|
||||||
import { ResizableBox } from "react-resizable"
|
|
||||||
import "react-resizable/css/styles.css"
|
|
||||||
import { Utils } from "../../helpers/Utils";
|
import { Utils } from "../../helpers/Utils";
|
||||||
|
import { TOAST_CONTAINER_ID } from "../../configs/Consts";
|
||||||
|
import Resizeable from "../UI/Resizeable"
|
||||||
|
|
||||||
const modalStyle = {
|
const modalStyle = {
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
@@ -46,12 +46,12 @@ const LegentLabel: React.FC<LegentLabelProps> = ({ color, name }) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const protocols = [
|
const protocols = [
|
||||||
{ key: "http", value: "HTTP", component: <LegentLabel color="#205cf5" name="HTTP" /> },
|
{ key: "HTTP", value: "HTTP", component: <LegentLabel color="#205cf5" name="HTTP" /> },
|
||||||
{ key: "http/2", value: "HTTP/2", component: <LegentLabel color='#244c5a' name="HTTP/2" /> },
|
{ key: "HTTP/2", value: "HTTP/2", component: <LegentLabel color='#244c5a' name="HTTP/2" /> },
|
||||||
{ key: "grpc", value: "gRPC", component: <LegentLabel color='#244c5a' name="gRPC" /> },
|
{ key: "gRPC", value: "gRPC", component: <LegentLabel color='#244c5a' name="gRPC" /> },
|
||||||
{ key: "amqp", value: "AMQP", component: <LegentLabel color='#ff6600' name="AMQP" /> },
|
{ key: "AMQP", value: "AMQP", component: <LegentLabel color='#ff6600' name="AMQP" /> },
|
||||||
{ key: "kafka", value: "KAFKA", component: <LegentLabel color='#000000' name="KAFKA" /> },
|
{ key: "KAFKA", value: "KAFKA", component: <LegentLabel color='#000000' name="KAFKA" /> },
|
||||||
{ key: "redis", value: "REDIS", component: <LegentLabel color='#a41e11' name="REDIS" /> },]
|
{ key: "REDIS", value: "REDIS", component: <LegentLabel color='#a41e11' name="REDIS" /> },]
|
||||||
|
|
||||||
|
|
||||||
interface ServiceMapModalProps {
|
interface ServiceMapModalProps {
|
||||||
@@ -65,8 +65,8 @@ export const ServiceMapModal: React.FC<ServiceMapModalProps> = ({ isOpen, onClos
|
|||||||
const commonClasses = useCommonStyles();
|
const commonClasses = useCommonStyles();
|
||||||
const [isLoading, setIsLoading] = useState<boolean>(true);
|
const [isLoading, setIsLoading] = useState<boolean>(true);
|
||||||
const [graphData, setGraphData] = useState<GraphData>({ nodes: [], edges: [] });
|
const [graphData, setGraphData] = useState<GraphData>({ nodes: [], edges: [] });
|
||||||
const [filteredProtocols, setFilteredProtocols] = useState(protocols.map(x => x.key))
|
const [checkedProtocols, setCheckedProtocols] = useState(protocols.map(x => x.key))
|
||||||
const [filteredServices, setFilteredServices] = useState([])
|
const [checkedServices, setCheckedServices] = useState([])
|
||||||
const [serviceMapApiData, setServiceMapApiData] = useState<ServiceMapGraph>({ edges: [], nodes: [] })
|
const [serviceMapApiData, setServiceMapApiData] = useState<ServiceMapGraph>({ edges: [], nodes: [] })
|
||||||
const [servicesSearchVal, setServicesSearchVal] = useState("")
|
const [servicesSearchVal, setServicesSearchVal] = useState("")
|
||||||
const [graphOptions, setGraphOptions] = useState(ServiceMapOptions);
|
const [graphOptions, setGraphOptions] = useState(ServiceMapOptions);
|
||||||
@@ -89,7 +89,7 @@ export const ServiceMapModal: React.FC<ServiceMapModalProps> = ({ isOpen, onClos
|
|||||||
|
|
||||||
setGraphData(newGraphData)
|
setGraphData(newGraphData)
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
toast.error("An error occurred while loading Mizu Service Map, see console for mode details");
|
toast.error("An error occurred while loading Mizu Service Map, see console for mode details", { containerId: TOAST_CONTAINER_ID });
|
||||||
console.error(ex);
|
console.error(ex);
|
||||||
} finally {
|
} finally {
|
||||||
setIsLoading(false)
|
setIsLoading(false)
|
||||||
@@ -131,21 +131,20 @@ export const ServiceMapModal: React.FC<ServiceMapModalProps> = ({ isOpen, onClos
|
|||||||
}, [serviceMapApiData])
|
}, [serviceMapApiData])
|
||||||
|
|
||||||
const filterServiceMap = (newProtocolsFilters?: any[], newServiceFilters?: string[]) => {
|
const filterServiceMap = (newProtocolsFilters?: any[], newServiceFilters?: string[]) => {
|
||||||
const filterProt = newProtocolsFilters || filteredProtocols
|
const filterProt = newProtocolsFilters || checkedProtocols
|
||||||
const filterService = newServiceFilters || filteredServices || getServicesForFilter.map(x => x.key)
|
const filterService = newServiceFilters || checkedServices
|
||||||
setFilteredProtocols(filterProt)
|
setCheckedProtocols(filterProt)
|
||||||
setFilteredServices(filterService)
|
setCheckedServices(filterService)
|
||||||
const newGraphData: GraphData = {
|
const newGraphData: GraphData = {
|
||||||
nodes: serviceMapApiData.nodes?.map(mapNodesDatatoGraph).filter(node => filterService.includes(node.label)),
|
nodes: serviceMapApiData.nodes?.map(mapNodesDatatoGraph).filter(node => filterService.includes(node.label)),
|
||||||
edges: serviceMapApiData.edges?.filter(edge => filterProt.includes(edge.protocol.name)).map(mapEdgesDatatoGraph)
|
edges: serviceMapApiData.edges?.filter(edge => filterProt.includes(edge.protocol.abbr)).map(mapEdgesDatatoGraph)
|
||||||
}
|
}
|
||||||
setGraphData(newGraphData);
|
setGraphData(newGraphData);
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const resolvedServices = getServicesForFilter.map(x => x.key).filter(serviceName => !Utils.isIpAddress(serviceName))
|
if (checkedServices.length > 0) return // only after refresh
|
||||||
setFilteredServices(resolvedServices)
|
filterServiceMap(checkedProtocols, getServicesForFilter.map(x => x.key).filter(serviceName => !Utils.isIpAddress(serviceName)))
|
||||||
filterServiceMap(filteredProtocols, resolvedServices)
|
|
||||||
}, [getServicesForFilter])
|
}, [getServicesForFilter])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -176,28 +175,27 @@ export const ServiceMapModal: React.FC<ServiceMapModalProps> = ({ isOpen, onClos
|
|||||||
<Fade in={isOpen}>
|
<Fade in={isOpen}>
|
||||||
<Box sx={modalStyle}>
|
<Box sx={modalStyle}>
|
||||||
<div className={styles.modalContainer}>
|
<div className={styles.modalContainer}>
|
||||||
{/* TODO: remove error missing height */}
|
<div className={styles.filterSection}>
|
||||||
<ResizableBox width={200} style={{ height: '100%', minWidth: "200px" }} axis={"x"}>
|
<Resizeable minWidth={170}>
|
||||||
<div className={styles.filterSection}>
|
|
||||||
<div className={styles.filterWrapper}>
|
<div className={styles.filterWrapper}>
|
||||||
<div className={styles.protocolsFilterList}>
|
<div className={styles.protocolsFilterList}>
|
||||||
<SelectList items={protocols} checkBoxWidth="5%" tableName={"Protocols"} multiSelect={true}
|
<SelectList items={protocols} checkBoxWidth="5%" tableName={"Protocols"} multiSelect={true}
|
||||||
checkedValues={filteredProtocols} setCheckedValues={filterServiceMap} tableClassName={styles.filters} />
|
checkedValues={checkedProtocols} setCheckedValues={filterServiceMap} tableClassName={styles.filters} />
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.separtorLine}></div>
|
<div className={styles.separtorLine}></div>
|
||||||
<div className={styles.servicesFilter}>
|
<div className={styles.servicesFilter}>
|
||||||
<input className={commonClasses.textField + ` ${styles.servicesFilterSearch}`} placeholder="search service" value={servicesSearchVal} onChange={(event) => setServicesSearchVal(event.target.value)} />
|
<input className={commonClasses.textField + ` ${styles.servicesFilterSearch}`} placeholder="search service" value={servicesSearchVal} onChange={(event) => setServicesSearchVal(event.target.value)} />
|
||||||
<div className={styles.servicesFilterList}>
|
<div className={styles.servicesFilterList}>
|
||||||
<SelectList items={getServicesForFilter} tableName={"Services"} tableClassName={styles.filters} multiSelect={true} searchValue={servicesSearchVal}
|
<SelectList items={getServicesForFilter} tableName={"Services"} tableClassName={styles.filters} multiSelect={true} searchValue={servicesSearchVal}
|
||||||
checkBoxWidth="5%" checkedValues={filteredServices} setCheckedValues={(newServicesForFilter) => filterServiceMap(null, newServicesForFilter)} />
|
checkBoxWidth="5%" checkedValues={checkedServices} setCheckedValues={(newServicesForFilter) => filterServiceMap(null, newServicesForFilter)} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</Resizeable>
|
||||||
</ResizableBox>
|
</div>
|
||||||
<div className={styles.graphSection}>
|
<div className={styles.graphSection}>
|
||||||
<div style={{ display: "flex", justifyContent: "space-between" }}>
|
<div style={{ display: "flex", justifyContent: "space-between" }}>
|
||||||
<Button style={{ marginRight: "3%" }}
|
<Button style={{ marginLeft: "3%" }}
|
||||||
startIcon={<img src={refreshIcon} className="custom" alt="refresh" style={{ marginRight: "8%" }}></img>}
|
startIcon={<img src={refreshIcon} className="custom" alt="refresh" style={{ marginRight: "8%" }}></img>}
|
||||||
size="medium"
|
size="medium"
|
||||||
variant="contained"
|
variant="contained"
|
||||||
@@ -206,7 +204,7 @@ export const ServiceMapModal: React.FC<ServiceMapModalProps> = ({ isOpen, onClos
|
|||||||
>
|
>
|
||||||
Refresh
|
Refresh
|
||||||
</Button>
|
</Button>
|
||||||
<img src={closeIcon} alt="close" onClick={() => onClose()} style={{ cursor: "pointer" }}></img>
|
<img src={closeIcon} alt="close" onClick={() => onClose()} style={{ cursor: "pointer", userSelect: "none" }}></img>
|
||||||
</div>
|
</div>
|
||||||
{isLoading && <div className={spinnerStyle.spinnerContainer}>
|
{isLoading && <div className={spinnerStyle.spinnerContainer}>
|
||||||
<img alt="spinner" src={spinnerImg} style={{ height: 50 }} />
|
<img alt="spinner" src={spinnerImg} style={{ height: 50 }} />
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
.httpsDomains
|
|
||||||
display: none
|
|
||||||
margin: 0
|
|
||||||
padding: 0
|
|
||||||
list-style: none
|
|
||||||
|
|
||||||
.customWarningStyle
|
|
||||||
&:hover
|
|
||||||
overflow-y: scroll
|
|
||||||
height: 85px
|
|
||||||
.httpsDomains
|
|
||||||
display: block
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
import {Snackbar} from "@material-ui/core";
|
|
||||||
import MuiAlert from "@material-ui/lab/Alert";
|
|
||||||
import React, {useEffect} from "react";
|
|
||||||
import { RecoilState, useRecoilValue } from "recoil";
|
|
||||||
import TrafficViewerApiAtom from "../../recoil/TrafficViewerApi/atom";
|
|
||||||
import TrafficViewerApi from "../TrafficViewer/TrafficViewerApi";
|
|
||||||
import './TLSWarning.sass';
|
|
||||||
|
|
||||||
interface TLSWarningProps {
|
|
||||||
showTLSWarning: boolean
|
|
||||||
setShowTLSWarning: (show: boolean) => void
|
|
||||||
addressesWithTLS: Set<string>
|
|
||||||
setAddressesWithTLS: (addresses: Set<string>) => void
|
|
||||||
userDismissedTLSWarning: boolean
|
|
||||||
setUserDismissedTLSWarning: (flag: boolean) => void
|
|
||||||
}
|
|
||||||
|
|
||||||
export const TLSWarning: React.FC<TLSWarningProps> = ({showTLSWarning, setShowTLSWarning, addressesWithTLS, setAddressesWithTLS, userDismissedTLSWarning, setUserDismissedTLSWarning}) => {
|
|
||||||
|
|
||||||
const trafficViewerApi = useRecoilValue(TrafficViewerApiAtom as RecoilState<TrafficViewerApi>)
|
|
||||||
useEffect(() => {
|
|
||||||
(async () => {
|
|
||||||
try {
|
|
||||||
const getRecentTLSLinksFunc = trafficViewerApi?.getRecentTLSLinks ? trafficViewerApi?.getRecentTLSLinks : function(){}
|
|
||||||
const recentTLSLinks = await getRecentTLSLinksFunc();
|
|
||||||
if (recentTLSLinks?.length > 0) {
|
|
||||||
setAddressesWithTLS(new Set(recentTLSLinks));
|
|
||||||
setShowTLSWarning(true);
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
console.error(e);
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
}, [setShowTLSWarning, setAddressesWithTLS,trafficViewerApi]);
|
|
||||||
|
|
||||||
return (<Snackbar open={showTLSWarning && !userDismissedTLSWarning}>
|
|
||||||
<MuiAlert classes={{filledWarning: 'customWarningStyle'}} elevation={6} variant="filled"
|
|
||||||
onClose={() => setUserDismissedTLSWarning(true)} severity="warning">
|
|
||||||
Mizu is detecting TLS traffic, this type of traffic will not be displayed.
|
|
||||||
{addressesWithTLS.size > 0 &&
|
|
||||||
<ul className="httpsDomains"> {Array.from(addressesWithTLS, address => <li>{address}</li>)} </ul>}
|
|
||||||
</MuiAlert>
|
|
||||||
</Snackbar>);
|
|
||||||
}
|
|
||||||
@@ -12,7 +12,7 @@ import TrafficViewerApiAtom from "../../recoil/TrafficViewerApi";
|
|||||||
import TrafficViewerApi from "./TrafficViewerApi";
|
import TrafficViewerApi from "./TrafficViewerApi";
|
||||||
import focusedEntryIdAtom from "../../recoil/focusedEntryId";
|
import focusedEntryIdAtom from "../../recoil/focusedEntryId";
|
||||||
import {toast} from "react-toastify";
|
import {toast} from "react-toastify";
|
||||||
import {TOAST_CONTAINER_ID} from "../../configs/Consts";
|
import {MAX_ENTRIES, TOAST_CONTAINER_ID} from "../../configs/Consts";
|
||||||
import tappingStatusAtom from "../../recoil/tappingStatus";
|
import tappingStatusAtom from "../../recoil/tappingStatus";
|
||||||
import leftOffTopAtom from "../../recoil/leftOffTop";
|
import leftOffTopAtom from "../../recoil/leftOffTop";
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ export const EntriesList: React.FC<EntriesListProps> = ({
|
|||||||
const [startTime, setStartTime] = useState(0);
|
const [startTime, setStartTime] = useState(0);
|
||||||
const [truncatedTimestamp, setTruncatedTimestamp] = useState(0);
|
const [truncatedTimestamp, setTruncatedTimestamp] = useState(0);
|
||||||
|
|
||||||
const leftOffBottom = entries.length > 0 ? entries[entries.length - 1].id : -1;
|
const leftOffBottom = entries.length > 0 ? entries[entries.length - 1].id : "latest";
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const list = document.getElementById('list').firstElementChild;
|
const list = document.getElementById('list').firstElementChild;
|
||||||
@@ -76,7 +76,7 @@ export const EntriesList: React.FC<EntriesListProps> = ({
|
|||||||
|
|
||||||
const getOldEntries = useCallback(async () => {
|
const getOldEntries = useCallback(async () => {
|
||||||
setLoadMoreTop(false);
|
setLoadMoreTop(false);
|
||||||
if (leftOffTop === null || leftOffTop <= 0) {
|
if (leftOffTop === "") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setIsLoadingTop(true);
|
setIsLoadingTop(true);
|
||||||
@@ -89,7 +89,7 @@ export const EntriesList: React.FC<EntriesListProps> = ({
|
|||||||
setLeftOffTop(data.meta.leftOff);
|
setLeftOffTop(data.meta.leftOff);
|
||||||
|
|
||||||
let scrollTo: boolean;
|
let scrollTo: boolean;
|
||||||
if (data.meta.leftOff === 0) {
|
if (data.meta.noMoreData) {
|
||||||
setNoMoreDataTop(true);
|
setNoMoreDataTop(true);
|
||||||
scrollTo = false;
|
scrollTo = false;
|
||||||
} else {
|
} else {
|
||||||
@@ -98,6 +98,9 @@ export const EntriesList: React.FC<EntriesListProps> = ({
|
|||||||
setIsLoadingTop(false);
|
setIsLoadingTop(false);
|
||||||
|
|
||||||
const newEntries = [...data.data.reverse(), ...entries];
|
const newEntries = [...data.data.reverse(), ...entries];
|
||||||
|
if(newEntries.length > MAX_ENTRIES) {
|
||||||
|
newEntries.splice(MAX_ENTRIES, newEntries.length - MAX_ENTRIES)
|
||||||
|
}
|
||||||
setEntries(newEntries);
|
setEntries(newEntries);
|
||||||
|
|
||||||
setQueriedTotal(data.meta.total);
|
setQueriedTotal(data.meta.total);
|
||||||
@@ -115,23 +118,28 @@ export const EntriesList: React.FC<EntriesListProps> = ({
|
|||||||
|
|
||||||
const scrollbarVisible = scrollableRef.current?.childWrapperRef.current.clientHeight > scrollableRef.current?.wrapperRef.current.clientHeight;
|
const scrollbarVisible = scrollableRef.current?.childWrapperRef.current.clientHeight > scrollableRef.current?.wrapperRef.current.clientHeight;
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!focusedEntryId && entries.length > 0)
|
||||||
|
setFocusedEntryId(entries[0].id);
|
||||||
|
}, [focusedEntryId, entries])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const newEntries = [...entries];
|
||||||
|
if (newEntries.length > MAX_ENTRIES) {
|
||||||
|
setLeftOffTop(newEntries[0].id);
|
||||||
|
newEntries.splice(0, newEntries.length - MAX_ENTRIES)
|
||||||
|
setNoMoreDataTop(false);
|
||||||
|
setEntries(newEntries);
|
||||||
|
}
|
||||||
|
}, [entries])
|
||||||
|
|
||||||
if (ws.current) {
|
if(ws.current && !ws.current.onmessage) {
|
||||||
ws.current.onmessage = (e) => {
|
ws.current.onmessage = (e) => {
|
||||||
if (!e?.data) return;
|
if (!e?.data) return;
|
||||||
const message = JSON.parse(e.data);
|
const message = JSON.parse(e.data);
|
||||||
switch (message.messageType) {
|
switch (message.messageType) {
|
||||||
case "entry":
|
case "entry":
|
||||||
const entry = message.data;
|
setEntries(entriesState => [...entriesState, message.data]);
|
||||||
if (!focusedEntryId) setFocusedEntryId(entry.id.toString());
|
|
||||||
const newEntries = [...entries, entry];
|
|
||||||
if (newEntries.length === 10001) {
|
|
||||||
setLeftOffTop(newEntries[0].id);
|
|
||||||
newEntries.shift();
|
|
||||||
setNoMoreDataTop(false);
|
|
||||||
}
|
|
||||||
setEntries(newEntries);
|
|
||||||
break;
|
break;
|
||||||
case "status":
|
case "status":
|
||||||
setTappingStatus(message.tappingStatus);
|
setTappingStatus(message.tappingStatus);
|
||||||
@@ -148,14 +156,12 @@ export const EntriesList: React.FC<EntriesListProps> = ({
|
|||||||
case "queryMetadata":
|
case "queryMetadata":
|
||||||
setTruncatedTimestamp(message.data.truncatedTimestamp);
|
setTruncatedTimestamp(message.data.truncatedTimestamp);
|
||||||
setQueriedTotal(message.data.total);
|
setQueriedTotal(message.data.total);
|
||||||
if (leftOffTop === null) {
|
setLeftOffTop(leftOffState => leftOffState === "" ? message.data.leftOff : leftOffState);
|
||||||
setLeftOffTop(message.data.leftOff - 1);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case "startTime":
|
case "startTime":
|
||||||
setStartTime(message.data);
|
setStartTime(message.data);
|
||||||
break;
|
break;
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,7 +183,7 @@ export const EntriesList: React.FC<EntriesListProps> = ({
|
|||||||
</ScrollableFeedVirtualized>
|
</ScrollableFeedVirtualized>
|
||||||
<button type="button"
|
<button type="button"
|
||||||
title="Fetch old records"
|
title="Fetch old records"
|
||||||
className={`${styles.btnOld} ${!scrollbarVisible && leftOffTop > 0 ? styles.showButton : styles.hideButton}`}
|
className={`${styles.btnOld} ${!scrollbarVisible && leftOffTop !== "" ? styles.showButton : styles.hideButton}`}
|
||||||
onClick={(_) => {
|
onClick={(_) => {
|
||||||
trafficViewerApi.webSocket.close()
|
trafficViewerApi.webSocket.close()
|
||||||
getOldEntries();
|
getOldEntries();
|
||||||
@@ -190,9 +196,9 @@ export const EntriesList: React.FC<EntriesListProps> = ({
|
|||||||
onClick={(_) => {
|
onClick={(_) => {
|
||||||
if (isWsConnectionClosed) {
|
if (isWsConnectionClosed) {
|
||||||
if (query) {
|
if (query) {
|
||||||
openWebSocket(`(${query}) and leftOff(${leftOffBottom})`, false);
|
openWebSocket(`(${query}) and leftOff("${leftOffBottom}")`, false);
|
||||||
} else {
|
} else {
|
||||||
openWebSocket(`leftOff(${leftOffBottom})`, false);
|
openWebSocket(`leftOff("${leftOffBottom}")`, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
scrollableRef.current.jumpToBottom();
|
scrollableRef.current.jumpToBottom();
|
||||||
@@ -203,7 +209,7 @@ export const EntriesList: React.FC<EntriesListProps> = ({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className={styles.footer}>
|
<div className={styles.footer}>
|
||||||
<div>Displaying <b id="entries-length">{entries?.length}</b> results out of <b
|
<div>Displaying <b id="entries-length">{entries?.length > MAX_ENTRIES ? MAX_ENTRIES : entries?.length}</b> results out of <b
|
||||||
id="total-entries">{queriedTotal}</b> total
|
id="total-entries">{queriedTotal}</b> total
|
||||||
</div>
|
</div>
|
||||||
{startTime !== 0 && <div>Started listening at <span style={{
|
{startTime !== 0 && <div>Started listening at <span style={{
|
||||||
|
|||||||
@@ -89,12 +89,13 @@ const EntryTitle: React.FC<any> = ({ protocol, data, elapsedTime }) => {
|
|||||||
</div>;
|
</div>;
|
||||||
};
|
};
|
||||||
|
|
||||||
const EntrySummary: React.FC<any> = ({ entry }) => {
|
const EntrySummary: React.FC<any> = ({ entry, namespace }) => {
|
||||||
return <EntryItem
|
return <EntryItem
|
||||||
key={`entry-${entry.id}`}
|
key={`entry-${entry.id}`}
|
||||||
entry={entry}
|
entry={entry}
|
||||||
style={{}}
|
style={{}}
|
||||||
headingMode={true}
|
headingMode={true}
|
||||||
|
namespace={namespace}
|
||||||
/>;
|
/>;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -140,7 +141,7 @@ export const EntryDetailed = () => {
|
|||||||
data={entryData.data}
|
data={entryData.data}
|
||||||
elapsedTime={entryData.data.elapsedTime}
|
elapsedTime={entryData.data.elapsedTime}
|
||||||
/>}
|
/>}
|
||||||
{!isLoading && entryData && <EntrySummary entry={entryData.base} />}
|
{!isLoading && entryData && <EntrySummary entry={entryData.base} namespace={entryData.data.namespace} />}
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
{!isLoading && entryData && <EntryViewer
|
{!isLoading && entryData && <EntryViewer
|
||||||
representation={entryData.representation}
|
representation={entryData.representation}
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import styles from "./EntrySections.module.sass";
|
import styles from "./EntrySections.module.sass";
|
||||||
import React, {useState} from "react";
|
import React, { useState } from "react";
|
||||||
import {SyntaxHighlighter} from "../../UI/SyntaxHighlighter/index";
|
import { SyntaxHighlighter } from "../../UI/SyntaxHighlighter/index";
|
||||||
import CollapsibleContainer from "../../UI/CollapsibleContainer";
|
import CollapsibleContainer from "../../UI/CollapsibleContainer";
|
||||||
import FancyTextDisplay from "../../UI/FancyTextDisplay";
|
import FancyTextDisplay from "../../UI/FancyTextDisplay";
|
||||||
import Queryable from "../../UI/Queryable";
|
import Queryable from "../../UI/Queryable";
|
||||||
import Checkbox from "../../UI/Checkbox";
|
import Checkbox from "../../UI/Checkbox";
|
||||||
import ProtobufDecoder from "protobuf-decoder";
|
import ProtobufDecoder from "protobuf-decoder";
|
||||||
import {default as jsonBeautify} from "json-beautify";
|
import { default as jsonBeautify } from "json-beautify";
|
||||||
import {default as xmlBeautify} from "xml-formatter";
|
import { default as xmlBeautify } from "xml-formatter";
|
||||||
|
|
||||||
interface EntryViewLineProps {
|
interface EntryViewLineProps {
|
||||||
label: string;
|
label: string;
|
||||||
@@ -18,40 +18,40 @@ interface EntryViewLineProps {
|
|||||||
useTooltip?: boolean;
|
useTooltip?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const EntryViewLine: React.FC<EntryViewLineProps> = ({label, value, selector = "", overrideQueryValue = "", displayIconOnMouseOver = true, useTooltip = true}) => {
|
const EntryViewLine: React.FC<EntryViewLineProps> = ({ label, value, selector = "", overrideQueryValue = "", displayIconOnMouseOver = true, useTooltip = true }) => {
|
||||||
let query: string;
|
let query: string;
|
||||||
if (!selector) {
|
if (!selector) {
|
||||||
query = "";
|
query = "";
|
||||||
} else if (overrideQueryValue) {
|
} else if (overrideQueryValue) {
|
||||||
query = `${selector} == ${overrideQueryValue}`;
|
query = `${selector} == ${overrideQueryValue}`;
|
||||||
} else if (typeof(value) == "string") {
|
} else if (typeof (value) == "string") {
|
||||||
query = `${selector} == "${JSON.stringify(value).slice(1, -1)}"`;
|
query = `${selector} == "${JSON.stringify(value).slice(1, -1)}"`;
|
||||||
} else {
|
} else {
|
||||||
query = `${selector} == ${value}`;
|
query = `${selector} == ${value}`;
|
||||||
}
|
}
|
||||||
return (label && <tr className={styles.dataLine}>
|
return (label && <tr className={styles.dataLine}>
|
||||||
<td className={`${styles.dataKey}`}>
|
<td className={`${styles.dataKey}`}>
|
||||||
<Queryable
|
<Queryable
|
||||||
query={query}
|
query={query}
|
||||||
style={{float: "right", height: "18px"}}
|
style={{ float: "right", height: "18px" }}
|
||||||
iconStyle={{marginRight: "20px"}}
|
iconStyle={{ marginRight: "20px" }}
|
||||||
flipped={true}
|
flipped={true}
|
||||||
useTooltip={useTooltip}
|
useTooltip={useTooltip}
|
||||||
displayIconOnMouseOver={displayIconOnMouseOver}
|
displayIconOnMouseOver={displayIconOnMouseOver}
|
||||||
>
|
>
|
||||||
{label}
|
{label}
|
||||||
</Queryable>
|
</Queryable>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<FancyTextDisplay
|
<FancyTextDisplay
|
||||||
className={styles.dataValue}
|
className={styles.dataValue}
|
||||||
text={value}
|
text={value}
|
||||||
applyTextEllipsis={false}
|
applyTextEllipsis={false}
|
||||||
flipped={true}
|
flipped={true}
|
||||||
displayIconOnMouseOver={true}
|
displayIconOnMouseOver={true}
|
||||||
/>
|
/>
|
||||||
</td>
|
</td>
|
||||||
</tr>) || null;
|
</tr>) || null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -63,11 +63,11 @@ interface EntrySectionCollapsibleTitleProps {
|
|||||||
query?: string,
|
query?: string,
|
||||||
}
|
}
|
||||||
|
|
||||||
const EntrySectionCollapsibleTitle: React.FC<EntrySectionCollapsibleTitleProps> = ({title, color, expanded, setExpanded, query = ""}) => {
|
const EntrySectionCollapsibleTitle: React.FC<EntrySectionCollapsibleTitleProps> = ({ title, color, expanded, setExpanded, query = "" }) => {
|
||||||
return <div className={styles.title}>
|
return <div className={styles.title}>
|
||||||
<div
|
<div
|
||||||
className={`${styles.button} ${expanded ? styles.expanded : ''}`}
|
className={`${styles.button} ${expanded ? styles.expanded : ''}`}
|
||||||
style={{backgroundColor: color}}
|
style={{ backgroundColor: color }}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setExpanded(!expanded)
|
setExpanded(!expanded)
|
||||||
}}
|
}}
|
||||||
@@ -90,12 +90,12 @@ interface EntrySectionContainerProps {
|
|||||||
query?: string,
|
query?: string,
|
||||||
}
|
}
|
||||||
|
|
||||||
export const EntrySectionContainer: React.FC<EntrySectionContainerProps> = ({title, color, children, query = ""}) => {
|
export const EntrySectionContainer: React.FC<EntrySectionContainerProps> = ({ title, color, children, query = "" }) => {
|
||||||
const [expanded, setExpanded] = useState(true);
|
const [expanded, setExpanded] = useState(true);
|
||||||
return <CollapsibleContainer
|
return <CollapsibleContainer
|
||||||
className={styles.collapsibleContainer}
|
className={styles.collapsibleContainer}
|
||||||
expanded={expanded}
|
expanded={expanded}
|
||||||
title={<EntrySectionCollapsibleTitle title={title} color={color} expanded={expanded} setExpanded={setExpanded} query={query}/>}
|
title={<EntrySectionCollapsibleTitle title={title} color={color} expanded={expanded} setExpanded={setExpanded} query={query} />}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
</CollapsibleContainer>
|
</CollapsibleContainer>
|
||||||
@@ -130,6 +130,7 @@ export const EntryBodySection: React.FC<EntryBodySectionProps> = ({
|
|||||||
|
|
||||||
const isBase64Encoding = encoding === 'base64';
|
const isBase64Encoding = encoding === 'base64';
|
||||||
const supportsPrettying = supportedFormats.some(format => contentType?.indexOf(format) > -1);
|
const supportsPrettying = supportedFormats.some(format => contentType?.indexOf(format) > -1);
|
||||||
|
const [isDecodeGrpc, setIsDecodeGrpc] = useState(true);
|
||||||
|
|
||||||
const formatTextBody = (body: any): string => {
|
const formatTextBody = (body: any): string => {
|
||||||
if (!decodeBase64) return body;
|
if (!decodeBase64) return body;
|
||||||
@@ -141,7 +142,7 @@ export const EntryBodySection: React.FC<EntryBodySectionProps> = ({
|
|||||||
if (jsonLikeFormats.some(format => contentType?.indexOf(format) > -1)) {
|
if (jsonLikeFormats.some(format => contentType?.indexOf(format) > -1)) {
|
||||||
if (!isPretty) return bodyBuf;
|
if (!isPretty) return bodyBuf;
|
||||||
return jsonBeautify(JSON.parse(bodyBuf), null, 2, 80);
|
return jsonBeautify(JSON.parse(bodyBuf), null, 2, 80);
|
||||||
} else if (xmlLikeFormats.some(format => contentType?.indexOf(format) > -1)) {
|
} else if (xmlLikeFormats.some(format => contentType?.indexOf(format) > -1)) {
|
||||||
if (!isPretty) return bodyBuf;
|
if (!isPretty) return bodyBuf;
|
||||||
return xmlBeautify(bodyBuf, {
|
return xmlBeautify(bodyBuf, {
|
||||||
indentation: ' ',
|
indentation: ' ',
|
||||||
@@ -157,49 +158,55 @@ export const EntryBodySection: React.FC<EntryBodySectionProps> = ({
|
|||||||
return jsonBeautify(protobufDecoded, null, 2, 80);
|
return jsonBeautify(protobufDecoded, null, 2, 80);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
if(isDecodeGrpc)
|
||||||
|
setIsDecodeGrpc(false);
|
||||||
|
if (!String(error).includes("More than one message in")){
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return bodyBuf;
|
return bodyBuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
return <React.Fragment>
|
return <React.Fragment>
|
||||||
{content && content?.length > 0 && <EntrySectionContainer
|
{content && content?.length > 0 && <EntrySectionContainer
|
||||||
title={title}
|
title={title}
|
||||||
color={color}
|
color={color}
|
||||||
query={`${selector} == r".*"`}
|
query={`${selector} == r".*"`}
|
||||||
>
|
>
|
||||||
<div style={{display: 'flex', alignItems: 'center', alignContent: 'center', margin: "5px 0"}}>
|
<div style={{ display: 'flex', alignItems: 'center', alignContent: 'center', margin: "5px 0" }}>
|
||||||
{supportsPrettying && <div style={{paddingTop: 3}}>
|
{supportsPrettying && <div style={{ paddingTop: 3 }}>
|
||||||
<Checkbox checked={isPretty} onToggle={() => {setIsPretty(!isPretty)}}/>
|
<Checkbox checked={isPretty} onToggle={() => { setIsPretty(!isPretty) }} />
|
||||||
</div>}
|
</div>}
|
||||||
{supportsPrettying && <span style={{marginLeft: '.2rem'}}>Pretty</span>}
|
{supportsPrettying && <span style={{ marginLeft: '.2rem' }}>Pretty</span>}
|
||||||
|
|
||||||
<div style={{paddingTop: 3, paddingLeft: supportsPrettying ? 20 : 0}}>
|
<div style={{ paddingTop: 3, paddingLeft: supportsPrettying ? 20 : 0 }}>
|
||||||
<Checkbox checked={showLineNumbers} onToggle={() => {setShowLineNumbers(!showLineNumbers)}}/>
|
<Checkbox checked={showLineNumbers} onToggle={() => { setShowLineNumbers(!showLineNumbers) }} />
|
||||||
</div>
|
</div>
|
||||||
<span style={{marginLeft: '.2rem'}}>Line numbers</span>
|
<span style={{ marginLeft: '.2rem' }}>Line numbers</span>
|
||||||
|
{isBase64Encoding && <div style={{ paddingTop: 3, paddingLeft: 20 }}>
|
||||||
{isBase64Encoding && <div style={{paddingTop: 3, paddingLeft: 20}}>
|
<Checkbox checked={decodeBase64} onToggle={() => { setDecodeBase64(!decodeBase64) }} />
|
||||||
<Checkbox checked={decodeBase64} onToggle={() => {setDecodeBase64(!decodeBase64)}}/>
|
|
||||||
</div>}
|
</div>}
|
||||||
{isBase64Encoding && <span style={{marginLeft: '.2rem'}}>Decode Base64</span>}
|
{isBase64Encoding && <span style={{ marginLeft: '.2rem' }}>Decode Base64</span>}
|
||||||
</div>
|
{!isDecodeGrpc && <span style={{ fontSize: '12px', color: '#DB2156', marginLeft: '.8rem' }}>More than one message in protobuf payload is not supported</span>}
|
||||||
|
</div>
|
||||||
|
|
||||||
<SyntaxHighlighter
|
<SyntaxHighlighter
|
||||||
code={formatTextBody(content)}
|
code={formatTextBody(content)}
|
||||||
showLineNumbers={showLineNumbers}
|
showLineNumbers={showLineNumbers}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</EntrySectionContainer>}
|
</EntrySectionContainer>}
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
interface EntrySectionProps {
|
interface EntrySectionProps {
|
||||||
title: string,
|
title: string,
|
||||||
color: string,
|
color: string,
|
||||||
arrayToIterate: any[],
|
arrayToIterate: any[],
|
||||||
}
|
}
|
||||||
|
|
||||||
export const EntryTableSection: React.FC<EntrySectionProps> = ({title, color, arrayToIterate}) => {
|
export const EntryTableSection: React.FC<EntrySectionProps> = ({ title, color, arrayToIterate }) => {
|
||||||
let arrayToIterateSorted: any[];
|
let arrayToIterateSorted: any[];
|
||||||
if (arrayToIterate) {
|
if (arrayToIterate) {
|
||||||
arrayToIterateSorted = arrayToIterate.sort((a, b) => {
|
arrayToIterateSorted = arrayToIterate.sort((a, b) => {
|
||||||
@@ -220,7 +227,7 @@ export const EntryTableSection: React.FC<EntrySectionProps> = ({title, color, ar
|
|||||||
<EntrySectionContainer title={title} color={color}>
|
<EntrySectionContainer title={title} color={color}>
|
||||||
<table>
|
<table>
|
||||||
<tbody id={`tbody-${title}`}>
|
<tbody id={`tbody-${title}`}>
|
||||||
{arrayToIterateSorted.map(({name, value, selector}, index) => <EntryViewLine
|
{arrayToIterateSorted.map(({ name, value, selector }, index) => <EntryViewLine
|
||||||
key={index}
|
key={index}
|
||||||
label={name}
|
label={name}
|
||||||
value={value}
|
value={value}
|
||||||
@@ -228,7 +235,7 @@ export const EntryTableSection: React.FC<EntrySectionProps> = ({title, color, ar
|
|||||||
/>)}
|
/>)}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</EntrySectionContainer> : <span/>
|
</EntrySectionContainer> : <span />
|
||||||
}
|
}
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
}
|
}
|
||||||
@@ -247,7 +254,7 @@ interface EntryPolicySectionCollapsibleTitleProps {
|
|||||||
setExpanded: any;
|
setExpanded: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
const EntryPolicySectionCollapsibleTitle: React.FC<EntryPolicySectionCollapsibleTitleProps> = ({label, matched, expanded, setExpanded}) => {
|
const EntryPolicySectionCollapsibleTitle: React.FC<EntryPolicySectionCollapsibleTitleProps> = ({ label, matched, expanded, setExpanded }) => {
|
||||||
return <div className={styles.title}>
|
return <div className={styles.title}>
|
||||||
<span
|
<span
|
||||||
className={`${styles.button}
|
className={`${styles.button}
|
||||||
@@ -260,8 +267,8 @@ const EntryPolicySectionCollapsibleTitle: React.FC<EntryPolicySectionCollapsible
|
|||||||
</span>
|
</span>
|
||||||
<span>
|
<span>
|
||||||
<tr className={styles.dataLine}>
|
<tr className={styles.dataLine}>
|
||||||
<td className={`${styles.dataKey} ${styles.rulesTitleSuccess}`}>{label}</td>
|
<td className={`${styles.dataKey} ${styles.rulesTitleSuccess}`}>{label}</td>
|
||||||
<td className={`${styles.dataKey} ${matched === 'Success' ? styles.rulesMatchedSuccess : styles.rulesMatchedFailure}`}>{matched}</td>
|
<td className={`${styles.dataKey} ${matched === 'Success' ? styles.rulesMatchedSuccess : styles.rulesMatchedFailure}`}>{matched}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -273,28 +280,28 @@ interface EntryPolicySectionContainerProps {
|
|||||||
children?: any;
|
children?: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const EntryPolicySectionContainer: React.FC<EntryPolicySectionContainerProps> = ({label, matched, children}) => {
|
export const EntryPolicySectionContainer: React.FC<EntryPolicySectionContainerProps> = ({ label, matched, children }) => {
|
||||||
const [expanded, setExpanded] = useState(false);
|
const [expanded, setExpanded] = useState(false);
|
||||||
return <CollapsibleContainer
|
return <CollapsibleContainer
|
||||||
className={styles.collapsibleContainer}
|
className={styles.collapsibleContainer}
|
||||||
expanded={expanded}
|
expanded={expanded}
|
||||||
title={<EntryPolicySectionCollapsibleTitle label={label} matched={matched} expanded={expanded} setExpanded={setExpanded}/>}
|
title={<EntryPolicySectionCollapsibleTitle label={label} matched={matched} expanded={expanded} setExpanded={setExpanded} />}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
</CollapsibleContainer>
|
</CollapsibleContainer>
|
||||||
}
|
}
|
||||||
|
|
||||||
export const EntryTablePolicySection: React.FC<EntryPolicySectionProps> = ({title, color, latency, arrayToIterate}) => {
|
export const EntryTablePolicySection: React.FC<EntryPolicySectionProps> = ({ title, color, latency, arrayToIterate }) => {
|
||||||
return <React.Fragment>
|
return <React.Fragment>
|
||||||
{
|
{
|
||||||
arrayToIterate && arrayToIterate.length > 0 ?
|
arrayToIterate && arrayToIterate.length > 0 ?
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<EntrySectionContainer title={title} color={color}>
|
<EntrySectionContainer title={title} color={color}>
|
||||||
<table>
|
<table>
|
||||||
<tbody>
|
<tbody>
|
||||||
{arrayToIterate.map(({rule, matched}, index) => {
|
{arrayToIterate.map(({ rule, matched }, index) => {
|
||||||
return (
|
return (
|
||||||
<EntryPolicySectionContainer key={index} label={rule.Name} matched={matched && (rule.Type === 'slo' ? rule.ResponseTime >= latency : true)? "Success" : "Failure"}>
|
<EntryPolicySectionContainer key={index} label={rule.Name} matched={matched && (rule.Type === 'slo' ? rule.ResponseTime >= latency : true) ? "Success" : "Failure"}>
|
||||||
{
|
{
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
{
|
{
|
||||||
@@ -330,11 +337,11 @@ export const EntryTablePolicySection: React.FC<EntryPolicySectionProps> = ({titl
|
|||||||
</EntryPolicySectionContainer>
|
</EntryPolicySectionContainer>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</EntrySectionContainer>
|
</EntrySectionContainer>
|
||||||
</React.Fragment> : <span className={styles.noRules}>No rules could be applied to this request.</span>
|
</React.Fragment> : <span className={styles.noRules}>No rules could be applied to this request.</span>
|
||||||
}
|
}
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
@@ -347,7 +354,7 @@ interface EntryContractSectionProps {
|
|||||||
contractContent: string,
|
contractContent: string,
|
||||||
}
|
}
|
||||||
|
|
||||||
export const EntryContractSection: React.FC<EntryContractSectionProps> = ({color, requestReason, responseReason, contractContent}) => {
|
export const EntryContractSection: React.FC<EntryContractSectionProps> = ({ color, requestReason, responseReason, contractContent }) => {
|
||||||
return <React.Fragment>
|
return <React.Fragment>
|
||||||
{requestReason && <EntrySectionContainer title="Request" color={color}>
|
{requestReason && <EntrySectionContainer title="Request" color={color}>
|
||||||
{requestReason}
|
{requestReason}
|
||||||
|
|||||||
@@ -67,7 +67,6 @@
|
|||||||
|
|
||||||
.capture img
|
.capture img
|
||||||
height: 14px
|
height: 14px
|
||||||
z-index: 1000
|
|
||||||
margin-top: 12px
|
margin-top: 12px
|
||||||
margin-left: -2px
|
margin-left: -2px
|
||||||
|
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ interface EntryProps {
|
|||||||
entry: Entry;
|
entry: Entry;
|
||||||
style: object;
|
style: object;
|
||||||
headingMode: boolean;
|
headingMode: boolean;
|
||||||
|
namespace?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum CaptureTypes {
|
enum CaptureTypes {
|
||||||
@@ -62,11 +63,11 @@ enum CaptureTypes {
|
|||||||
Ebpf = "ebpf",
|
Ebpf = "ebpf",
|
||||||
}
|
}
|
||||||
|
|
||||||
export const EntryItem: React.FC<EntryProps> = ({entry, style, headingMode}) => {
|
export const EntryItem: React.FC<EntryProps> = ({entry, style, headingMode, namespace}) => {
|
||||||
|
|
||||||
const [focusedEntryId, setFocusedEntryId] = useRecoilState(focusedEntryIdAtom);
|
const [focusedEntryId, setFocusedEntryId] = useRecoilState(focusedEntryIdAtom);
|
||||||
const [queryState, setQuery] = useRecoilState(queryAtom);
|
const [queryState, setQuery] = useRecoilState(queryAtom);
|
||||||
const isSelected = focusedEntryId === entry.id.toString();
|
const isSelected = focusedEntryId === entry.id;
|
||||||
|
|
||||||
const classification = getClassification(entry.status)
|
const classification = getClassification(entry.status)
|
||||||
const numberOfRules = entry.rules.numberOfRules
|
const numberOfRules = entry.rules.numberOfRules
|
||||||
@@ -143,12 +144,12 @@ export const EntryItem: React.FC<EntryProps> = ({entry, style, headingMode}) =>
|
|||||||
|
|
||||||
return <React.Fragment>
|
return <React.Fragment>
|
||||||
<div
|
<div
|
||||||
id={`entry-${entry.id.toString()}`}
|
id={`entry-${entry.id}`}
|
||||||
className={`${styles.row}
|
className={`${styles.row}
|
||||||
${isSelected && !rule && !contractEnabled ? styles.rowSelected : additionalRulesProperties}`}
|
${isSelected && !rule && !contractEnabled ? styles.rowSelected : additionalRulesProperties}`}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (!setFocusedEntryId) return;
|
if (!setFocusedEntryId) return;
|
||||||
setFocusedEntryId(entry.id.toString());
|
setFocusedEntryId(entry.id);
|
||||||
}}
|
}}
|
||||||
style={{
|
style={{
|
||||||
border: isSelected && !headingMode ? `1px ${entry.proto.backgroundColor} solid` : "1px transparent solid",
|
border: isSelected && !headingMode ? `1px ${entry.proto.backgroundColor} solid` : "1px transparent solid",
|
||||||
@@ -224,6 +225,19 @@ export const EntryItem: React.FC<EntryProps> = ({entry, style, headingMode}) =>
|
|||||||
: ""
|
: ""
|
||||||
}
|
}
|
||||||
<div className={styles.separatorRight}>
|
<div className={styles.separatorRight}>
|
||||||
|
{headingMode ? <Queryable
|
||||||
|
query={`namespace == "${namespace}"`}
|
||||||
|
displayIconOnMouseOver={true}
|
||||||
|
flipped={true}
|
||||||
|
iconStyle={{marginRight: "16px"}}
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
className={`${styles.tcpInfo} ${styles.ip}`}
|
||||||
|
title="Namespace"
|
||||||
|
>
|
||||||
|
{namespace}
|
||||||
|
</span>
|
||||||
|
</Queryable> : null}
|
||||||
<Queryable
|
<Queryable
|
||||||
query={`src.ip == "${entry.src.ip}"`}
|
query={`src.ip == "${entry.src.ip}"`}
|
||||||
displayIconOnMouseOver={true}
|
displayIconOnMouseOver={true}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
flex-direction: column
|
flex-direction: column
|
||||||
overflow: hidden
|
overflow: hidden
|
||||||
flex-grow: 1
|
flex-grow: 1
|
||||||
height: calc(100vh - 70px)
|
height: calc(100% - 70px)
|
||||||
|
|
||||||
.TrafficPageHeader
|
.TrafficPageHeader
|
||||||
padding: 20px 24px
|
padding: 20px 24px
|
||||||
@@ -16,9 +16,8 @@
|
|||||||
justify-content: space-between
|
justify-content: space-between
|
||||||
|
|
||||||
.TrafficPageStreamStatus
|
.TrafficPageStreamStatus
|
||||||
display: flex
|
display: flex
|
||||||
align-items: center
|
align-items: center
|
||||||
|
|
||||||
|
|
||||||
.TrafficPageHeaderImage
|
.TrafficPageHeaderImage
|
||||||
width: 22px
|
width: 22px
|
||||||
@@ -113,4 +112,4 @@
|
|||||||
.playPauseIcon
|
.playPauseIcon
|
||||||
cursor: pointer
|
cursor: pointer
|
||||||
margin-right: 15px
|
margin-right: 15px
|
||||||
height: 30px
|
height: 30px
|
||||||
|
|||||||
@@ -14,13 +14,13 @@ import {RecoilRoot, RecoilState, useRecoilState, useRecoilValue, useSetRecoilSta
|
|||||||
import entriesAtom from "../../recoil/entries";
|
import entriesAtom from "../../recoil/entries";
|
||||||
import focusedEntryIdAtom from "../../recoil/focusedEntryId";
|
import focusedEntryIdAtom from "../../recoil/focusedEntryId";
|
||||||
import queryAtom from "../../recoil/query";
|
import queryAtom from "../../recoil/query";
|
||||||
import {TLSWarning} from "../TLSWarning/TLSWarning";
|
|
||||||
import trafficViewerApiAtom from "../../recoil/TrafficViewerApi"
|
import trafficViewerApiAtom from "../../recoil/TrafficViewerApi"
|
||||||
import TrafficViewerApi from "./TrafficViewerApi";
|
import TrafficViewerApi from "./TrafficViewerApi";
|
||||||
import {StatusBar} from "../UI/StatusBar";
|
import {StatusBar} from "../UI/StatusBar";
|
||||||
import tappingStatusAtom from "../../recoil/tappingStatus/atom";
|
import tappingStatusAtom from "../../recoil/tappingStatus/atom";
|
||||||
import {TOAST_CONTAINER_ID} from "../../configs/Consts";
|
import {TOAST_CONTAINER_ID} from "../../configs/Consts";
|
||||||
import leftOffTopAtom from "../../recoil/leftOffTop";
|
import leftOffTopAtom from "../../recoil/leftOffTop";
|
||||||
|
import { DEFAULT_QUERY } from '../../hooks/useWS';
|
||||||
|
|
||||||
const useLayoutStyles = makeStyles(() => ({
|
const useLayoutStyles = makeStyles(() => ({
|
||||||
details: {
|
details: {
|
||||||
@@ -49,14 +49,15 @@ interface TrafficViewerProps {
|
|||||||
actionButtons?: JSX.Element,
|
actionButtons?: JSX.Element,
|
||||||
isShowStatusBar?: boolean,
|
isShowStatusBar?: boolean,
|
||||||
webSocketUrl: string,
|
webSocketUrl: string,
|
||||||
isCloseWebSocket: boolean,
|
shouldCloseWebSocket: boolean,
|
||||||
|
setShouldCloseWebSocket: (flag: boolean) => void,
|
||||||
isDemoBannerView: boolean
|
isDemoBannerView: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export const TrafficViewer: React.FC<TrafficViewerProps> = ({
|
export const TrafficViewer: React.FC<TrafficViewerProps> = ({
|
||||||
setAnalyzeStatus, trafficViewerApiProp,
|
setAnalyzeStatus, trafficViewerApiProp,
|
||||||
actionButtons, isShowStatusBar, webSocketUrl,
|
actionButtons, isShowStatusBar, webSocketUrl,
|
||||||
isCloseWebSocket, isDemoBannerView
|
shouldCloseWebSocket, setShouldCloseWebSocket, isDemoBannerView
|
||||||
}) => {
|
}) => {
|
||||||
|
|
||||||
const classes = useLayoutStyles();
|
const classes = useLayoutStyles();
|
||||||
@@ -75,10 +76,6 @@ export const TrafficViewer: React.FC<TrafficViewerProps> = ({
|
|||||||
const setLeftOffTop = useSetRecoilState(leftOffTopAtom);
|
const setLeftOffTop = useSetRecoilState(leftOffTopAtom);
|
||||||
const scrollableRef = useRef(null);
|
const scrollableRef = useRef(null);
|
||||||
|
|
||||||
const [showTLSWarning, setShowTLSWarning] = useState(false);
|
|
||||||
const [userDismissedTLSWarning, setUserDismissedTLSWarning] = useState(false);
|
|
||||||
const [addressesWithTLS, setAddressesWithTLS] = useState(new Set<string>());
|
|
||||||
|
|
||||||
const handleQueryChange = useMemo(
|
const handleQueryChange = useMemo(
|
||||||
() =>
|
() =>
|
||||||
debounce(async (query: string) => {
|
debounce(async (query: string) => {
|
||||||
@@ -104,8 +101,11 @@ export const TrafficViewer: React.FC<TrafficViewerProps> = ({
|
|||||||
}, [query, handleQueryChange]);
|
}, [query, handleQueryChange]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
isCloseWebSocket && closeWebSocket()
|
if(shouldCloseWebSocket){
|
||||||
}, [isCloseWebSocket])
|
closeWebSocket()
|
||||||
|
setShouldCloseWebSocket(false);
|
||||||
|
}
|
||||||
|
}, [shouldCloseWebSocket])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
reopenConnection()
|
reopenConnection()
|
||||||
@@ -115,9 +115,9 @@ export const TrafficViewer: React.FC<TrafficViewerProps> = ({
|
|||||||
|
|
||||||
const openEmptyWebSocket = () => {
|
const openEmptyWebSocket = () => {
|
||||||
if (query) {
|
if (query) {
|
||||||
openWebSocket(`(${query}) and leftOff(-1)`, true);
|
openWebSocket(`(${query}) and ${DEFAULT_QUERY}`, true);
|
||||||
} else {
|
} else {
|
||||||
openWebSocket(`leftOff(-1)`, true);
|
openWebSocket(DEFAULT_QUERY, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,7 +133,7 @@ export const TrafficViewer: React.FC<TrafficViewerProps> = ({
|
|||||||
if (resetEntries) {
|
if (resetEntries) {
|
||||||
setFocusedEntryId(null);
|
setFocusedEntryId(null);
|
||||||
setEntries([]);
|
setEntries([]);
|
||||||
setLeftOffTop(null);
|
setLeftOffTop("");
|
||||||
setNoMoreDataTop(false);
|
setNoMoreDataTop(false);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
@@ -201,7 +201,9 @@ export const TrafficViewer: React.FC<TrafficViewerProps> = ({
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
return () => {
|
return () => {
|
||||||
ws.current.close();
|
if (ws?.current?.readyState === WebSocket.OPEN) {
|
||||||
|
ws.current.close();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
@@ -279,12 +281,6 @@ export const TrafficViewer: React.FC<TrafficViewerProps> = ({
|
|||||||
<EntryDetailed/>
|
<EntryDetailed/>
|
||||||
</div>
|
</div>
|
||||||
</div>}
|
</div>}
|
||||||
<TLSWarning showTLSWarning={showTLSWarning}
|
|
||||||
setShowTLSWarning={setShowTLSWarning}
|
|
||||||
addressesWithTLS={addressesWithTLS}
|
|
||||||
setAddressesWithTLS={setAddressesWithTLS}
|
|
||||||
userDismissedTLSWarning={userDismissedTLSWarning}
|
|
||||||
setUserDismissedTLSWarning={setUserDismissedTLSWarning}/>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -293,11 +289,11 @@ const MemoiedTrafficViewer = React.memo(TrafficViewer)
|
|||||||
const TrafficViewerContainer: React.FC<TrafficViewerProps> = ({
|
const TrafficViewerContainer: React.FC<TrafficViewerProps> = ({
|
||||||
setAnalyzeStatus, trafficViewerApiProp,
|
setAnalyzeStatus, trafficViewerApiProp,
|
||||||
actionButtons, isShowStatusBar = true,
|
actionButtons, isShowStatusBar = true,
|
||||||
webSocketUrl, isCloseWebSocket, isDemoBannerView
|
webSocketUrl, shouldCloseWebSocket, setShouldCloseWebSocket, isDemoBannerView
|
||||||
}) => {
|
}) => {
|
||||||
return <RecoilRoot>
|
return <RecoilRoot>
|
||||||
<MemoiedTrafficViewer actionButtons={actionButtons} isShowStatusBar={isShowStatusBar} webSocketUrl={webSocketUrl}
|
<MemoiedTrafficViewer actionButtons={actionButtons} isShowStatusBar={isShowStatusBar} webSocketUrl={webSocketUrl}
|
||||||
isCloseWebSocket={isCloseWebSocket} trafficViewerApiProp={trafficViewerApiProp}
|
shouldCloseWebSocket={shouldCloseWebSocket} setShouldCloseWebSocket={setShouldCloseWebSocket} trafficViewerApiProp={trafficViewerApiProp}
|
||||||
setAnalyzeStatus={setAnalyzeStatus} isDemoBannerView={isDemoBannerView}/>
|
setAnalyzeStatus={setAnalyzeStatus} isDemoBannerView={isDemoBannerView}/>
|
||||||
<ToastContainer enableMultiContainer containerId={TOAST_CONTAINER_ID}
|
<ToastContainer enableMultiContainer containerId={TOAST_CONTAINER_ID}
|
||||||
position="bottom-right"
|
position="bottom-right"
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ type TrafficViewerApi = {
|
|||||||
analyzeStatus: () => any
|
analyzeStatus: () => any
|
||||||
fetchEntries: (leftOff: any, direction: number, query: any, limit: number, timeoutMs: number) => any
|
fetchEntries: (leftOff: any, direction: number, query: any, limit: number, timeoutMs: number) => any
|
||||||
getEntry: (entryId: any, query: string) => any
|
getEntry: (entryId: any, query: string) => any
|
||||||
getRecentTLSLinks: () => any,
|
|
||||||
webSocket: {
|
webSocket: {
|
||||||
close: () => void
|
close: () => void
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +1,22 @@
|
|||||||
import React, { CSSProperties } from "react";
|
import React from "react";
|
||||||
import styles from "./style/InformationIcon.module.sass"
|
import styles from "./style/InformationIcon.module.sass"
|
||||||
|
|
||||||
const DEFUALT_LINK = "https://getmizu.io/docs"
|
const DEFUALT_LINK = "https://getmizu.io/docs"
|
||||||
|
|
||||||
export interface InformationIconProps {
|
interface LinkProps {
|
||||||
link?: string,
|
link?: string,
|
||||||
style?: CSSProperties
|
className?: string
|
||||||
|
title?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export const InformationIcon: React.FC<InformationIconProps> = ({ link, style }) => {
|
export const Link: React.FC<LinkProps> = ({ link, className, title, children }) => {
|
||||||
return <React.Fragment>
|
return <a href={link} className={className} title={title} target="_blank">
|
||||||
<a href={DEFUALT_LINK ? DEFUALT_LINK : link} style={style} className={styles.linkStyle} title="documentation" target="_blank">
|
{children}
|
||||||
<span>Docs</span>
|
</a>
|
||||||
</a>
|
|
||||||
</React.Fragment>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const InformationIcon: React.FC<LinkProps> = ({ className }) => {
|
||||||
|
return <Link title="documentation" className={`${styles.linkStyle} ${className}`} link={DEFUALT_LINK}>
|
||||||
|
<span>Docs</span>
|
||||||
|
</Link>
|
||||||
|
}
|
||||||
61
ui-common/src/components/UI/Resizeable.tsx
Normal file
61
ui-common/src/components/UI/Resizeable.tsx
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
import React, { useRef, useState } from "react";
|
||||||
|
|
||||||
|
import styles from './style/Resizeable.module.sass'
|
||||||
|
|
||||||
|
export interface Props {
|
||||||
|
children
|
||||||
|
minWidth: number
|
||||||
|
}
|
||||||
|
|
||||||
|
const Resizeable: React.FC<Props> = ({ children, minWidth }) => {
|
||||||
|
const resizeble = useRef(null)
|
||||||
|
let mousePos = { x: 0, y: 0 }
|
||||||
|
let elementDimention = { w: 0, h: 0 }
|
||||||
|
let isPressed = false
|
||||||
|
const [elemWidth, setElemWidth] = useState(resizeble?.current?.style?.width)
|
||||||
|
|
||||||
|
const mouseDownHandler = function (e) {
|
||||||
|
// Get the current mouse position
|
||||||
|
mousePos = { x: e.clientX, y: e.clientY }
|
||||||
|
isPressed = true
|
||||||
|
|
||||||
|
// Calculate the dimension of element
|
||||||
|
const styles = resizeble.current.getBoundingClientRect();
|
||||||
|
elementDimention = { w: parseInt(styles.width, 10), h: parseInt(styles.height, 10) }
|
||||||
|
// Attach the listeners to `document`
|
||||||
|
window.addEventListener('mousemove', mouseMoveHandler);
|
||||||
|
window.addEventListener('mouseup', mouseUpHandler);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const mouseMoveHandler = function (e) {
|
||||||
|
if (isPressed) {
|
||||||
|
// How far the mouse has been moved
|
||||||
|
const dx = e.clientX - mousePos.x;
|
||||||
|
const widthEl = elementDimention.w + dx
|
||||||
|
|
||||||
|
if (widthEl >= minWidth)
|
||||||
|
// Adjust the dimension of element
|
||||||
|
setElemWidth(widthEl)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const mouseUpHandler = function () {
|
||||||
|
window.removeEventListener('mousemove', mouseMoveHandler);
|
||||||
|
window.removeEventListener('mouseup', mouseUpHandler);
|
||||||
|
isPressed = false
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<React.Fragment>
|
||||||
|
<div className={styles.resizable} ref={resizeble} style={{ width: elemWidth }}>
|
||||||
|
{children}
|
||||||
|
<div className={`${styles.resizer} ${styles.resizerRight}`} onMouseDown={mouseDownHandler}></div>
|
||||||
|
{/* <div className={`${styles.resizer} ${styles.resizerB}`} onMouseDown={mouseDownHandler}></div> -- FutureUse*/}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</React.Fragment>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Resizeable;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import React, { useMemo } from "react";
|
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
||||||
import Radio from "./Radio";
|
import Radio from "./Radio";
|
||||||
import styles from './style/SelectList.module.sass'
|
import styles from './style/SelectList.module.sass'
|
||||||
import NoDataMessage from "./NoDataMessage";
|
import NoDataMessage from "./NoDataMessage";
|
||||||
@@ -19,12 +19,16 @@ export interface Props {
|
|||||||
const SelectList: React.FC<Props> = ({ items, tableName, checkedValues = [], multiSelect = true, searchValue = "", setCheckedValues, tableClassName,
|
const SelectList: React.FC<Props> = ({ items, tableName, checkedValues = [], multiSelect = true, searchValue = "", setCheckedValues, tableClassName,
|
||||||
checkBoxWidth = 50 }) => {
|
checkBoxWidth = 50 }) => {
|
||||||
const noItemsMessage = "No items to show";
|
const noItemsMessage = "No items to show";
|
||||||
const enabledItemsLength = useMemo(() => items.filter(item => !item.disabled).length, [items]);
|
const [headerChecked, setHeaderChecked] = useState(false)
|
||||||
|
|
||||||
const filteredValues = useMemo(() => {
|
const filteredValues = useMemo(() => {
|
||||||
return items.filter((listValue) => listValue?.value?.includes(searchValue));
|
return items.filter((listValue) => listValue?.value?.includes(searchValue));
|
||||||
}, [items, searchValue])
|
}, [items, searchValue])
|
||||||
|
|
||||||
|
const filteredValuesKeys = useMemo(() => {
|
||||||
|
return filteredValues.map(x => x.key)
|
||||||
|
}, [filteredValues])
|
||||||
|
|
||||||
const toggleValue = (checkedKey) => {
|
const toggleValue = (checkedKey) => {
|
||||||
if (!multiSelect) {
|
if (!multiSelect) {
|
||||||
const newCheckedValues = [];
|
const newCheckedValues = [];
|
||||||
@@ -34,25 +38,31 @@ const SelectList: React.FC<Props> = ({ items, tableName, checkedValues = [], mul
|
|||||||
else {
|
else {
|
||||||
const newCheckedValues = [...checkedValues];
|
const newCheckedValues = [...checkedValues];
|
||||||
let index = newCheckedValues.indexOf(checkedKey);
|
let index = newCheckedValues.indexOf(checkedKey);
|
||||||
|
|
||||||
if (index > -1)
|
if (index > -1)
|
||||||
newCheckedValues.splice(index, 1);
|
newCheckedValues.splice(index, 1);
|
||||||
else
|
else
|
||||||
newCheckedValues.push(checkedKey);
|
newCheckedValues.push(checkedKey);
|
||||||
|
|
||||||
setCheckedValues(newCheckedValues);
|
setCheckedValues(newCheckedValues);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const toggleAll = () => {
|
useEffect(() => {
|
||||||
const newCheckedValues = [...checkedValues];
|
const setAllChecked = filteredValuesKeys.every(val => checkedValues.includes(val))
|
||||||
if (newCheckedValues.length === enabledItemsLength) setCheckedValues([]);
|
setHeaderChecked(setAllChecked)
|
||||||
else {
|
}, [filteredValuesKeys, checkedValues])
|
||||||
items.forEach((obj) => {
|
|
||||||
if (!obj.disabled && !newCheckedValues.includes(obj.key))
|
const toggleAll = useCallback((shouldCheckAll) => {
|
||||||
newCheckedValues.push(obj.key);
|
let newChecked = checkedValues.filter(x => !filteredValuesKeys.includes(x))
|
||||||
})
|
|
||||||
setCheckedValues(newCheckedValues);
|
if (shouldCheckAll) {
|
||||||
|
const disabledItems = items.filter(i => i.disabled).map(x => x.key)
|
||||||
|
newChecked = [...filteredValuesKeys, ...newChecked].filter(x => !disabledItems.includes(x))
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
setCheckedValues(newChecked)
|
||||||
|
}, [searchValue, checkedValues, filteredValuesKeys])
|
||||||
|
|
||||||
const dataFieldFunc = (listValue) => listValue.component ? listValue.component :
|
const dataFieldFunc = (listValue) => listValue.component ? listValue.component :
|
||||||
<span className={styles.nowrap} title={listValue.value}>
|
<span className={styles.nowrap} title={listValue.value}>
|
||||||
@@ -60,8 +70,8 @@ const SelectList: React.FC<Props> = ({ items, tableName, checkedValues = [], mul
|
|||||||
</span>
|
</span>
|
||||||
|
|
||||||
const tableHead = multiSelect ? <tr style={{ borderBottomWidth: "2px" }}>
|
const tableHead = multiSelect ? <tr style={{ borderBottomWidth: "2px" }}>
|
||||||
<th style={{ width: checkBoxWidth }}><Checkbox data-cy="checkbox-all" checked={enabledItemsLength === checkedValues.length}
|
<th style={{ width: checkBoxWidth }}><Checkbox data-cy="checkbox-all" checked={headerChecked}
|
||||||
onToggle={toggleAll} /></th>
|
onToggle={(isChecked) => toggleAll(isChecked)} /></th>
|
||||||
<th>{tableName}</th>
|
<th>{tableName}</th>
|
||||||
</tr> :
|
</tr> :
|
||||||
<tr style={{ borderBottomWidth: "2px" }}>
|
<tr style={{ borderBottomWidth: "2px" }}>
|
||||||
@@ -70,7 +80,7 @@ const SelectList: React.FC<Props> = ({ items, tableName, checkedValues = [], mul
|
|||||||
|
|
||||||
const tableBody = filteredValues.length === 0 ?
|
const tableBody = filteredValues.length === 0 ?
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td colSpan={2}>
|
||||||
<NoDataMessage messageText={noItemsMessage} />
|
<NoDataMessage messageText={noItemsMessage} />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -37,9 +37,9 @@ export function getClassification(statusCode: number): string {
|
|||||||
|
|
||||||
// 1 - 16 HTTP/2 (gRPC) status codes
|
// 1 - 16 HTTP/2 (gRPC) status codes
|
||||||
// 2xx - 5xx HTTP/1.x status codes
|
// 2xx - 5xx HTTP/1.x status codes
|
||||||
if ((statusCode >= 200 && statusCode <= 399) || statusCode === 0) {
|
if (statusCode >= 200 && statusCode <= 399) {
|
||||||
classification = StatusCodeClassification.SUCCESS;
|
classification = StatusCodeClassification.SUCCESS;
|
||||||
} else if (statusCode >= 400 || (statusCode >= 1 && statusCode <= 16)) {
|
} else if (statusCode >= 400) {
|
||||||
classification = StatusCodeClassification.FAILURE;
|
classification = StatusCodeClassification.FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ import Tooltip from "./Tooltip";
|
|||||||
import Checkbox from "./Checkbox"
|
import Checkbox from "./Checkbox"
|
||||||
import { StatusBar } from "./StatusBar";
|
import { StatusBar } from "./StatusBar";
|
||||||
import CustomModal from "./CustomModal";
|
import CustomModal from "./CustomModal";
|
||||||
import { InformationIcon } from "./InformationIcon";
|
import { InformationIcon, Link } from "./InformationIcon";
|
||||||
import SelectList from "./SelectList";
|
import SelectList from "./SelectList";
|
||||||
import NoDataMessage from "./NoDataMessage";
|
import NoDataMessage from "./NoDataMessage";
|
||||||
|
|
||||||
|
|
||||||
export { LoadingOverlay, Select, Tabs, Tooltip, Checkbox, CustomModal, InformationIcon, SelectList, NoDataMessage }
|
export { LoadingOverlay, Select, Tabs, Tooltip, Checkbox, CustomModal, InformationIcon, SelectList, NoDataMessage, Link }
|
||||||
export { StatusBar }
|
export { StatusBar }
|
||||||
29
ui-common/src/components/UI/style/Resizeable.module.sass
Normal file
29
ui-common/src/components/UI/style/Resizeable.module.sass
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
@import "../../../variables.module"
|
||||||
|
|
||||||
|
.resizable
|
||||||
|
position: relative
|
||||||
|
align-items: center
|
||||||
|
display: flex
|
||||||
|
overflow: hidden
|
||||||
|
border-right: 1px solid $blue-color
|
||||||
|
height: 100%
|
||||||
|
width: 100%
|
||||||
|
padding-right: 3px
|
||||||
|
|
||||||
|
.resizer
|
||||||
|
position: absolute
|
||||||
|
|
||||||
|
&Right
|
||||||
|
cursor: col-resize
|
||||||
|
height: 100%
|
||||||
|
right: 0
|
||||||
|
top: 0
|
||||||
|
width: 5px
|
||||||
|
|
||||||
|
// FutureUse
|
||||||
|
&Bottom
|
||||||
|
bottom: 0
|
||||||
|
cursor: row-resize
|
||||||
|
height: 5px
|
||||||
|
left: 0
|
||||||
|
width: 100%
|
||||||
@@ -1,25 +1,27 @@
|
|||||||
@import '../../../variables.module'
|
@import '../../../variables.module'
|
||||||
|
|
||||||
.selectListTable
|
.selectListTable
|
||||||
|
overflow: auto
|
||||||
|
height: 100%
|
||||||
|
user-select: none // when resizble moved we get unwanted beheviour
|
||||||
|
|
||||||
table
|
table
|
||||||
width: 100%
|
width: 100%
|
||||||
margin-top: 20px
|
margin-top: 20px
|
||||||
height: 100%
|
border-collapse: collapse
|
||||||
|
|
||||||
tbody
|
|
||||||
display: block
|
|
||||||
|
|
||||||
th
|
th
|
||||||
color: $blue-gray
|
color: $blue-gray
|
||||||
text-align: left
|
text-align: left
|
||||||
padding: 10px
|
padding: 10px
|
||||||
|
position: sticky
|
||||||
|
top: 0
|
||||||
|
background: $main-background-color
|
||||||
|
|
||||||
tr
|
tr
|
||||||
border-bottom-width: 1px
|
border-bottom-width: 1px
|
||||||
border-bottom-color: $data-background-color
|
border-bottom-color: $data-background-color
|
||||||
border-bottom-style: solid
|
border-bottom-style: solid
|
||||||
display: table
|
|
||||||
table-layout: fixed
|
|
||||||
width: 100%
|
width: 100%
|
||||||
|
|
||||||
td
|
td
|
||||||
|
|||||||
@@ -1 +1,2 @@
|
|||||||
export const TOAST_CONTAINER_ID = "Common";
|
export const TOAST_CONTAINER_ID = "Common";
|
||||||
|
export const MAX_ENTRIES = 10000;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ enum WebSocketReadyState {
|
|||||||
CLOSED
|
CLOSED
|
||||||
}
|
}
|
||||||
|
|
||||||
export const DEFAULT_QUERY = "leftOff(-1)";
|
export const DEFAULT_QUERY = `leftOff("latest")`;
|
||||||
|
|
||||||
const useWS = (wsUrl: string) => {
|
const useWS = (wsUrl: string) => {
|
||||||
const [message, setMessage] = useState(null);
|
const [message, setMessage] = useState(null);
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { atom } from "recoil"
|
|||||||
|
|
||||||
const leftOffTopAtom = atom({
|
const leftOffTopAtom = atom({
|
||||||
key: "leftOffTopAtom",
|
key: "leftOffTopAtom",
|
||||||
default: null
|
default: ""
|
||||||
})
|
})
|
||||||
|
|
||||||
export default leftOffTopAtom;
|
export default leftOffTopAtom;
|
||||||
|
|||||||
@@ -27,7 +27,6 @@
|
|||||||
"node-fetch": "^3.1.1",
|
"node-fetch": "^3.1.1",
|
||||||
"node-sass": "^6.0.0",
|
"node-sass": "^6.0.0",
|
||||||
"numeral": "^2.0.6",
|
"numeral": "^2.0.6",
|
||||||
"protobuf-decoder": "^0.1.0",
|
|
||||||
"react": "^17.0.2",
|
"react": "^17.0.2",
|
||||||
"react-copy-to-clipboard": "^5.0.3",
|
"react-copy-to-clipboard": "^5.0.3",
|
||||||
"react-dom": "^17.0.2",
|
"react-dom": "^17.0.2",
|
||||||
|
|||||||
@@ -6,3 +6,4 @@ body
|
|||||||
.mizuApp
|
.mizuApp
|
||||||
color: $font-color
|
color: $font-color
|
||||||
width: 100%
|
width: 100%
|
||||||
|
height: 100%
|
||||||
|
|||||||
@@ -21,17 +21,17 @@ export const TrafficPage: React.FC<TrafficPageProps> = ({ setAnalyzeStatus }) =>
|
|||||||
const commonClasses = useCommonStyles();
|
const commonClasses = useCommonStyles();
|
||||||
const [serviceMapModalOpen, setServiceMapModalOpen] = useRecoilState(serviceMapModalOpenAtom);
|
const [serviceMapModalOpen, setServiceMapModalOpen] = useRecoilState(serviceMapModalOpenAtom);
|
||||||
const [openOasModal, setOpenOasModal] = useRecoilState(oasModalOpenAtom);
|
const [openOasModal, setOpenOasModal] = useRecoilState(oasModalOpenAtom);
|
||||||
const [openWebSocket, setOpenWebSocket] = useState(true);
|
const [shouldCloseWebSocket, setShouldCloseWebSocket] = useState(false);
|
||||||
|
|
||||||
const trafficViewerApi = { ...api }
|
const trafficViewerApi = { ...api }
|
||||||
|
|
||||||
const handleOpenOasModal = () => {
|
const handleOpenOasModal = () => {
|
||||||
setOpenWebSocket(false)
|
setShouldCloseWebSocket(true)
|
||||||
setOpenOasModal(true);
|
setOpenOasModal(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
const openServiceMapModalDebounce = debounce(() => {
|
const openServiceMapModalDebounce = debounce(() => {
|
||||||
setOpenWebSocket(false)
|
setShouldCloseWebSocket(true)
|
||||||
setServiceMapModalOpen(true)
|
setServiceMapModalOpen(true)
|
||||||
}, 500);
|
}, 500);
|
||||||
|
|
||||||
@@ -59,7 +59,7 @@ export const TrafficPage: React.FC<TrafficPageProps> = ({ setAnalyzeStatus }) =>
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<TrafficViewer setAnalyzeStatus={setAnalyzeStatus} webSocketUrl={MizuWebsocketURL} isCloseWebSocket={!openWebSocket}
|
<TrafficViewer setAnalyzeStatus={setAnalyzeStatus} webSocketUrl={MizuWebsocketURL} shouldCloseWebSocket={shouldCloseWebSocket} setShouldCloseWebSocket={setShouldCloseWebSocket}
|
||||||
trafficViewerApiProp={trafficViewerApi} actionButtons={actionButtons} isShowStatusBar={!(openOasModal || serviceMapModalOpen)} isDemoBannerView={false} />
|
trafficViewerApiProp={trafficViewerApi} actionButtons={actionButtons} isShowStatusBar={!(openOasModal || serviceMapModalOpen)} isDemoBannerView={false} />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -62,11 +62,6 @@ export default class Api {
|
|||||||
return response.data;
|
return response.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
getRecentTLSLinks = async () => {
|
|
||||||
const response = await client.get("/status/recentTLSLinks");
|
|
||||||
return response.data;
|
|
||||||
}
|
|
||||||
|
|
||||||
getAuthStatus = async () => {
|
getAuthStatus = async () => {
|
||||||
const response = await client.get("/status/auth");
|
const response = await client.get("/status/auth");
|
||||||
return response.data;
|
return response.data;
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
@import './variables.module'
|
@import './variables.module'
|
||||||
|
|
||||||
|
#root
|
||||||
|
height: 100%
|
||||||
|
|
||||||
html,
|
html,
|
||||||
body
|
body
|
||||||
height: 100%
|
height: 100%
|
||||||
@@ -153,4 +156,4 @@ button
|
|||||||
|
|
||||||
// enable view elements inside redoc
|
// enable view elements inside redoc
|
||||||
.sc-dwsnSq
|
.sc-dwsnSq
|
||||||
height: 80vh !important
|
height: 80vh !important
|
||||||
|
|||||||
Reference in New Issue
Block a user