Skip to content

Commit

Permalink
[APM][Transactions] Test trace summary (elastic#207115)
Browse files Browse the repository at this point in the history
Closes elastic#206947

## Summary

This PR adds tests for trace summary (Otel / APM cases) and changes the
`styled-components` to `css`.
  • Loading branch information
jennypavlova authored and viduni94 committed Jan 23, 2025
1 parent b90209d commit 8fe615c
Show file tree
Hide file tree
Showing 10 changed files with 116 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ export type ApmFields = Fields<{
}>;
'url.original': string;
'url.domain': string;
'url.full': string;
}> &
ApmApplicationMetricFields &
ExperimentalFields;
Expand Down
3 changes: 3 additions & 0 deletions packages/kbn-apm-synthtrace-client/src/lib/apm/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ export class Transaction extends BaseSpan {
'processor.event': 'transaction',
'transaction.id': generateShortId(),
'transaction.sampled': true,
'http.request.method': 'GET',
'http.response.status_code': 200,
'url.full': 'elastic.co',
});
}

Expand Down
4 changes: 3 additions & 1 deletion packages/kbn-apm-synthtrace-client/src/lib/otel/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ interface OtelSharedResourceAttributes {
'telemetry.sdk.language'?: string;
'telemetry.sdk.name'?: string;
'telemetry.sdk.version'?: string;
'some.resource.attribute'?: string;
}

export interface OtelDocument extends Fields {
Expand Down Expand Up @@ -165,6 +164,9 @@ class Otel extends Serializable<OtelDocument> {
'transaction.root': true,
'transaction.sampled': true,
'transaction.type': 'unknown',
'http.request.method': 'POST',
'http.response.status_code': 200,
'url.full': 'elastic.co',
},
data_stream: {
dataset: 'generic.otel',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ export interface OtelTransactionDocument extends OtelDocument {
'transaction.root'?: boolean;
'transaction.sampled'?: boolean;
'transaction.type'?: string;
'http.response.status_code'?: number;
'http.request.method'?: string;
'url.full'?: string;
};
status?: {
code?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ describe('simple trace', () => {
'container.id': 'instance-1',
'event.outcome': 'success',
'host.name': 'instance-1',
'http.request.method': 'GET',
'http.response.status_code': 200,
'processor.event': 'transaction',
'processor.name': 'transaction',
'service.environment': 'production',
Expand All @@ -107,6 +109,7 @@ describe('simple trace', () => {
'transaction.name': 'GET /api/product/list',
'transaction.type': 'request',
'transaction.sampled': true,
'url.full': 'elastic.co',
});
});

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ const baseUrl = url.format({
query: { rangeFrom: start, rangeTo: end },
});

const transactionTabPath = '/app/apm/services/sendotlp-synth/transactions/view';
const transactionUrl = url.format({
pathname: transactionTabPath,
query: { rangeFrom: start, rangeTo: end, transactionName: 'parent-synth' },
});

describe('Service Overview', () => {
before(() => {
synthtraceOtel.index(
Expand Down Expand Up @@ -117,6 +123,13 @@ describe('Service Overview', () => {
cy.contains('a', 'parent-synth').click();
cy.contains('h5', 'parent-synth');
});
it('shows transaction summary', () => {
cy.visitKibana(transactionUrl);

cy.getByTestSubj('apmHttpInfoRequestMethod').should('exist');
cy.getByTestSubj('apmHttpInfoUrl').should('exist');
cy.getByTestSubj('apmHttpStatusBadge').should('exist');
});
});

describe('errors', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,21 @@ describe('Transaction details', () => {
cy.url().should('include', 'opbeans-java/errors');
});

describe('Trace sample summary', () => {
it('shows transaction summary', () => {
cy.visitKibana(
`/app/apm/services/opbeans-node/transactions/view?${new URLSearchParams({
...timeRange,
transactionName: 'GET /api/product/:id',
})}`
);

cy.getByTestSubj('apmHttpInfoRequestMethod').should('exist');
cy.getByTestSubj('apmHttpInfoUrl').should('exist');
cy.getByTestSubj('apmHttpStatusBadge').should('exist');
});
});

describe('when navigating to a trace sample', () => {
it('keeps the same trace sample after reloading the page', () => {
cy.visitKibana(
Expand Down
Loading

0 comments on commit 8fe615c

Please sign in to comment.