Skip to content
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
@@ -0,0 +1,47 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import React, { Fragment } from 'react';
import styled from 'styled-components';
import {
borderRadius,
colors,
fontFamilyCode,
px,
unit,
units
} from '../../../../../../../style/variables';

import { EuiTitle } from '@elastic/eui';
import { HttpContext } from '../../../../../../../../typings/Span';

const DatabaseStatement = styled.div`
margin-top: ${px(unit)};
padding: ${px(units.half)} ${px(unit)};
background: ${colors.gray5};
border-radius: ${borderRadius};
border: 1px solid ${colors.gray4};
font-family: ${fontFamilyCode};
`;
Copy link
Copy Markdown
Contributor

@sorenlouv sorenlouv Nov 27, 2018

Choose a reason for hiding this comment

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

I see this is duplicated (from DatabaseContext). I generally prefer having duplication over wrong abstractions - we should just keep it in mind. Preferably there should be an EUI component for this.


interface Props {
httpContext?: HttpContext;
}

export function HttpContext({ httpContext }: Props) {
if (!httpContext || !httpContext.url) {
return null;
}

return (
<Fragment>
<EuiTitle size="xs">
<h3>HTTP URL</h3>
</EuiTitle>
<DatabaseStatement>{httpContext.url}</DatabaseStatement>
</Fragment>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import { px, unit } from '../../../../../../../style/variables';
import Stacktrace from '../../../../../../shared/Stacktrace';

import { DatabaseContext } from './DatabaseContext';
import { HttpContext } from './HttpContext';
import { StickySpanProperties } from './StickySpanProperties';

import { Transaction } from 'x-pack/plugins/apm/typings/Transaction';
Expand Down Expand Up @@ -75,6 +76,7 @@ export function SpanFlyout({
const stackframes = span.span.stacktrace;
const codeLanguage: string = get(span, SERVICE_LANGUAGE_NAME);
const dbContext = span.context.db;
const httpContext = span.context.http;

return (
<EuiPortal>
Expand All @@ -99,6 +101,7 @@ export function SpanFlyout({
<EuiHorizontalRule />
<StickySpanProperties span={span} totalDuration={totalDuration} />
<EuiHorizontalRule />
<HttpContext httpContext={httpContext} />
<DatabaseContext dbContext={dbContext} />
<StackTraceContainer>
<Stacktrace stackframes={stackframes} codeLanguage={codeLanguage} />
Expand Down
5 changes: 5 additions & 0 deletions x-pack/plugins/apm/typings/Span.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,13 @@ interface Processor {
event: 'span';
}

export interface HttpContext {
url?: string;
}

interface Context {
db?: DbContext;
http?: HttpContext;
service: ContextService;
[key: string]: unknown;
}
Expand Down