Skip to content

Commit

Permalink
Merge feature/observability into main branch (#135)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuali925 authored Oct 14, 2021
2 parents 5823788 + 4ae70c4 commit 7e6145f
Show file tree
Hide file tree
Showing 371 changed files with 30,970 additions and 1,868 deletions.
413 changes: 413 additions & 0 deletions .cypress/integration/notebooks.spec.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ describe('Dump test data', () => {

describe('Testing dashboard table empty state', () => {
beforeEach(() => {
cy.visit('app/trace-analytics-dashboards#/dashboard', {
cy.visit('app/observability#/trace_analytics/home', {
onBeforeLoad: (win) => {
win.sessionStorage.clear();
},
Expand All @@ -104,7 +104,7 @@ describe('Testing dashboard table empty state', () => {

describe('Testing dashboard table', () => {
beforeEach(() => {
cy.visit('app/trace-analytics-dashboards#/dashboard', {
cy.visit('app/observability#/trace_analytics/home', {
onBeforeLoad: (win) => {
win.sessionStorage.clear();
},
Expand Down Expand Up @@ -154,7 +154,7 @@ describe('Testing dashboard table', () => {
cy.contains(' (13)').should('exist');
cy.contains('client_create_order').should('exist');

cy.get('.euiSideNavItemButton__label').contains('Dashboard').click();
cy.get('.euiSideNavItemButton__label').contains('Trace analytics').click();
cy.wait(delay);

cy.contains('client_create_order').should('exist');
Expand All @@ -163,7 +163,7 @@ describe('Testing dashboard table', () => {

describe('Testing plots', () => {
beforeEach(() => {
cy.visit('app/trace-analytics-dashboards#/dashboard', {
cy.visit('app/observability#/trace_analytics/home', {
onBeforeLoad: (win) => {
win.sessionStorage.clear();
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { delay, SERVICE_NAME, setTimeFilter } from '../utils/constants';

describe('Testing services table empty state', () => {
beforeEach(() => {
cy.visit('app/trace-analytics-dashboards#/services', {
cy.visit('app/observability#/trace_analytics/services', {
onBeforeLoad: (win) => {
win.sessionStorage.clear();
},
Expand All @@ -46,7 +46,7 @@ describe('Testing services table empty state', () => {

describe('Testing services table', () => {
beforeEach(() => {
cy.visit('app/trace-analytics-dashboards#/services', {
cy.visit('app/observability#/trace_analytics/services', {
onBeforeLoad: (win) => {
win.sessionStorage.clear();
},
Expand Down Expand Up @@ -77,7 +77,7 @@ describe('Testing service view empty state', () => {
if (err.message.includes('ResizeObserver loop'))
return false;
});
cy.visit(`app/trace-analytics-dashboards#/services/${SERVICE_NAME}`, {
cy.visit(`app/observability#/trace_analytics/services/${SERVICE_NAME}`, {
onBeforeLoad: (win) => {
win.sessionStorage.clear();
},
Expand All @@ -99,7 +99,7 @@ describe('Testing service view', () => {
if (err.message.includes('ResizeObserver loop'))
return false;
});
cy.visit(`app/trace-analytics-dashboards#/services/${SERVICE_NAME}`, {
cy.visit(`app/observability#/trace_analytics/services/${SERVICE_NAME}`, {
onBeforeLoad: (win) => {
win.sessionStorage.clear();
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { delay, setTimeFilter, SPAN_ID, TRACE_ID } from '../utils/constants';

describe('Testing traces table empty state', () => {
beforeEach(() => {
cy.visit('app/trace-analytics-dashboards#/traces', {
cy.visit('app/observability#/trace_analytics/traces', {
onBeforeLoad: (win) => {
win.sessionStorage.clear();
},
Expand All @@ -46,7 +46,7 @@ describe('Testing traces table empty state', () => {

describe('Testing traces table', () => {
beforeEach(() => {
cy.visit('app/trace-analytics-dashboards#/traces', {
cy.visit('app/observability#/trace_analytics/traces', {
onBeforeLoad: (win) => {
win.sessionStorage.clear();
},
Expand Down Expand Up @@ -77,7 +77,7 @@ describe('Testing traces table', () => {

describe('Testing trace view', () => {
beforeEach(() => {
cy.visit(`app/trace-analytics-dashboards#/traces/${TRACE_ID}`, {
cy.visit(`app/observability#/trace_analytics/traces/${TRACE_ID}`, {
onBeforeLoad: (win) => {
win.sessionStorage.clear();
},
Expand Down
49 changes: 44 additions & 5 deletions .cypress/utils/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@
* permissions and limitations under the License.
*/

export const delay = 1500;

// trace analytics
export const TRACE_ID = '8832ed6abbb2a83516461960c89af49d';
export const SPAN_ID = 'a673bc074b438374';
export const SERVICE_NAME = 'frontend-client';

export const testDataSet = [
{
mapping_url: 'https://raw.githubusercontent.com/opensearch-project/trace-analytics/main/.cypress/utils/otel-v1-apm-service-map-mappings.json',
Expand All @@ -42,11 +49,6 @@ export const testDataSet = [
},
]

export const delay = 1500;
export const TRACE_ID = '8832ed6abbb2a83516461960c89af49d';
export const SPAN_ID = 'a673bc074b438374';
export const SERVICE_NAME = 'frontend-client';

export const setTimeFilter = (setEndTime = false, refresh = true) => {
const startTime = 'Mar 25, 2021 @ 10:00:00.000';
const endTime = 'Mar 25, 2021 @ 11:00:00.000';
Expand Down Expand Up @@ -74,3 +76,40 @@ export const setTimeFilter = (setEndTime = false, refresh = true) => {
if (refresh) cy.get('.euiButton__text').contains('Refresh').click();
cy.wait(delay);
};

// notebooks
export const TEST_NOTEBOOK = 'Test Notebook';
export const SAMPLE_URL = 'https://github.com/opensearch-project/sql/tree/main/sql-jdbc';
export const MARKDOWN_TEXT = `%md
# Heading 1
#### List and links
* 1
* 2
* [SQL JDBC](${SAMPLE_URL})
---
#### Code block
* Explain SQL
\`\`\`
POST _plugins/_sql/_explain
{
"query": "SELECT * FROM my-index LIMIT 50"
}
\`\`\`
#### Table
| a1 | b1 | c1 | d1 |
|----|----|----|----|
| a2 | b2 | c2 | d2 |
| a3 | b3 | c3 | d3 |
`

export const SQL_QUERY_TEXT = `%sql
select * from opensearch_dashboards_sample_data_flights limit 20
`

export const PPL_QUERY_TEXT = `%ppl
source=opensearch_dashboards_sample_data_flights
`
26 changes: 14 additions & 12 deletions .github/workflows/test-and-build-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: Test and Build Trace Analytics
on: [pull_request, push]

env:
PLUGIN_NAME: trace-analytics-dashboards
PLUGIN_NAME: observability
OPENSEARCH_VERSION: '1.x'
OPENSEARCH_PLUGIN_VERSION: 1.1.0.0

Expand Down Expand Up @@ -43,33 +43,35 @@ jobs:
- name: Checkout Plugin
uses: actions/checkout@v2
with:
path: OpenSearch-Dashboards/plugins/trace-analytics
path: OpenSearch-Dashboards/plugins/observability

- name: Plugin Bootstrap
run: |
cd OpenSearch-Dashboards/plugins/trace-analytics
cd OpenSearch-Dashboards/plugins/observability
yarn osd bootstrap
- name: Test
run: |
cd OpenSearch-Dashboards/plugins/trace-analytics
yarn test --coverage
# TODO enable unit tests when ready
# - name: Test
# run: |
# cd OpenSearch-Dashboards/plugins/observability
# yarn test --coverage

- name: Upload coverage
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
direcotry: ./OpenSearch-Dashboards/plugins/trace-analytics
direcotry: ./OpenSearch-Dashboards/plugins/observability

# TODO remove hard coded version when observability is ready
- name: Build Artifact
run: |
cd OpenSearch-Dashboards/plugins/trace-analytics
yarn build
cd OpenSearch-Dashboards/plugins/observability
yarn build --opensearch-dashboards-version 1.1.0
mv ./build/*.zip ./build/${{ env.PLUGIN_NAME }}-${{ env.OPENSEARCH_PLUGIN_VERSION }}.zip
- name: Upload Artifact
uses: actions/upload-artifact@v1
with:
name: trace-analytics
path: ./OpenSearch-Dashboards/plugins/trace-analytics/build
name: observability
path: ./OpenSearch-Dashboards/plugins/observability/build

13 changes: 8 additions & 5 deletions MAINTAINERS.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# Trace Analytics Maintainers
# Observability Maintainers

## Maintainers
| Maintainer | GitHub ID | Affiliation |
|------------------------|---------------------------------------------------|-------------|
| David Cui | [davidcui1225](https://github.com/davidcui1225) | Amazon |
| Joshua Li | [joshuali925](https://github.com/joshuali925) | Amazon |
| Maintainer | GitHub ID | Affiliation |
|---------------|-------------------------------------------------|-------------|
| David Cui | [davidcui1225](https://github.com/davidcui1225) | Amazon |
| Eric Wei | [mengweieric](https://github.com/mengweieric) | Amazon |
| Joshua Li | [joshuali925](https://github.com/joshuali925) | Amazon |
| Sean Li | [sejli](https://github.com/sejli) | Amazon |
| Shenoy Pratik | [ps48](https://github.com/ps48) | Amazon |
37 changes: 37 additions & 0 deletions common/constants/custom_panels.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/

export const CUSTOM_PANELS_API_PREFIX = '/api/observability/operational_panels';
export const CUSTOM_PANELS_DOCUMENTATION_URL = 'https://www.opensearch.org';
export const CREATE_PANEL_MESSAGE = 'Enter a name to describe the purpose of this custom panel.';
export const RENAME_VISUALIZATION_MESSAGE =
'Enter a name to describe the purpose of this visualization.';

export type VisualizationType = {
id: string;
title: string;
x: number;
y: number;
w: number;
h: number;
query: string;
type: string;
};

export type PanelType = {
name: string;
dateCreated: string;
dateModified: string;
visualizations: VisualizationType[];
timeRange: { to: string; from: string };
queryFilter: { query: string; language: string };
refreshConfig: { pause: string; value: string };
};
69 changes: 69 additions & 0 deletions common/constants/explorer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/

export const RAW_QUERY = 'rawQuery';
export const FINAL_QUERY = 'finalQuery';
export const SELECTED_DATE_RANGE = 'selectedDateRange';
export const INDEX = 'indexPattern';
export const SELECTED_FIELDS = 'selectedFields';
export const UNSELECTED_FIELDS = 'unselectedFields';
export const AVAILABLE_FIELDS = 'availableFields';
export const QUERIED_FIELDS = 'queriedFields';
export const TAB_ID_TXT_PFX = 'query-panel-';
export const TAB_TITLE = 'New query';
export const TAB_CHART_TITLE = 'Visualizations';
export const TAB_EVENT_TITLE = 'Events';
export const TAB_EVENT_ID_TXT_PFX = 'main-content-events-';
export const TAB_CHART_ID_TXT_PFX = 'main-content-vis-';

export const DATE_PICKER_FORMAT = 'YYYY-MM-DD HH:mm:ss';
export const TIME_INTERVAL_OPTIONS = [
{
display: 'Auto',
val: 'h' // same as value of Hour for now
},
{
display: 'Minute',
val: 'm'
},
{
display: 'Hour',
val: 'h'
},
{
display: 'Day',
val: 'd'
},
{
display: 'Week',
val: 'w'
},
{
display: 'Month',
val: 'M'
},
{
display: 'Year',
val: 'y'
},
]

// redux
export const SELECTED_QUERY_TAB = 'selectedQueryTab';
export const QUERY_TAB_IDS = 'queryTabIds';
export const NEW_SELECTED_QUERY_TAB = 'newSelectedQueryTab';
export const REDUX_EXPL_SLICE_QUERIES = 'queries';
export const REDUX_EXPL_SLICE_QUERY_RESULT = 'queryResults';
export const REDUX_EXPL_SLICE_FIELDS = 'fields';
export const REDUX_EXPL_SLICE_QUERY_TABS = 'queryTabs';
export const REDUX_EXPL_SLICE_VISUALIZATION = 'explorerVisualization';
export const REDUX_EXPL_SLICE_COUNT_DISTRIBUTION = 'countDistributionVisualization'

29 changes: 29 additions & 0 deletions common/constants/notebooks.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/

export const NOTEBOOKS_API_PREFIX = '/api/observability/notebooks';
export const NOTEBOOKS_SELECTED_BACKEND = 'DEFAULT'; // ZEPPELIN || DEFAULT
export const NOTEBOOKS_FETCH_SIZE = 1000;
export const CREATE_NOTE_MESSAGE = 'Enter a name to describe the purpose of this notebook.';
export const NOTEBOOKS_DOCUMENTATION_URL = 'https://opensearch.org/docs/dashboards/notebooks/';

export const zeppelinURL = 'http://localhost:8080';

export const wreckOptions = {
baseUrl: zeppelinURL,
headers: { 'Content-Type': 'application/json' },
};

const BASE_NOTEBOOKS_URI = '/_plugins/_notebooks';
export const OPENSEARCH_NOTEBOOKS_API = {
GET_NOTEBOOKS: `${BASE_NOTEBOOKS_URI}/notebooks`,
NOTEBOOK: `${BASE_NOTEBOOKS_URI}/notebook`,
};
Loading

0 comments on commit 7e6145f

Please sign in to comment.