-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Profiling] Click on series in stacked chart opens traces view
- Loading branch information
1 parent
118609b
commit c452654
Showing
5 changed files
with
130 additions
and
25 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
62 changes: 62 additions & 0 deletions
62
x-pack/plugins/profiling/public/components/stack_traces_view/utils.test.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,62 @@ | ||
/* | ||
* 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 { StackTracesDisplayOption, TopNType } from '../../../common/stack_traces'; | ||
import { getTracesViewRouteParams } from './utils'; | ||
|
||
describe('stack traces view utils', () => { | ||
describe('getTracesViewRouteParams', () => { | ||
it('filters by category only', () => { | ||
expect( | ||
getTracesViewRouteParams({ | ||
query: { | ||
rangeFrom: 'now-15m', | ||
rangeTo: 'now', | ||
displayAs: StackTracesDisplayOption.StackTraces, | ||
kuery: '', | ||
limit: 10, | ||
}, | ||
topNType: TopNType.Traces, | ||
category: 'Foo', | ||
}) | ||
).toEqual({ | ||
path: { topNType: 'traces' }, | ||
query: { | ||
rangeFrom: 'now-15m', | ||
rangeTo: 'now', | ||
displayAs: 'stackTraces', | ||
kuery: 'Stacktrace.id:"Foo"', | ||
limit: 10, | ||
}, | ||
}); | ||
}); | ||
|
||
it('keeps current filter and adds category', () => { | ||
expect( | ||
getTracesViewRouteParams({ | ||
query: { | ||
rangeFrom: 'now-15m', | ||
rangeTo: 'now', | ||
displayAs: StackTracesDisplayOption.StackTraces, | ||
kuery: 'container.name:"bar"', | ||
limit: 10, | ||
}, | ||
topNType: TopNType.Traces, | ||
category: 'Foo', | ||
}) | ||
).toEqual({ | ||
path: { topNType: 'traces' }, | ||
query: { | ||
rangeFrom: 'now-15m', | ||
rangeTo: 'now', | ||
displayAs: 'stackTraces', | ||
kuery: '(container.name:"bar") AND Stacktrace.id:"Foo"', | ||
limit: 10, | ||
}, | ||
}); | ||
}); | ||
}); | ||
}); |
30 changes: 30 additions & 0 deletions
30
x-pack/plugins/profiling/public/components/stack_traces_view/utils.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,30 @@ | ||
/* | ||
* 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 { TypeOf } from '@kbn/typed-react-router-config'; | ||
import { getFieldNameForTopNType, TopNType } from '../../../common/stack_traces'; | ||
import { ProfilingRoutes } from '../../routing'; | ||
|
||
export function getTracesViewRouteParams({ | ||
query, | ||
topNType, | ||
category, | ||
}: { | ||
query: TypeOf<ProfilingRoutes, '/stacktraces/{topNType}'>['query']; | ||
topNType: TopNType; | ||
category: string; | ||
}) { | ||
return { | ||
path: { topNType: TopNType.Traces }, | ||
query: { | ||
...query, | ||
kuery: `${query.kuery ? `(${query.kuery}) AND ` : ''}${getFieldNameForTopNType( | ||
topNType | ||
)}:"${category}"`, | ||
}, | ||
}; | ||
} |
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