Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor trace analytics in main to merge into observability #102

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
211 commits
Select commit Hold shift + click to select a range
d919bd1
Initial commit
amazon-auto Nov 12, 2020
853f23e
initial commit
joshuali925 Jul 28, 2020
e1917bc
WIP
joshuali925 Aug 4, 2020
c83b370
refactor
joshuali925 Aug 4, 2020
27463ad
add filter menu
joshuali925 Aug 4, 2020
95242ee
add plots, refactor
joshuali925 Aug 5, 2020
55e838d
add data for traces table
joshuali925 Aug 5, 2020
c9a0d5f
add service map
joshuali925 Aug 5, 2020
d877f27
add service map scale
joshuali925 Aug 6, 2020
e4def7e
bug fix
joshuali925 Aug 6, 2020
e1d78fc
add popover charts
joshuali925 Aug 6, 2020
4d6f0a3
add annotation to popover charts
joshuali925 Aug 6, 2020
990324f
style changes
joshuali925 Aug 6, 2020
fe07e9d
downgrade eui
joshuali925 Aug 6, 2020
27f1582
add colorscale to service map
joshuali925 Aug 7, 2020
8b1d1b0
bug fix
joshuali925 Aug 7, 2020
9f79a57
add hover for boxplot and error plot
joshuali925 Aug 11, 2020
94852ef
align box plot with scale
joshuali925 Aug 11, 2020
38db88d
fix service map width
joshuali925 Aug 12, 2020
52479ac
update services view chart style
joshuali925 Aug 17, 2020
75d00a1
lift search states up
joshuali925 Aug 18, 2020
aea0b94
separate filters component
joshuali925 Aug 18, 2020
777e339
use combo box instead of super select, add values form row
joshuali925 Aug 18, 2020
e0106a7
add query route
joshuali925 Aug 18, 2020
04a02d7
add filter badges
joshuali925 Aug 18, 2020
95216ce
add filter badges
joshuali925 Aug 19, 2020
50642ed
refactor
joshuali925 Aug 19, 2020
4d2ff05
WIP queries
joshuali925 Aug 20, 2020
bc6b078
WIP queries
joshuali925 Aug 20, 2020
1fa801a
change nbsps to margin
joshuali925 Aug 20, 2020
ddeacc2
WIP queries
joshuali925 Aug 20, 2020
59d6aae
fix useeffect
joshuali925 Aug 20, 2020
175b8bc
WIP queries
joshuali925 Aug 21, 2020
284e5f5
change query structure
joshuali925 Aug 21, 2020
d89f017
WIP queries
joshuali925 Aug 21, 2020
794cabb
WIP queries
joshuali925 Aug 21, 2020
3dec0dc
WIP queries
joshuali925 Aug 21, 2020
68a7b27
fix path bug
joshuali925 Aug 21, 2020
1f1fc76
WIP queries
joshuali925 Aug 24, 2020
ae2efca
WIP queries
joshuali925 Aug 24, 2020
e7afbc2
add lodash
joshuali925 Aug 27, 2020
8580fd7
finish queries
joshuali925 Aug 27, 2020
c856656
scrollable span details
joshuali925 Aug 27, 2020
8046c03
move queries to queries folder
joshuali925 Aug 27, 2020
d2d7872
remove mock data
joshuali925 Aug 27, 2020
19f9cf9
add table item count
joshuali925 Aug 27, 2020
2d59630
refactor, improve colors
joshuali925 Aug 28, 2020
2cf9ab0
force service name existence on gantt
joshuali925 Aug 28, 2020
6652e19
fix height
joshuali925 Aug 28, 2020
8067c47
encode url
joshuali925 Aug 28, 2020
88940a2
fix children key
joshuali925 Aug 28, 2020
f78bb26
update UI
joshuali925 Sep 1, 2020
8be0fe9
adapt new data model
joshuali925 Sep 1, 2020
5a44a2a
update components
joshuali925 Sep 2, 2020
b95b2b1
update margins and colors
joshuali925 Sep 2, 2020
975bff5
refactor
joshuali925 Sep 10, 2020
7ea87ed
Bump to Kibana 7.9.1
joshuali925 Sep 15, 2020
9e7fda0
Remove explicit eui dependency
joshuali925 Sep 15, 2020
b5eb423
Build config update
joshuali925 Sep 15, 2020
f0e254a
Update tooltip
joshuali925 Oct 20, 2020
cba0b14
WIP filters
joshuali925 Oct 21, 2020
4da40c9
Add filters UI
joshuali925 Oct 26, 2020
7471482
Remove view log, user id, benchmark
joshuali925 Oct 26, 2020
34d0342
Add sql endpoint to server side
joshuali925 Oct 27, 2020
8f70e25
Add dynamic scale to latency variance
joshuali925 Oct 27, 2020
e6cb7a9
Add filters functionality on DSL queries
joshuali925 Oct 28, 2020
461bcc9
Add latency variance query
joshuali925 Oct 28, 2020
d30b1bc
Add range to gantt chart to accomondate error message
joshuali925 Oct 28, 2020
b03add9
Fix plots height, combine error rate column query
joshuali925 Oct 28, 2020
4150a3e
Add dynamic interval to plots, update plots
joshuali925 Oct 28, 2020
e887cf1
Disable tooltip wrap
joshuali925 Oct 28, 2020
f28c16f
Use localStorage
joshuali925 Oct 29, 2020
86cb4e9
Enable click to add filter by trace group
joshuali925 Oct 29, 2020
5b3c1e2
Bug fixes and optimize
joshuali925 Oct 29, 2020
73ae856
Update error flag definition
joshuali925 Oct 29, 2020
1f17f8b
Add percentile column
joshuali925 Oct 29, 2020
609560d
Fix dependency security problem
joshuali925 Oct 29, 2020
55d5271
Add filters for services
joshuali925 Oct 30, 2020
a8ef961
Update percentile calculations to match definition
joshuali925 Oct 30, 2020
1155eac
Update readme
joshuali925 Oct 30, 2020
9702e9c
Add percentile filter
joshuali925 Oct 30, 2020
61b2d1f
Update readme
joshuali925 Oct 30, 2020
6d2d731
Remove user id text
joshuali925 Oct 30, 2020
e951963
Keep latency variance resistent to percentile filters
joshuali925 Oct 30, 2020
f21789c
Bug fix
joshuali925 Oct 30, 2020
f92eabb
Fix date display with timezone
joshuali925 Nov 2, 2020
516893d
Update timeformat
joshuali925 Nov 2, 2020
1c75c31
Add sort to latency variance
joshuali925 Nov 2, 2020
2060410
Update queries and filter styles
joshuali925 Nov 2, 2020
52d26c5
Update queries
joshuali925 Nov 2, 2020
f956e25
Refactor
joshuali925 Nov 2, 2020
c79bcfb
Update README.md
RajivTaori Nov 3, 2020
e988613
add hooks eslint
joshuali925 Nov 3, 2020
ab0825d
Fix memory leak warning
joshuali925 Nov 3, 2020
c47f3fd
WIP service map
joshuali925 Nov 4, 2020
7858047
Update data modal
joshuali925 Nov 4, 2020
58da9e3
Add connected services field
joshuali925 Nov 4, 2020
8d1727c
Add empty state
joshuali925 Nov 4, 2020
dd4f005
Fix error flag definition
joshuali925 Nov 4, 2020
74c9ca3
Revert "Fix error flag definition"
joshuali925 Nov 4, 2020
c6ebb5e
Fix services view error rate
joshuali925 Nov 4, 2020
9b7c525
WIP service map
joshuali925 Nov 4, 2020
98379eb
WIP service map
joshuali925 Nov 5, 2020
79405d1
Address UI comments
joshuali925 Nov 5, 2020
b12e12d
Add focus on search to service map
joshuali925 Nov 5, 2020
f886cfa
Bug fix
joshuali925 Nov 5, 2020
078a036
WIP service map scale
joshuali925 Nov 5, 2020
09feb6d
WIP service map
joshuali925 Nov 5, 2020
d80f862
WIP service map scale
joshuali925 Nov 5, 2020
2cb71d4
WIP service map
joshuali925 Nov 5, 2020
24d21ed
Rename dsl field
joshuali925 Nov 6, 2020
03d6487
WIP Service filter
joshuali925 Nov 6, 2020
5ecb168
Bug fix
joshuali925 Nov 6, 2020
d729c6d
WIP Service filter
joshuali925 Nov 6, 2020
063efb3
Add related services to service view to set opacity
joshuali925 Nov 6, 2020
00e24eb
Update data modal, disable sql endpoint
joshuali925 Nov 6, 2020
73cc1cf
Hide dots when there's no data in 24-hr trend
joshuali925 Nov 6, 2020
841e3e6
Increase precision on percentile filter
joshuali925 Nov 6, 2020
4a36f8b
Update queries
joshuali925 Nov 7, 2020
79a4d8b
Bug fix
joshuali925 Nov 7, 2020
051e5fc
Set valid filters on different pages
joshuali925 Nov 9, 2020
61e1cd2
Bug fixes
joshuali925 Nov 9, 2020
6eb398d
Fix service map queries
joshuali925 Nov 9, 2020
caea531
Update queries to filter by allowed traceIds
joshuali925 Nov 9, 2020
0c1facf
Add empty state when no indices
joshuali925 Nov 9, 2020
20e4dd1
Fix service map queries, adjust box plot
joshuali925 Nov 9, 2020
d4c402a
Bug fixes, version 0.0.2
joshuali925 Nov 9, 2020
53474d9
Address pre check comments
joshuali925 Nov 10, 2020
c163b48
Update sorting in dashboard table
joshuali925 Nov 10, 2020
9b6475d
Update to 0.0.3, remove unneeded files
joshuali925 Nov 10, 2020
cceae03
Bug fixes, refactor
joshuali925 Nov 10, 2020
65a28f2
Address FnF comments
joshuali925 Nov 11, 2020
db99ddd
Disable service filter on dashboard, adjust queries
joshuali925 Nov 11, 2020
df5c4bf
Revert complex queries
joshuali925 Nov 11, 2020
e17555b
Workaround to sorting/pagination bug in dashboard table
joshuali925 Nov 11, 2020
debf15d
Add cypress dependency, rename plugin
joshuali925 Nov 11, 2020
189ba2b
Add cypress tests, update config
joshuali925 Nov 12, 2020
742b819
Add license headers, fix readme
joshuali925 Nov 12, 2020
f99a442
Remove related services query
joshuali925 Nov 13, 2020
f5b9503
Fetch from ES when sorting traces table
joshuali925 Nov 13, 2020
38c6495
Increase padding between service map scale label and title
joshuali925 Nov 13, 2020
6c3d218
Bug fix
joshuali925 Nov 13, 2020
9934287
Merge pull request #1 from joshuali925/rebase-main
anirudha Nov 13, 2020
b95d4bf
Move service map UI and update status.code definition (#3)
joshuali925 Nov 17, 2020
6449ee5
Upgrade to ODFE 1.12.0 (#5)
joshuali925 Nov 20, 2020
ea541e7
Merge develop to main branch for ODFE 1.12 release (#6)
joshuali925 Nov 24, 2020
82e8950
Improve colors on trace view charts (#8)
joshuali925 Nov 24, 2020
de949b5
Side bar change for trace analytics (#9)
zhyuanqi Nov 25, 2020
14318cf
remove logo for side bar menu (#10)
zhyuanqi Dec 1, 2020
d85d543
Optimize plotly library size and server error messages (#11)
joshuali925 Dec 2, 2020
e5e174d
Show message if user cannot access required indices (#12)
joshuali925 Dec 7, 2020
60a7405
Bump ini from 1.3.5 to 1.3.8 (#13)
dependabot[bot] Dec 14, 2020
7b3468b
Update missing configuration message
joshuali925 Jan 27, 2021
b9bf44f
Fix y-range for 24 hr latency line plot (#18)
joshuali925 Jan 29, 2021
20165ac
Bump trace analytics to 7.10.2, cherry-pick jest tests (#19)
joshuali925 Feb 1, 2021
a5ad16a
add Linux DCO to PR template
davidcui1225 Feb 15, 2021
e80d11c
Merge pull request #22 from davidcui-amzn/add-linux-dco
davidcui1225 Feb 15, 2021
fc83014
Fix service map to respect to time filter (#23)
joshuali925 Feb 18, 2021
d3363ed
bump lodash version to 4.17.21
davidcui1225 Feb 25, 2021
ed03026
Merge pull request #24 from davidcui-amzn/upgrade-lodash-cve
davidcui1225 Feb 26, 2021
b69de2d
Extend the indices pattern to match service map data (#21)
WassimDhib Feb 26, 2021
c76ef09
Fix index exists query (#25)
joshuali925 Feb 27, 2021
9cdc56d
update dco
davidcui1225 Mar 2, 2021
69d14bb
Merge pull request #26 from davidcui-amzn/update-dco
davidcui1225 Mar 2, 2021
2f83896
Allow filtering by traceGroup and service (#28)
joshuali925 Mar 29, 2021
d927a66
Change styles for unmatched service nodes (#29)
joshuali925 Mar 31, 2021
5ad2e01
Migrate trace analytics to OpenSearch Dashboards (#1)
joshuali925 Apr 16, 2021
cf5c973
Change nav bar to use OpenSearch (#2)
joshuali925 Apr 19, 2021
c564960
Add license headers and pull request template for OpenSearch (#3)
joshuali925 Apr 19, 2021
9c78938
Change plugin versions to 1.0.0 (#4)
joshuali925 Apr 23, 2021
55e2e1f
Rebase new commits from opendistro repo (#5)
joshuali925 Apr 23, 2021
6dc245e
change version to beta1, update workflows and config files (#7)
davidcui1225 Apr 27, 2021
b6803cf
Add release notes for OpenSearch beta1 release (#8)
davidcui1225 Apr 27, 2021
f6b715a
rename artifacts to follow camel case (#9)
davidcui1225 Apr 29, 2021
5df31e6
Rename Plugin ID (#10)
davidcui1225 Apr 29, 2021
56ed90e
Update issue template with multiple labels
VachaShah May 7, 2021
b06920e
Merge pull request #11 from VachaShah/update_template
anirudha May 11, 2021
876a413
Bug fixes and enhancements on services (#38)
joshuali925 May 6, 2021
3ea2b3e
Revert "Revert to traceGroup from traceGroupFields (#37)", add test d…
joshuali925 May 12, 2021
4e89029
Rename sql api, update documentation link (#20)
joshuali925 May 18, 2021
13a4bc6
Use separate latency trend query (#41)
joshuali925 May 18, 2021
b7b5088
Increase truncation point, add tooltip if text is truncated (#42)
joshuali925 May 18, 2021
9742d96
Use scripted metrics instead of terms query to reduce number of bucke…
joshuali925 May 19, 2021
5912bf4
Merge branch 'main' into pick-odfe
joshuali925 May 19, 2021
c0812ce
Add spans flyout and data grid to view/filter attributes, switch filt…
joshuali925 May 25, 2021
b36b04e
Add jest and cypress tests for spans components (#46)
joshuali925 May 25, 2021
9a2dc12
Add license headers
joshuali925 May 25, 2021
e252b95
update sql endpoint
joshuali925 May 25, 2021
aeaabb2
Merge pull request #13 from opensearch-project/pick-odfe
joshuali925 May 25, 2021
7ec8cfc
Update version to rc1 (#22)
joshuali925 May 25, 2021
12bd41a
Update version and release notes for version 1.0.0.0-rc1 (#26)
joshuali925 May 26, 2021
3022e46
Bump glob-parent from 5.1.1 to 5.1.2 (#40)
dependabot[bot] Jun 14, 2021
ff64cf1
Add codecov (#60)
joshuali925 Jun 24, 2021
7a7e88a
Level up markdown contents, add link checker workflow (#57)
joshuali925 Jun 25, 2021
e137a25
Bump version to 1.0.0.0 and add release notes (#61)
joshuali925 Jun 30, 2021
55cb128
Fix release notes links (#62)
joshuali925 Jul 1, 2021
44c4d04
Move documents and repo setups
joshuali925 Aug 26, 2021
0ea8099
Remove manual sidenav index
joshuali925 Aug 26, 2021
2af17ab
Add placeholders pages for trace analytics
joshuali925 Aug 27, 2021
6179cd6
Move TA to subdirectory
joshuali925 Aug 27, 2021
5f0f841
Merge remote-tracking branch 'TA/main' into feature/merge-trace-analy…
joshuali925 Aug 27, 2021
6563071
Move TA to subdirectory
joshuali925 Aug 27, 2021
590849f
Update maintainers
joshuali925 Aug 27, 2021
3243dca
Disable workflows
joshuali925 Aug 27, 2021
910714b
Merge branch 'feature/setup-trace-analytics' into feature/merge-trace…
joshuali925 Aug 27, 2021
92dc061
Merge branch 'feature/observability' of github.com:opensearch-project…
joshuali925 Aug 27, 2021
f714958
Move observability to trace analytics position in dashboards side nav
joshuali925 Aug 27, 2021
46b3bea
Organize trace analytics project structure
joshuali925 Aug 27, 2021
1bb5888
Migrate trace analytics components to observability
joshuali925 Aug 30, 2021
d060a6a
Merge branch 'feature/observability' into feature/merge-trace-analytics
joshuali925 Aug 31, 2021
74ba9ad
Refactor constants and remove unused trace analytics components
joshuali925 Sep 1, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion common/constants/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const PPL_ENDPOINT = '/_plugins/_ppl';

export const observabilityID = 'observability';
export const observabilityTitle = 'Observability';
export const observabilityPluginOrder = 500;
export const observabilityPluginOrder = 6000;

// Shared Constants
export const UI_DATE_FORMAT = 'MM/DD/YYYY hh:mm A';
Expand Down
23 changes: 23 additions & 0 deletions common/constants/trace_analytics.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* 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 DATA_PREPPER_INDEX_NAME = 'otel-v1-apm-span-*';
export const DATA_PREPPER_SERVICE_INDEX_NAME = 'otel-v1-apm-service-map*';
export const TRACE_ANALYTICS_DATE_FORMAT = 'MM/DD/YYYY HH:mm:ss';
export const TRACE_ANALYTICS_PLOTS_DATE_FORMAT = 'MMM D, YYYY HH:mm:ss';
export const SERVICE_MAP_MAX_NODES = 500;
// size limit when requesting edge related queries, not necessarily the number of edges
export const SERVICE_MAP_MAX_EDGES = 1000;
export const TRACES_MAX_NUM = 3000;
export const TRACE_ANALYTICS_DOCUMENTATION_LINK = 'https://docs-beta.opensearch.org/monitoring-plugins/trace/';

export const TRACE_ANALYTICS_INDICES_ROUTE = '/api/observability/trace_analytics/indices';
export const TRACE_ANALYTICS_DSL_ROUTE = '/api/observability/trace_analytics/query';
1 change: 1 addition & 0 deletions public/components/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export const App = ({ CoreStart, pplService }: ObservabilityAppDeps) => {
path={['/trace_analytics', '/trace_analytics/home']}
render={(props) => (
<TraceAnalyticsHome
{...props}
chrome={chrome}
http={http}
parentBreadcrumb={parentBreadcrumb}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
/*
* 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.
*/

/*
* Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/

/// <reference types="cypress" />

import { delay, setTimeFilter } from '../utils/constants';

describe('Testing dashboard table empty state', () => {
beforeEach(() => {
cy.visit('app/trace-analytics-dashboards#/dashboard', {
onBeforeLoad: (win) => {
win.sessionStorage.clear();
},
});
cy.wait(delay * 3);
});

it('Renders empty state', () => {
cy.contains(' (0)').should('exist');
cy.get('h2.euiTitle').contains('No matches').should('exist');
});
});

describe('Testing dashboard table', () => {
beforeEach(() => {
cy.visit('app/trace-analytics-dashboards#/dashboard', {
onBeforeLoad: (win) => {
win.sessionStorage.clear();
},
});
setTimeFilter();
});

it('Renders the dashboard table', () => {
cy.contains(' (10)').should('exist');
cy.contains('client_cancel_order').should('exist');
cy.contains('166.44').should('exist');
cy.contains('7.14%').should('exist');
});

it('Adds the percentile filters', () => {
cy.contains(' >= 95 percentile').click({ force: true });
cy.wait(delay);
cy.contains(' >= 95 percentile').click({ force: true });
cy.wait(delay);

cy.contains('Latency percentile within trace group: >= 95th').should('exist');
cy.contains(' (7)').should('exist');
cy.contains('318.69').should('exist');

cy.contains(' < 95 percentile').click({ force: true });
cy.wait(delay);
cy.contains(' < 95 percentile').click({ force: true });
cy.wait(delay);

cy.contains('Latency percentile within trace group: < 95th').should('exist');
cy.contains(' (8)').should('exist');
cy.contains('383.05').should('exist');
});

it('Opens latency trend popover', () => {
setTimeFilter(true);
cy.get('.euiButtonIcon[aria-label="Open popover"]').first().click();
cy.get('text.ytitle[data-unformatted="Hourly latency (ms)"]').should('exist');
});

it('Redirects to traces table with filter', () => {
cy.wait(delay * 5);
cy.get('.euiLink').contains('13').click();
cy.wait(delay);

cy.get('h2.euiTitle').contains('Traces').should('exist');
cy.contains(' (13)').should('exist');
cy.contains('client_create_order').should('exist');

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

cy.contains('client_create_order').should('exist');
});
});

describe('Testing plots', () => {
beforeEach(() => {
cy.visit('app/trace-analytics-dashboards#/dashboard', {
onBeforeLoad: (win) => {
win.sessionStorage.clear();
},
});
setTimeFilter();
});

it('Renders service map', () => {
cy.get('text.ytitle[data-unformatted="Latency (ms)"]').should('exist');
cy.get('text[data-unformatted="200"]').should('exist');
cy.get('.vis-network').should('exist');

cy.get('.euiToggle__input[title="Error rate"]').click();
cy.get('text.ytitle[data-unformatted="Error rate"]').should('exist');
cy.get('text[data-unformatted="10%"]').should('exist');

cy.get('.euiToggle__input[title="Throughput"]').click();
cy.get('text.ytitle[data-unformatted="Throughput"]').should('exist');
cy.get('text[data-unformatted="60"]').should('exist');

cy.get('input[type="search"]').eq(1).focus().type('payment{enter}');
cy.wait(delay);
});

it('Renders plots', () => {
cy.get('text.ytitle[data-unformatted="Error rate (%)"]').should('exist');
cy.get('text.annotation-text[data-unformatted="Now: 0%"]').should('exist');
cy.get('text.ytitle[data-unformatted="Throughput (n)"]').should('exist');
cy.get('text.annotation-text[data-unformatted="Now: 62"]').should('exist');
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
/*
* 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.
*/

/*
* Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/

/// <reference types="cypress" />

import { delay, SERVICE_NAME, setTimeFilter } from '../utils/constants';

describe('Testing services table empty state', () => {
beforeEach(() => {
cy.visit('app/trace-analytics-dashboards#/services', {
onBeforeLoad: (win) => {
win.sessionStorage.clear();
},
});
cy.wait(delay * 3);
});

it('Renders empty state', () => {
cy.contains(' (0)').should('exist');
cy.get('h2.euiTitle').contains('No matches').should('exist');
});
});

describe('Testing services table', () => {
beforeEach(() => {
cy.visit('app/trace-analytics-dashboards#/services', {
onBeforeLoad: (win) => {
win.sessionStorage.clear();
},
});
setTimeFilter();
});

it('Renders the services table', () => {
cy.contains(' (8)').should('exist');
cy.contains('analytics-service, frontend-client, recommendation').should('exist');
cy.contains('186.95').should('exist');
cy.contains('14.29%').should('exist');
});

it('Searches correctly', () => {
cy.get('input[type="search"]').first().focus().type(`${SERVICE_NAME}{enter}`);
cy.get('.euiButton__text').contains('Refresh').click();
cy.wait(delay);
cy.contains(' (1)').should('exist');
cy.contains('3.57%').should('exist');
});
});

describe('Testing service view empty state', () => {
beforeEach(() => {
// exception is thrown on loading EuiDataGrid in cypress only, ignore for now
cy.on('uncaught:exception', (err, runnable) => {
if (err.message.includes('ResizeObserver loop'))
return false;
});
cy.visit(`app/trace-analytics-dashboards#/services/${SERVICE_NAME}`, {
onBeforeLoad: (win) => {
win.sessionStorage.clear();
},
});
cy.wait(delay * 3);
});

it('Renders service view empty state', () => {
cy.get('h2.euiTitle').contains('frontend-client').should('exist');
cy.get('.euiText').contains('0').should('exist');
cy.get('.euiText').contains('-').should('exist');
});
});

describe('Testing service view', () => {
beforeEach(() => {
// exception is thrown on loading EuiDataGrid in cypress only, ignore for now
cy.on('uncaught:exception', (err, runnable) => {
if (err.message.includes('ResizeObserver loop'))
return false;
});
cy.visit(`app/trace-analytics-dashboards#/services/${SERVICE_NAME}`, {
onBeforeLoad: (win) => {
win.sessionStorage.clear();
},
});
setTimeFilter(undefined, false);
});

it('Renders service view', () => {
cy.get('h2.euiTitle').contains('frontend-client').should('exist');
cy.contains('178.6').should('exist');
cy.contains('3.57%').should('exist');
cy.get('div.vis-network').should('exist');
});

it('Renders spans data grid, flyout, filters', () => {
cy.get('button[data-datagrid-interactable="true"]').eq(0).click({ force: true });
cy.wait(delay);
cy.contains('Span detail').should('exist');
cy.contains('Span attributes').should('exist');
cy.get('.euiTextColor').contains('Span ID').trigger('mouseover');
cy.get('.euiButtonIcon[aria-label="span-flyout-filter-icon"').click({ force: true });
cy.wait(delay);

cy.get('.euiBadge__text').contains('spanId: ').should('exist');
cy.contains('Spans (1)').should('exist');
});
});
Loading