-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[APM][Otel] Add service view e2e tests using otel service (#196542)
Closes #193206 ## Summary This PR adds service view e2e tests using otel service. To run the tests: - Start server `node x-pack/plugins/observability_solution/apm/scripts/test/e2e --server` - Open Cypress `node x-pack/plugins/observability_solution/apm/scripts/test/e2e --runner --open` - Select `otel_service_overview_and_transactions`
- Loading branch information
1 parent
7c4a83d
commit 98ebd09
Showing
7 changed files
with
221 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
143 changes: 143 additions & 0 deletions
143
...ion/apm/ftr_e2e/cypress/e2e/service_overview/otel_service_overview_and_transactions.cy.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import url from 'url'; | ||
import { synthtraceOtel } from '../../../synthtrace'; | ||
import { sendotlp } from '../../fixtures/synthtrace/sendotlp'; | ||
import { checkA11y } from '../../support/commands'; | ||
|
||
const start = '2021-10-10T00:00:00.000Z'; | ||
const end = '2021-10-10T00:15:00.000Z'; | ||
const serviceInstanceId = '89117ac1-0dbf-4488-9e17-4c2c3b76943a'; | ||
|
||
const serviceOverviewPath = '/app/apm/services/sendotlp-synth/overview'; | ||
const baseUrl = url.format({ | ||
pathname: serviceOverviewPath, | ||
query: { rangeFrom: start, rangeTo: end }, | ||
}); | ||
|
||
describe('Service Overview', () => { | ||
before(() => { | ||
synthtraceOtel.index( | ||
sendotlp({ | ||
from: new Date(start).getTime(), | ||
to: new Date(end).getTime(), | ||
}) | ||
); | ||
}); | ||
|
||
after(() => { | ||
synthtraceOtel.clean(); | ||
}); | ||
|
||
describe('renders', () => { | ||
beforeEach(() => { | ||
cy.loginAsViewerUser(); | ||
cy.visitKibana(baseUrl); | ||
}); | ||
|
||
it('renders all components on the page', () => { | ||
cy.contains('sendotlp-synth'); | ||
// set skipFailures to true to not fail the test when there are accessibility failures | ||
checkA11y({ skipFailures: true }); | ||
cy.getByTestSubj('latencyChart'); | ||
cy.getByTestSubj('throughput'); | ||
cy.getByTestSubj('transactionsGroupTable'); | ||
cy.getByTestSubj('serviceOverviewErrorsTable'); | ||
cy.getByTestSubj('dependenciesTable'); | ||
cy.getByTestSubj('instancesLatencyDistribution'); | ||
cy.getByTestSubj('serviceOverviewInstancesTable'); | ||
}); | ||
}); | ||
|
||
describe('service icons', () => { | ||
beforeEach(() => { | ||
cy.loginAsViewerUser(); | ||
}); | ||
|
||
it('show information on click', () => { | ||
cy.intercept('GET', '/internal/apm/services/sendotlp-synth/metadata/details?*').as( | ||
'metadataDetailsRequest' | ||
); | ||
|
||
cy.visitKibana(baseUrl); | ||
|
||
cy.getByTestSubj('service').click(); | ||
cy.wait('@metadataDetailsRequest'); | ||
cy.contains('dt', 'Framework name'); | ||
cy.contains('dd', 'sendotlp-synth'); | ||
|
||
cy.getByTestSubj('opentelemetry').click(); | ||
cy.contains('dt', 'Language'); | ||
cy.contains('dd', 'go'); | ||
}); | ||
}); | ||
|
||
describe('instances table', () => { | ||
beforeEach(() => { | ||
cy.loginAsViewerUser(); | ||
}); | ||
|
||
it('has data in the table', () => { | ||
cy.visitKibana(baseUrl); | ||
cy.contains('sendotlp-synth'); | ||
cy.getByTestSubj('serviceInstancesTableContainer'); | ||
cy.contains(serviceInstanceId); | ||
}); | ||
}); | ||
|
||
describe('transactions', () => { | ||
beforeEach(() => { | ||
cy.loginAsViewerUser(); | ||
}); | ||
|
||
it('persists transaction type selected when clicking on Transactions tab', () => { | ||
cy.intercept('GET', '/internal/apm/services/sendotlp-synth/transaction_types?*').as( | ||
'transactionTypesRequest' | ||
); | ||
|
||
cy.visitKibana(baseUrl); | ||
|
||
cy.wait('@transactionTypesRequest'); | ||
|
||
cy.getByTestSubj('headerFilterTransactionType').should('have.value', 'unknown'); | ||
cy.contains('Transactions').click(); | ||
cy.getByTestSubj('headerFilterTransactionType').should('have.value', 'unknown'); | ||
cy.contains('parent-synth'); | ||
}); | ||
|
||
it('navigates to transaction detail page', () => { | ||
cy.visitKibana(baseUrl); | ||
cy.contains('Transactions').click(); | ||
|
||
cy.contains('a', 'parent-synth').click(); | ||
cy.contains('h5', 'parent-synth'); | ||
}); | ||
}); | ||
|
||
describe('errors', () => { | ||
beforeEach(() => { | ||
cy.loginAsViewerUser(); | ||
cy.visitKibana(baseUrl); | ||
}); | ||
it('errors table is populated', () => { | ||
cy.contains('sendotlp-synth'); | ||
cy.contains('*errors.errorString'); | ||
}); | ||
|
||
it('navigates to the errors page', () => { | ||
cy.contains('sendotlp-synth'); | ||
cy.contains('a', 'View errors').click(); | ||
cy.url().should('include', '/sendotlp-synth/errors'); | ||
}); | ||
|
||
it('navigates to error detail page', () => { | ||
cy.contains('a', '*errors.errorString').click(); | ||
cy.contains('div', 'boom'); | ||
}); | ||
}); | ||
}); |
29 changes: 29 additions & 0 deletions
29
x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/fixtures/synthtrace/sendotlp.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
import { generateShortId, otel, timerange } from '@kbn/apm-synthtrace-client'; | ||
import { times } from 'lodash'; | ||
|
||
export function sendotlp({ from, to }: { from: number; to: number }) { | ||
const range = timerange(from, to); | ||
const traceId = generateShortId(); | ||
const spanId = generateShortId(); | ||
|
||
const otelSendotlp = times(2).map((index) => otel.create(traceId)); | ||
|
||
return range | ||
.interval('1s') | ||
.rate(1) | ||
.generator((timestamp) => | ||
otelSendotlp.flatMap((otelDoc) => { | ||
return [ | ||
otelDoc.metric().timestamp(timestamp), | ||
otelDoc.transaction(spanId).timestamp(timestamp), | ||
otelDoc.error(spanId).timestamp(timestamp), | ||
]; | ||
}) | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters