|
@@ -62,6 +62,11 @@ describe('HTTPSamplesPanel', () => {
|
|
|
eventsRequestMock = MockApiClient.addMockResponse({
|
|
|
url: `/organizations/${organization.slug}/events/`,
|
|
|
method: 'GET',
|
|
|
+ match: [
|
|
|
+ MockApiClient.matchQuery({
|
|
|
+ referrer: 'api.starfish.http-module-samples-panel-metrics-ribbon',
|
|
|
+ }),
|
|
|
+ ],
|
|
|
body: {
|
|
|
data: [
|
|
|
{
|
|
@@ -93,8 +98,8 @@ describe('HTTPSamplesPanel', () => {
|
|
|
jest.resetAllMocks();
|
|
|
});
|
|
|
|
|
|
- describe('status panel', () => {
|
|
|
- let eventsStatsRequestMock;
|
|
|
+ describe('Status panel', () => {
|
|
|
+ let eventsStatsRequestMock, samplesRequestMock;
|
|
|
|
|
|
beforeEach(() => {
|
|
|
jest.mocked(useLocation).mockReturnValue({
|
|
@@ -137,6 +142,32 @@ describe('HTTPSamplesPanel', () => {
|
|
|
},
|
|
|
},
|
|
|
});
|
|
|
+
|
|
|
+ samplesRequestMock = MockApiClient.addMockResponse({
|
|
|
+ url: `/organizations/${organization.slug}/events/`,
|
|
|
+ method: 'GET',
|
|
|
+ match: [
|
|
|
+ MockApiClient.matchQuery({
|
|
|
+ referrer: 'api.starfish.http-module-samples-panel-response-code-samples',
|
|
|
+ }),
|
|
|
+ ],
|
|
|
+ body: {
|
|
|
+ data: [
|
|
|
+ {
|
|
|
+ span_id: 'b1bf1acde131623a',
|
|
|
+ trace: '2b60b2eb415c4bfba3efeaf65c21c605',
|
|
|
+ 'span.description':
|
|
|
+ 'GET https://sentry.io/api/0/organizations/sentry/info/?projectId=1',
|
|
|
+ project: 'javascript',
|
|
|
+ timestamp: '2024-03-25T20:31:36+00:00',
|
|
|
+ 'span.status_code': '200',
|
|
|
+ 'transaction.id': '11c910c9c10b3ec4ecf8f209b8c6ce48',
|
|
|
+ 'span.self_time': 320.300102,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ meta: {},
|
|
|
+ },
|
|
|
+ });
|
|
|
});
|
|
|
|
|
|
it('fetches panel data', async () => {
|
|
@@ -195,8 +226,8 @@ describe('HTTPSamplesPanel', () => {
|
|
|
})
|
|
|
);
|
|
|
|
|
|
- expect(eventsRequestMock).toHaveBeenNthCalledWith(
|
|
|
- 2,
|
|
|
+ expect(samplesRequestMock).toHaveBeenNthCalledWith(
|
|
|
+ 1,
|
|
|
`/organizations/${organization.slug}/events/`,
|
|
|
expect.objectContaining({
|
|
|
method: 'GET',
|
|
@@ -207,10 +238,12 @@ describe('HTTPSamplesPanel', () => {
|
|
|
project: [],
|
|
|
field: [
|
|
|
'project',
|
|
|
+ 'trace',
|
|
|
'transaction.id',
|
|
|
+ 'span_id',
|
|
|
+ 'timestamp',
|
|
|
'span.description',
|
|
|
'span.status_code',
|
|
|
- 'span_id',
|
|
|
],
|
|
|
sort: '-span_id',
|
|
|
referrer: 'api.starfish.http-module-samples-panel-response-code-samples',
|
|
@@ -287,6 +320,7 @@ describe('HTTPSamplesPanel', () => {
|
|
|
data: [
|
|
|
{
|
|
|
span_id: 'b1bf1acde131623a',
|
|
|
+ trace: '2b60b2eb415c4bfba3efeaf65c21c605',
|
|
|
'span.description':
|
|
|
'GET https://sentry.io/api/0/organizations/sentry/info/?projectId=1',
|
|
|
project: 'javascript',
|
|
@@ -334,7 +368,12 @@ describe('HTTPSamplesPanel', () => {
|
|
|
query:
|
|
|
'span.module:http span.domain:"\\*.sentry.dev" transaction:/api/0/users',
|
|
|
project: [],
|
|
|
- additionalFields: ['transaction.id', 'span.description', 'span.status_code'],
|
|
|
+ additionalFields: [
|
|
|
+ 'trace',
|
|
|
+ 'transaction.id',
|
|
|
+ 'span.description',
|
|
|
+ 'span.status_code',
|
|
|
+ ],
|
|
|
lowerBound: 0,
|
|
|
firstBound: expect.closeTo(333.3333),
|
|
|
secondBound: expect.closeTo(666.6666),
|
|
@@ -374,14 +413,14 @@ describe('HTTPSamplesPanel', () => {
|
|
|
// Samples table
|
|
|
expect(screen.getByRole('table', {name: 'Span Samples'})).toBeInTheDocument();
|
|
|
|
|
|
- expect(screen.getByRole('columnheader', {name: 'Event ID'})).toBeInTheDocument();
|
|
|
+ expect(screen.getByRole('columnheader', {name: 'Span ID'})).toBeInTheDocument();
|
|
|
expect(screen.getByRole('columnheader', {name: 'Status'})).toBeInTheDocument();
|
|
|
expect(screen.getByRole('columnheader', {name: 'URL'})).toBeInTheDocument();
|
|
|
|
|
|
- expect(screen.getByRole('cell', {name: '11c910c9'})).toBeInTheDocument();
|
|
|
- expect(screen.getByRole('link', {name: '11c910c9'})).toHaveAttribute(
|
|
|
+ expect(screen.getByRole('cell', {name: 'b1bf1acde131623a'})).toBeInTheDocument();
|
|
|
+ expect(screen.getByRole('link', {name: 'b1bf1acde131623a'})).toHaveAttribute(
|
|
|
'href',
|
|
|
- '/organizations/org-slug/performance/javascript:11c910c9c10b3ec4ecf8f209b8c6ce48#span-b1bf1acde131623a'
|
|
|
+ '/organizations/org-slug/performance/javascript:11c910c9c10b3ec4ecf8f209b8c6ce48/?domain=%2A.sentry.dev&panel=duration&statsPeriod=10d&transactionMethod=GET'
|
|
|
);
|
|
|
expect(screen.getByRole('cell', {name: '200'})).toBeInTheDocument();
|
|
|
});
|