Skip to content

feat(discv2): event breakdown #16142

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

Merged
merged 9 commits into from
Dec 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,12 @@ class EventDetailsContent extends AsyncComponent<Props, State> {
/>
</div>
<div style={{gridColumn: '2/3', display: isSidebarVisible ? '' : 'none'}}>
<EventBreakdown event={event} />
<EventMetadata
event={event}
organization={organization}
projectId={this.projectId}
/>
<EventBreakdown event={event} />
{event.groupID && (
<LinkedIssue groupId={event.groupID} eventId={event.eventID} />
)}
Expand Down Expand Up @@ -350,7 +350,7 @@ const StyledTitle = styled('span')`
`;

const MetaDataID = styled('div')`
margin-bottom: ${space(3)};
margin-bottom: ${space(4)};
`;

const MetadataContainer = styled('div')`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import styled from 'react-emotion';
import get from 'lodash/get';

import {Event} from 'app/types';
Expand All @@ -7,11 +8,15 @@ import {
SpanEntry,
SpanType,
} from 'app/components/events/interfaces/spans/types';
import {pickSpanBarColour} from 'app/components/events/interfaces/spans/utils';
import {TraceContextType} from 'app/components/events/interfaces/spans/traceView';
import {t} from 'app/locale';
import space from 'app/styles/space';
import {SectionHeading} from '../../styles';

type OpStats = {percentage: number; totalDuration: number};

const TOP_N_SPANS = 3;
const TOP_N_SPANS = 4;

type EventBreakdownType = {
// top TOP_N_SPANS spans
Expand Down Expand Up @@ -157,11 +162,68 @@ class EventBreakdown extends React.Component<Props> {
return null;
}

// TODO: Dora to take over
// const results = this.generateCounts();

return null;
const results = this.generateStats();

return (
<StyledBreakdown>
<SectionHeading>{t('Ops Breakdown')}</SectionHeading>
{results.ops.map(currOp => {
const {name, percentage, totalDuration} = currOp;
const durLabel = Math.round(totalDuration * 1000 * 100) / 100;
const pctLabel = Math.round(percentage * 100);
const opsColor: string = pickSpanBarColour(name);

return (
<OpsLine key={name}>
<OpsContent>
<OpsDot style={{backgroundColor: opsColor}} />
<div>{name}</div>
</OpsContent>
<OpsContent>
<Dur>{durLabel}ms</Dur>
<Pct>{pctLabel}%</Pct>
</OpsContent>
</OpsLine>
);
})}
</StyledBreakdown>
);
}
}

const StyledBreakdown = styled('div')`
color: ${p => p.theme.gray3};
font-size: ${p => p.theme.fontSizeMedium};
margin-bottom: ${space(4)};
`;

const OpsLine = styled('div')`
display: flex;
justify-content: space-between;
margin-bottom: ${space(0.5)};
`;

const OpsDot = styled('div')`
content: '';
display: block;
width: 8px;
height: 8px;
margin-right: ${space(1)};
border-radius: 100%;
`;

const OpsContent = styled('div')`
display: flex;
align-items: center;
`;

const Dur = styled('div')`
color: ${p => p.theme.gray2};
`;

const Pct = styled('div')`
min-width: 40px;
text-align: right;
`;

export default EventBreakdown;