Skip to content

Commit

Permalink
Merge branch 'main' of github.com:opensearch-project/dashboards-obser…
Browse files Browse the repository at this point in the history
…vability into delete
  • Loading branch information
derek-ho committed Sep 20, 2023
2 parents 9ef64f2 + d67ec95 commit 886a226
Show file tree
Hide file tree
Showing 76 changed files with 4,514 additions and 2,116 deletions.
Binary file removed .cypress/.DS_Store
Binary file not shown.
11 changes: 6 additions & 5 deletions .cypress/integration/1_event_analytics.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ describe('Open flyout for a data row to see details', () => {
});
});

describe('Add/delete/switch explorer top level tabs', () => {
// skip for now due to tab removals
describe.skip('Add/delete/switch explorer top level tabs', () => {
beforeEach(() => {
landOnEventExplorer();
});
Expand Down Expand Up @@ -406,15 +407,15 @@ describe('Live tail stop automatically', () => {
landOnEventExplorer();
});

it('Moving to other tab should stop live tail automatically', () => {
it.skip('Moving to other tab should stop live tail automatically', () => {
clearQuerySearchBoxText('searchAutocompleteTextArea');
cy.get('[data-test-subj="searchAutocompleteTextArea"]').type(TEST_QUERIES[1].query);
cy.get('[data-test-subj=eventLiveTail]').click();
cy.get('[data-test-subj=eventLiveTail__delay10s]').click();
cy.get('.euiToastHeader__title').contains('On').should('exist');
});

it('Add a new tab', () => {
it.skip('Add a new tab', () => {
cy.get('[data-test-subj="eventExplorer__topLevelTabbing"]')
.find('button.euiTab')
.then((lists) => {
Expand All @@ -426,7 +427,7 @@ describe('Live tail stop automatically', () => {
});
});

it('Click to switch to another tab', () => {
it.skip('Click to switch to another tab', () => {
cy.get('[data-test-subj="eventExplorer__addNewTab"]', {
timeout: COMMAND_TIMEOUT_LONG,
}).click();
Expand All @@ -441,7 +442,7 @@ describe('Live tail stop automatically', () => {
.should('have.class', 'euiTab-isSelected');
});

it('Close current selected tab', () => {
it.skip('Close current selected tab', () => {
cy.get('[data-test-subj="eventExplorer__addNewTab"]', {
timeout: COMMAND_TIMEOUT_LONG,
}).click();
Expand Down
59 changes: 51 additions & 8 deletions .cypress/integration/2_notebooks.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import { SAMPLE_PANEL } from '../utils/panel_constants';

import { skipOn } from '@cypress/skip-test';

import { v4 as uuid4 } from 'uuid';

const moveToEventsHome = () => {
cy.visit(`${Cypress.env('opensearchDashboards')}/app/observability-logs#/`);
};
Expand Down Expand Up @@ -157,7 +159,7 @@ describe('Test reporting integration if plugin installed', () => {
beforeEach(() => {
cy.visit(`${Cypress.env('opensearchDashboards')}/app/observability-notebooks#/`);
cy.get('.euiTableCellContent').contains(TEST_NOTEBOOK).click();
cy.wait(delay);//page needs to process before checking
cy.wait(delay); //page needs to process before checking
cy.get('body').then(($body) => {
skipOn($body.find('#reportingActionsButton').length <= 0);
});
Expand Down Expand Up @@ -290,8 +292,9 @@ describe('Testing paragraphs', () => {

it('Adds a SQL query paragraph', () => {
cy.contains('Add paragraph').click();
cy.get('.euiContextMenuItem__text').contains('Code block').click(), { timeout: COMMAND_TIMEOUT_LONG };
cy.wait(delay);//SQL_QUERY_TEXT will sometimes fail to type without this delay
cy.get('.euiContextMenuItem__text').contains('Code block').click(),
{ timeout: COMMAND_TIMEOUT_LONG };
cy.wait(delay); //SQL_QUERY_TEXT will sometimes fail to type without this delay

cy.get('.euiTextArea').type(SQL_QUERY_TEXT);
cy.get('.euiButton__text').contains('Run').click();
Expand All @@ -301,6 +304,45 @@ describe('Testing paragraphs', () => {
cy.get('.euiDataGrid__overflow').should('exist');
});

it('Renders very long markdown as wrapped', () => {
cy.contains('Add paragraph').click();
cy.get('.euiContextMenuItem__text').contains('Code block').click(),
{ timeout: COMMAND_TIMEOUT_LONG };
cy.wait(delay); //SQL_QUERY_TEXT will sometimes fail to type without this delay

const testWord = uuid4().replace(/-/gi, '').repeat(10);
cy.get('.euiTextArea').type(`%md\n${testWord}`);
cy.get('.euiButton__text').contains('Run').click();

cy.get('p')
.contains(testWord)
.then((element) => {
const clientWidth = element[0].clientWidth;
const scrollWidth = element[0].scrollWidth;
console.log('paragraph', { clientWidth, scrollWidth });
expect(scrollWidth, 'Output Text has not been wrapped').to.be.at.most(clientWidth);
});
});

it('Renders very long query as wrapped', () => {
cy.contains('Add paragraph').click();
cy.get('.euiContextMenuItem__text').contains('Code block').click(),
{ timeout: COMMAND_TIMEOUT_LONG };
cy.wait(delay); //SQL_QUERY_TEXT will sometimes fail to type without this delay

const testWord = uuid4().replace(/-/gi, '').repeat(10);
cy.get('.euiTextArea').type(`%sql\nSELECT 1 AS ${testWord}`);
cy.get('.euiButton__text').contains('Run').click();

cy.get('b')
.contains(testWord)
.then((element) => {
const clientWidth = element[0].clientWidth;
const scrollWidth = element[0].scrollWidth;
expect(scrollWidth, 'Output Text has not been wrapped').to.be.at.most(clientWidth);
});
});

it('Adds an observability visualization paragraph', () => {
cy.contains('Add paragraph').click();
cy.get('.euiContextMenuItem__text').contains('Visualization').click();
Expand All @@ -319,8 +361,9 @@ describe('Testing paragraphs', () => {

it('Adds a PPL query paragraph', () => {
cy.contains('Add paragraph').click();
cy.get('.euiContextMenuItem__text').contains('Code block').click(), { timeout: COMMAND_TIMEOUT_LONG };;
cy.wait(delay);//PPL_QUERY_TEXT will sometimes fail to type without this delay
cy.get('.euiContextMenuItem__text').contains('Code block').click(),
{ timeout: COMMAND_TIMEOUT_LONG };
cy.wait(delay); //PPL_QUERY_TEXT will sometimes fail to type without this delay

cy.get('.euiTextArea').type(PPL_QUERY_TEXT);
cy.get('.euiButton__text').contains('Run').click();
Expand Down Expand Up @@ -433,7 +476,7 @@ describe('clean up all test data', () => {
cy.get('.euiButton__text').contains('Actions').trigger('mouseover').click();
cy.get('.euiContextMenuItem__text').contains('Delete').trigger('mouseover').click();
cy.get('button.euiButton--danger').should('be.disabled');
cy.get('input.euiFieldText[placeholder="delete"]').focus().type('delete', {delay: 50, });
cy.get('input.euiFieldText[placeholder="delete"]').focus().type('delete', { delay: 50 });
cy.get('button.euiButton--danger').should('not.be.disabled');
cy.get('.euiButton__text').contains('Delete').trigger('mouseover').click();
cy.get('.euiTextAlign').contains('No Queries or Visualizations').should('exist');
Expand All @@ -445,8 +488,8 @@ describe('clean up all test data', () => {
cy.get('.euiButton__text').contains('Actions').trigger('mouseover').click();
cy.get('.euiContextMenuItem__text').contains('Delete').trigger('mouseover').click();
cy.get('button.euiButton--danger').should('be.disabled');
cy.get('input.euiFieldText[placeholder="delete"]').focus().type('delete', { delay: 50, });
cy.get('input.euiFieldText[placeholder="delete"]').focus().type('delete', { delay: 50 });
cy.get('button.euiButton--danger').should('not.be.disabled');
cy.get('.euiButton__text').contains('Delete').trigger('mouseover').click();
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,15 @@ jobs:
with:
path: OpenSearch-Dashboards/plugins/dashboards-observability

- name: Load Plugin Bootstrap cache
uses: actions/cache@v3
with:
path: |
**/node_modules
**/target
key: ${{ runner.os }}-bootstrap-${{ hashFiles('OpenSearch-Dashboards/yarn.lock', 'OpenSearch-Dashboards/plugins/dashboards-observability/yarn.lock') }}
restore-keys: ${{ runner.os }}-bootstrap-

- name: Plugin Bootstrap
run: |
cd OpenSearch-Dashboards
yarn config set network-timeout 1000000 -g
yarn osd bootstrap || yarn osd bootstrap
uses: nick-fields/retry@v2
with:
timeout_minutes: 20
max_attempts: 2
command: |
cd OpenSearch-Dashboards
yarn config set network-timeout 1000000 -g
yarn osd bootstrap
- name: Test all dashboards-observability modules
run: |
Expand Down
36 changes: 21 additions & 15 deletions .github/workflows/integration-tests-workflow.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: Dashboards observability plugin E2E test
on: [pull_request, push]
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
env:
PLUGIN_NAME: dashboards-observability
OPENSEARCH_DASHBOARDS_VERSION: 'main'
Expand Down Expand Up @@ -34,14 +37,18 @@ jobs:
java-version: '11'

- name: Download observability artifact
uses: peternied/download-file@v2
uses: suisei-cn/actions-download-file@v1.4.0
with:
url: https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ env.OPENSEARCH_VERSION }}/latest/linux/x64/tar/builds/opensearch/plugins/opensearch-observability-${{ env.OPENSEARCH_PLUGIN_VERSION }}.zip
url: https://aws.oss.sonatype.org/service/local/artifact/maven/redirect?r=snapshots&g=org.opensearch.plugin&a=opensearch-observability&v=${{ env.OPENSEARCH_PLUGIN_VERSION }}-SNAPSHOT&p=zip
target: plugin-artifacts/
filename: observability.zip

- name: Download SQL artifact
uses: peternied/download-file@v2
uses: suisei-cn/actions-download-file@v1.4.0
with:
url: https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ env.OPENSEARCH_VERSION }}/latest/linux/x64/tar/builds/opensearch/plugins/opensearch-sql-${{ env.OPENSEARCH_PLUGIN_VERSION }}.zip
url: https://aws.oss.sonatype.org/service/local/artifact/maven/redirect?r=snapshots&g=org.opensearch.plugin&a=opensearch-sql-plugin&v=${{ env.OPENSEARCH_PLUGIN_VERSION }}-SNAPSHOT&p=zip
target: plugin-artifacts/
filename: sql.zip

- name: Download OpenSearch
uses: peternied/download-file@v2
Expand All @@ -56,23 +63,18 @@ jobs:

- name: Install observability plugin
run: |
/bin/bash -c "yes | ./opensearch-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT/bin/opensearch-plugin install file:$(pwd)/opensearch-observability-${{ env.OPENSEARCH_PLUGIN_VERSION }}.zip"
/bin/bash -c "yes | ./opensearch-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT/bin/opensearch-plugin install file:$(pwd)/plugin-artifacts/observability.zip"
shell: bash

- name: Install linux SQL plugin
- name: Install SQL plugin
run: |
/bin/bash -c "yes | ./opensearch-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT/bin/opensearch-plugin install file:$(pwd)/opensearch-sql-${{ env.OPENSEARCH_PLUGIN_VERSION }}.zip"
/bin/bash -c "yes | ./opensearch-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT/bin/opensearch-plugin install file:$(pwd)/plugin-artifacts/sql.zip"
shell: bash

- name: Run OpenSearch
run: /bin/bash -c "./opensearch-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT/bin/opensearch &"
shell: bash

- name: Sleep while OpenSearch starts
uses: peternied/action-sleep@v1
with:
seconds: 30

- name: Checkout OpenSearch Dashboards
uses: actions/checkout@v2
with:
Expand All @@ -85,11 +87,15 @@ jobs:
with:
path: OpenSearch-Dashboards/plugins/dashboards-observability

# While bootstrap requires node >= 16.14.0, OSD hasn't yet updated their version number in
# package.json, so we need to hardcode it for now. When it's fixed, this line can dynamically
# pull the value:
# $(node -p "(require('./OpenSearch-Dashboards/package.json').engines.node).match(/[.0-9]+/)[0]")
- name: Get node and yarn versions
working-directory: ${{ env.WORKING_DIR }}
id: versions_step
run: |
echo "::set-output name=node_version::$(node -p "(require('./OpenSearch-Dashboards/package.json').engines.node).match(/[.0-9]+/)[0]")"
echo "::set-output name=node_version::16"
echo "::set-output name=yarn_version::$(node -p "(require('./OpenSearch-Dashboards/package.json').engines.yarn).match(/[.0-9]+/)[0]")"
- name: Setup node
Expand All @@ -113,7 +119,7 @@ jobs:
run: |
cd OpenSearch-Dashboards
yarn start --no-base-path --no-watch &
sleep 400
sleep 200
- name: Install Cypress
run: |
Expand Down
5 changes: 5 additions & 0 deletions common/constants/explorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@ import { htmlIdGenerator } from '@elastic/eui';
import { ThresholdUnitType } from '../../public/components/event_analytics/explorer/visualizations/config_panel/config_panes/config_controls/config_thresholds';
import { VIS_CHART_TYPES } from './shared';

// URLs
export const EVENT_ANALYTICS_DOCUMENTATION_URL =
'https://opensearch.org/docs/latest/observability-plugin/event-analytics/';
export const OPEN_TELEMETRY_LOG_CORRELATION_LINK =
'https://opentelemetry.io/docs/reference/specification/logs/overview/#log-correlation';
export const LOG_EXPLORER_BASE_PATH = 'observability-logs#/explorer/';

export const RAW_QUERY = 'rawQuery';
export const FINAL_QUERY = 'finalQuery';
export const SELECTED_DATE_RANGE = 'selectedDateRange';
Expand Down Expand Up @@ -50,6 +53,8 @@ export const DEFAULT_COLUMNS = ['', 'Time', '_source'];
export const OTEL_TRACE_ID = 'traceId';
export const JAEGER_TRACE_ID = 'traceID';
export const DATE_PICKER_FORMAT = 'YYYY-MM-DD HH:mm:ss';
export const DATE_DISPLAY_FORMAT = 'MMM D, YYYY @ HH:mm:ss.SSS';
export const DEFAULT_DATETIME_STRING = 'now';
export const TIME_INTERVAL_OPTIONS = [
{
text: 'Minute',
Expand Down
24 changes: 21 additions & 3 deletions common/types/explorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,7 @@ export interface IExplorerFields {
}

export interface EmptyTabParams {
tabIds: string[] | undefined;
queries: any | undefined;
explorerData: any | undefined;
tabIds: string[];
}

export interface ILogExplorerProps {
Expand Down Expand Up @@ -383,3 +381,23 @@ export interface VisSpecificMetaData {
x_coordinate: string;
y_coordinate: string;
}

export type MOMENT_UNIT_OF_TIME =
| 'years'
| 'y'
| 'quarters'
| 'Q'
| 'months'
| 'M'
| 'weeks'
| 'w'
| 'days'
| 'd'
| 'hours'
| 'h'
| 'minutes'
| 'm'
| 'seconds'
| 's'
| 'milliseconds'
| 'ms';
2 changes: 1 addition & 1 deletion common/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ export {
buildRawQuery,
composeFinalQuery,
removeBacktick,
} from './query_utils';
} from '../../public/components/common/query_utils';

export * from './core_services';
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,12 @@
"debug": "^3.1.0",
"yaml": "^2.2.2",
"tough-cookie": "^4.1.3",
"semver": "^7.5.2"
"semver": "^7.5.2",
"@cypress/request": "^3.0.0"
},
"eslintIgnore": [
"common/query_manager/antlr/output/*",
"node_modules/*",
"target/*"
]
}
}
2 changes: 1 addition & 1 deletion public/components/application_analytics/helpers/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { NEW_SELECTED_QUERY_TAB, TAB_CREATED_TYPE } from '../../../../common/con
import { SPAN_REGEX } from '../../../../common/constants/shared';
import { VisualizationType } from '../../../../common/types/custom_panels';
import { IField } from '../../../../common/types/explorer';
import { preprocessQuery } from '../../../../common/utils/query_utils';
import { preprocessQuery } from '../../common/query_utils';
import { fetchVisualizationById } from '../../../components/custom_panels/helpers/utils';
import {
init as initFields,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import { isEmpty } from 'lodash';
import {
DATE_PICKER_FORMAT,
PPL_DEFAULT_PATTERN_REGEX_FILETER,
} from '../../common/constants/explorer';
} from '../../../common/constants/explorer';
import {
PPL_INDEX_INSERT_POINT_REGEX,
PPL_INDEX_REGEX,
PPL_NEWLINE_REGEX,
} from '../../common/constants/shared';
} from '../../../common/constants/shared';

/**
* @param literal - string literal that will be put inside single quotes in PPL command
Expand Down
1 change: 0 additions & 1 deletion public/components/common/search/search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {
EuiBadge,
EuiContextMenuPanel,
EuiToolTip,
EuiCallOut,
} from '@elastic/eui';
import { DatePicker } from './date_picker';
import '@algolia/autocomplete-theme-classic';
Expand Down
Loading

0 comments on commit 886a226

Please sign in to comment.