[APM] Support error.{log,exception}.stacktrace.classname (#54577)

In elastic/apm-server/pull/3096, an alternative to stacktrace.filename was introduced: stacktrace.classname. This change makes sure classname is properly represented in the UI and in our types.
This commit is contained in:
Dario Gieselaar 2020-01-14 09:37:22 +01:00 committed by GitHub
parent 9380b6408b
commit 3f46e2bec6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 6 deletions

View file

@ -35,9 +35,13 @@ const FrameHeading: React.FC<Props> = ({ stackframe, isLibraryFrame }) => {
? LibraryFrameFileDetail
: AppFrameFileDetail;
const lineNumber = stackframe.line.number;
const name =
'filename' in stackframe ? stackframe.filename : stackframe.classname;
return (
<FileDetails>
<FileDetail>{stackframe.filename}</FileDetail> in{' '}
<FileDetail>{name}</FileDetail> in{' '}
<FileDetail>{stackframe.function}</FileDetail>
{lineNumber > 0 && (
<Fragment>

View file

@ -4,8 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
interface IStackframeBase {
filename: string;
type IStackframeBase = {
function?: string;
library_frame?: boolean;
exclude_from_grouping?: boolean;
@ -19,13 +18,13 @@ interface IStackframeBase {
line: {
number: number;
};
}
} & ({ classname: string } | { filename: string });
export interface IStackframeWithLineContext extends IStackframeBase {
export type IStackframeWithLineContext = IStackframeBase & {
line: {
number: number;
context: string;
};
}
};
export type IStackframe = IStackframeBase | IStackframeWithLineContext;