-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[APM] Stacktrace heading styles #26456
[APM] Stacktrace heading styles #26456
Conversation
💔 Build Failed |
💔 Build Failed |
const FileDetail = isLibraryFrame | ||
? LibraryFrameFileDetail | ||
: AppFrameFileDetail; | ||
const lineNumber: number = get(stackframe, 'line.number'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw. we might be able to ditch ts-optchain
and Lodash' get
for idx: https://github.com/facebookincubator/idx
@@ -22,37 +22,24 @@ import python from 'react-syntax-highlighter/dist/languages/python'; | |||
import ruby from 'react-syntax-highlighter/dist/languages/ruby'; | |||
import { Variables } from './Variables'; | |||
import { Context } from './Context'; | |||
import { FrameHeading } from '../Stacktrace/FrameHeading'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mind converting to ts?
@@ -12,6 +12,7 @@ import { Ellipsis } from '../../shared/Icons'; | |||
import { units, px } from '../../../style/variables'; | |||
import { EmptyMessage } from '../../shared/EmptyMessage'; | |||
import { EuiLink, EuiTitle } from '@elastic/eui'; | |||
import { FrameHeading } from './FrameHeading'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mind converting to ts?
items={keys(tagContext).map(key => ({ | ||
key, | ||
value: get(tagContext, key) | ||
}))} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps extract this transformation:
const items = keys(tagContext).map(key => ({
key,
value: get(tagContext, key)
}));
x-pack/plugins/apm/typings/Span.ts
Outdated
@@ -22,9 +22,14 @@ export interface HttpContext { | |||
url?: string; | |||
} | |||
|
|||
export interface TagsContext { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is exporting needed (I don't see it used outside of here)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All comments made.
a152609
to
fc2f2a5
Compare
💚 Build Succeeded |
stackframes: prevItem.stackframes | ||
? [...prevItem.stackframes, stackframe] | ||
: [stackframe] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even though I originally wrote getCollapsedLibraryFrames
I barely understand it now. Not because of your changes. It was just never very readable. So if you feel like simplifying/refactor/change it you are very welcome. And perhaps add a test for it 🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i pulled it into it's own file and added a very basic test...next, i'll amend this PR and take a try at simplifying this function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good 👍
Coincidentally a new issue was created directly related to this. Probably makes sense to refactor and fix the issue at the same time.
onClick: () => void; | ||
} | ||
|
||
const Libraryframes: React.SFC<LibraryframesProps> = ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you move this to its own file?
Generally I like the "one component per file"-ruke - unless the components are very simple/small.
import { FrameHeading } from './FrameHeading'; | ||
|
||
export interface StackframeCollapsed extends Stackframe { | ||
libraryFrame?: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stackframe
already has libraryFrame
- with snake case:
library_frame?: boolean; |
We do some camelCasing here (that we should stop doing):
return camelcase ? camelizeKeys(res) : res; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest we disable the camelCasing for the spans endpoint:
export async function loadSpans({ |
Like we did for the transactions endpoint:
kibana/x-pack/plugins/apm/public/services/rest/apm/transactions.ts
Lines 56 to 58 in abeafa1
{ | |
camelcase: false | |
} |
Eventually we can remove the camel casing altogether (I think spans (this) and errors are the only hold-ups).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i started down this path, but it ended up being a larger change than expected, since there are so many references to the camel cased properties. I'm not sure if i want to add that to this pr to create a new issue for it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, that makes sense. A new PR is probably a good idea. This PR lgtm.
…ew and only displaying code preview when stackframe has source code context
…ted Stackframe types
fc2f2a5
to
5012db3
Compare
💚 Build Succeeded |
expect(result).toBe(false); | ||
}); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks 🙏
* [APM] fixes elastic#23560 by separating frame headers from code preview and only displaying code preview when stackframe has source code context * [APM] fixes elastic#26239 by checking for valid line number before displaying it * [APM] Converted CodePreview and Stacktace to typescript and consolidated Stackframe types * [APM] pull out components and util functions into own files and added tests
* [APM] fixes #23560 by separating frame headers from code preview and only displaying code preview when stackframe has source code context * [APM] fixes #26239 by checking for valid line number before displaying it * [APM] Converted CodePreview and Stacktace to typescript and consolidated Stackframe types * [APM] pull out components and util functions into own files and added tests
Fixes #23560 by factoring out FrameHeading from CodePreview components and only rendering CodePreview when the current stackframe has source context.
Fixes #26239 by checking for valid line number before displaying it