Skip to content
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

Merged
merged 4 commits into from
Dec 4, 2018

Conversation

ogupte
Copy link
Contributor

@ogupte ogupte commented Nov 30, 2018

Fixes #23560 by factoring out FrameHeading from CodePreview components and only rendering CodePreview when the current stackframe has source context.

screen shot 2018-11-29 at 10 30 59 pm

Fixes #26239 by checking for valid line number before displaying it

screen shot 2018-11-29 at 10 48 56 pm

@ogupte ogupte self-assigned this Nov 30, 2018
@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

const FileDetail = isLibraryFrame
? LibraryFrameFileDetail
: AppFrameFileDetail;
const lineNumber: number = get(stackframe, 'line.number');
Copy link
Member

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';
Copy link
Member

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';
Copy link
Member

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)
}))}
Copy link
Member

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)
}));

@@ -22,9 +22,14 @@ export interface HttpContext {
url?: string;
}

export interface TagsContext {
Copy link
Member

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)

Copy link
Member

@sorenlouv sorenlouv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All comments made.

@ogupte ogupte force-pushed the apm-23560-stack-trace-heading-style branch from a152609 to fc2f2a5 Compare December 3, 2018 19:42
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

stackframes: prevItem.stackframes
? [...prevItem.stackframes, stackframe]
: [stackframe]
}
Copy link
Member

@sorenlouv sorenlouv Dec 3, 2018

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 🙏

Copy link
Contributor Author

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

Copy link
Member

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> = ({
Copy link
Member

@sorenlouv sorenlouv Dec 3, 2018

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;
Copy link
Member

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;

Copy link
Member

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:

Like we did for the transactions endpoint:

Eventually we can remove the camel casing altogether (I think spans (this) and errors are the only hold-ups).

Copy link
Contributor Author

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?

Copy link
Member

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.

@ogupte ogupte force-pushed the apm-23560-stack-trace-heading-style branch from fc2f2a5 to 5012db3 Compare December 4, 2018 02:53
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

expect(result).toBe(false);
});
});
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 🙏

@ogupte ogupte merged commit 754aa25 into elastic:master Dec 4, 2018
ogupte added a commit to ogupte/kibana that referenced this pull request Dec 4, 2018
* [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
ogupte added a commit that referenced this pull request Dec 5, 2018
* [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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants