[APM] Show tags in span details (#26396) (#26595)

* [APM] Show tags in span details

* [APM] fixed typo

* [APM] remove unused export
This commit is contained in:
Oliver Gupte 2018-12-03 17:48:43 -08:00 committed by GitHub
parent 4c0a9bbdc0
commit 8e573a2f7b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 56 additions and 7 deletions

View file

@ -5,6 +5,7 @@
*/
import {
EuiBasicTable,
EuiFlexGroup,
EuiFlexItem,
EuiFlyout,
@ -12,10 +13,12 @@ import {
EuiFlyoutHeader,
EuiHorizontalRule,
EuiPortal,
// @ts-ignore otherwise TS complains "Module ''@elastic/eui'' has no exported member 'EuiTabbedContent'"
EuiTabbedContent,
EuiTitle
} from '@elastic/eui';
import { get } from 'lodash';
import React from 'react';
import { get, keys } from 'lodash';
import React, { Fragment } from 'react';
import styled from 'styled-components';
// @ts-ignore
@ -42,6 +45,10 @@ const StackTraceContainer = styled.div`
margin-top: ${px(unit)};
`;
const TagName = styled.div`
font-weight: bold;
`;
function getDiscoverQuery(span: Span) {
return {
_a: {
@ -77,6 +84,7 @@ export function SpanFlyout({
const codeLanguage: string = get(span, SERVICE_LANGUAGE_NAME);
const dbContext = span.context.db;
const httpContext = span.context.http;
const tagContext = span.context.tags;
return (
<EuiPortal>
@ -101,11 +109,47 @@ export function SpanFlyout({
<EuiHorizontalRule />
<StickySpanProperties span={span} totalDuration={totalDuration} />
<EuiHorizontalRule />
<HttpContext httpContext={httpContext} />
<DatabaseContext dbContext={dbContext} />
<StackTraceContainer>
<Stacktrace stackframes={stackframes} codeLanguage={codeLanguage} />
</StackTraceContainer>
<EuiTabbedContent
tabs={[
{
id: 'stack-trace',
name: 'Stack Trace',
content: (
<Fragment>
<HttpContext httpContext={httpContext} />
<DatabaseContext dbContext={dbContext} />
<StackTraceContainer>
<Stacktrace
stackframes={stackframes}
codeLanguage={codeLanguage}
/>
</StackTraceContainer>
</Fragment>
)
},
{
id: 'tags',
name: 'Tags',
content: (
<Fragment>
<EuiBasicTable
columns={[
{
field: 'key',
render: (key: string) => <TagName>{key}</TagName>
},
{ field: 'value' }
]}
items={keys(tagContext).map(key => ({
key,
value: get(tagContext, key)
}))}
/>
</Fragment>
)
}
]}
/>
</EuiFlyoutBody>
</EuiFlyout>
</EuiPortal>

View file

@ -22,9 +22,14 @@ export interface HttpContext {
url?: string;
}
interface TagsContext {
[key: string]: string;
}
interface Context {
db?: DbContext;
http?: HttpContext;
tags?: TagsContext;
service: ContextService;
[key: string]: unknown;
}