mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
[APM] Default time range overrides fetched range for link-to/trace URLs without range parameters (#115449)
* removing default time range from link trace url * adding test
This commit is contained in:
parent
0447557c06
commit
36d128c3e7
2 changed files with 26 additions and 16 deletions
|
@ -21,19 +21,35 @@ describe('getRedirectToTransactionDetailPageUrl', () => {
|
|||
},
|
||||
} as unknown as any;
|
||||
|
||||
const url = getRedirectToTransactionDetailPageUrl({ transaction });
|
||||
describe('without time range', () => {
|
||||
const url = getRedirectToTransactionDetailPageUrl({ transaction });
|
||||
|
||||
it('rounds the start time down', () => {
|
||||
expect(parse(url, true).query.rangeFrom).toBe('2020-01-01T00:00:00.000Z');
|
||||
it('rounds the start time down', () => {
|
||||
expect(parse(url, true).query.rangeFrom).toBe('2020-01-01T00:00:00.000Z');
|
||||
});
|
||||
|
||||
it('rounds the end time up', () => {
|
||||
expect(parse(url, true).query.rangeTo).toBe('2020-01-01T00:05:00.000Z');
|
||||
});
|
||||
|
||||
it('formats url correctly', () => {
|
||||
expect(url).toBe(
|
||||
'/services/opbeans-node/transactions/view?traceId=trace_id&transactionId=transaction_id&transactionName=transaction_name&transactionType=request&rangeFrom=2020-01-01T00%3A00%3A00.000Z&rangeTo=2020-01-01T00%3A05%3A00.000Z'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
it('rounds the end time up', () => {
|
||||
expect(parse(url, true).query.rangeTo).toBe('2020-01-01T00:05:00.000Z');
|
||||
});
|
||||
describe('with time range', () => {
|
||||
const url = getRedirectToTransactionDetailPageUrl({
|
||||
transaction,
|
||||
rangeFrom: '2020-01-01T00:02:00.000Z',
|
||||
rangeTo: '2020-01-01T00:17:59.999Z',
|
||||
});
|
||||
|
||||
it('formats url correctly', () => {
|
||||
expect(url).toBe(
|
||||
'/services/opbeans-node/transactions/view?traceId=trace_id&transactionId=transaction_id&transactionName=transaction_name&transactionType=request&rangeFrom=2020-01-01T00%3A00%3A00.000Z&rangeTo=2020-01-01T00%3A05%3A00.000Z'
|
||||
);
|
||||
it('uses timerange provided', () => {
|
||||
expect(url).toBe(
|
||||
'/services/opbeans-node/transactions/view?traceId=trace_id&transactionId=transaction_id&transactionName=transaction_name&transactionType=request&rangeFrom=2020-01-01T00%3A02%3A00.000Z&rangeTo=2020-01-01T00%3A17%3A59.999Z'
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -53,12 +53,6 @@ const apmRoutes = route([
|
|||
}),
|
||||
}),
|
||||
]),
|
||||
defaults: {
|
||||
query: {
|
||||
rangeFrom: 'now-15m',
|
||||
rangeTo: 'now',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
path: '/',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue