Plugins: move jaeger trace type to grafana data (#25403)
* Plugins: move jaeger trace type to grafana data * Remove unnecessary type from tsconfig
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
// limitations under the License.
|
||||
|
||||
import { TNil } from './types';
|
||||
import { Span, SpanReference, Trace } from './types/trace';
|
||||
import { Span, SpanReference, Trace } from '@grafana/data';
|
||||
|
||||
/**
|
||||
* `Accessors` is necessary because `ScrollManager` needs to be created by
|
||||
|
||||
@@ -19,7 +19,7 @@ import CanvasSpanGraph from './CanvasSpanGraph';
|
||||
import TickLabels from './TickLabels';
|
||||
import ViewingLayer from './ViewingLayer';
|
||||
import { TUpdateViewRangeTimeFunction, ViewRange, ViewRangeTimeUpdate } from '../..';
|
||||
import { Span, Trace } from '../..';
|
||||
import { Span, Trace } from '@grafana/data';
|
||||
import { ubPb2, ubPx2, ubRelative } from '../../uberUtilityStyles';
|
||||
|
||||
const DEFAULT_HEIGHT = 60;
|
||||
|
||||
@@ -27,7 +27,7 @@ import LabeledList from '../common/LabeledList';
|
||||
import TraceName from '../common/TraceName';
|
||||
import { getTraceName } from '../model/trace-viewer';
|
||||
import { TNil } from '../types';
|
||||
import { Trace } from '..';
|
||||
import { Trace } from '@grafana/data';
|
||||
import { formatDatetime, formatDuration } from '../utils/date';
|
||||
import { getTraceLinks } from '../model/link-patterns';
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
import React from 'react';
|
||||
import { css } from 'emotion';
|
||||
import NewWindowIcon from '../common/NewWindowIcon';
|
||||
import { SpanReference } from '../types/trace';
|
||||
import { SpanReference } from '@grafana/data';
|
||||
import { UITooltip, UIDropdown, UIMenuItem, UIMenu, TooltipPlacement } from '../uiElementsContext';
|
||||
|
||||
import ReferenceLink from '../url/ReferenceLink';
|
||||
|
||||
@@ -22,7 +22,7 @@ import AccordianLogs from './SpanDetail/AccordianLogs';
|
||||
|
||||
import { ViewedBoundsFunctionType } from './utils';
|
||||
import { TNil } from '../types';
|
||||
import { Span } from '../types/trace';
|
||||
import { Span } from '@grafana/data';
|
||||
import { UIPopover } from '../uiElementsContext';
|
||||
import { createStyle } from '../Theme';
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ import SpanBar from './SpanBar';
|
||||
import Ticks from './Ticks';
|
||||
|
||||
import { TNil } from '../types';
|
||||
import { Span } from '../types/trace';
|
||||
import { Span } from '@grafana/data';
|
||||
import { autoColor, createStyle, Theme, withTheme } from '../Theme';
|
||||
|
||||
const getStyles = createStyle((theme: Theme) => {
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ import cx from 'classnames';
|
||||
import * as markers from './AccordianKeyValues.markers';
|
||||
import KeyValuesTable from './KeyValuesTable';
|
||||
import { TNil } from '../../types';
|
||||
import { KeyValuePair, Link } from '../../types/trace';
|
||||
import { KeyValuePair, Link } from '@grafana/data';
|
||||
import { autoColor, createStyle, Theme, useTheme } from '../../Theme';
|
||||
import { uAlignIcon, uTxEllipsis } from '../../uberUtilityStyles';
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import { css } from 'emotion';
|
||||
import AccordianKeyValues from './AccordianKeyValues';
|
||||
import { formatDuration } from '../utils';
|
||||
import { TNil } from '../../types';
|
||||
import { Log, KeyValuePair, Link } from '../../types/trace';
|
||||
import { Log, KeyValuePair, Link } from '@grafana/data';
|
||||
import { autoColor, createStyle, Theme, useTheme } from '../../Theme';
|
||||
import { uAlignIcon, ubMb1 } from '../../uberUtilityStyles';
|
||||
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ import cx from 'classnames';
|
||||
|
||||
import IoIosArrowDown from 'react-icons/lib/io/ios-arrow-down';
|
||||
import IoIosArrowRight from 'react-icons/lib/io/ios-arrow-right';
|
||||
import { SpanReference } from '../../types/trace';
|
||||
import { SpanReference } from '@grafana/data';
|
||||
import ReferenceLink from '../../url/ReferenceLink';
|
||||
|
||||
import { createStyle } from '../../Theme';
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
import { Log } from '../../types/trace';
|
||||
import { Log } from '@grafana/data';
|
||||
|
||||
/**
|
||||
* Which items of a {@link SpanDetail} component are expanded.
|
||||
|
||||
@@ -20,7 +20,7 @@ import cx from 'classnames';
|
||||
import CopyIcon from '../../common/CopyIcon';
|
||||
|
||||
import { TNil } from '../../types';
|
||||
import { KeyValuePair, Link } from '../../types/trace';
|
||||
import { KeyValuePair, Link } from '@grafana/data';
|
||||
import { UIDropdown, UIIcon, UIMenu, UIMenuItem } from '../../uiElementsContext';
|
||||
import { autoColor, createStyle, Theme, useTheme } from '../../Theme';
|
||||
import { ubInlineBlock, uWidth100 } from '../../uberUtilityStyles';
|
||||
|
||||
@@ -25,7 +25,7 @@ import CopyIcon from '../../common/CopyIcon';
|
||||
import LabeledList from '../../common/LabeledList';
|
||||
|
||||
import { TNil } from '../../types';
|
||||
import { KeyValuePair, Link, Log, Span } from '../../types/trace';
|
||||
import { KeyValuePair, Link, Log, Span } from '@grafana/data';
|
||||
import AccordianReferences from './AccordianReferences';
|
||||
import { autoColor, createStyle, Theme, useTheme } from '../../Theme';
|
||||
import { UIDivider } from '../../uiElementsContext';
|
||||
|
||||
@@ -21,7 +21,7 @@ import SpanTreeOffset from './SpanTreeOffset';
|
||||
import TimelineRow from './TimelineRow';
|
||||
import { autoColor, createStyle, Theme, withTheme } from '../Theme';
|
||||
|
||||
import { Log, Span, KeyValuePair, Link } from '../types/trace';
|
||||
import { Log, Span, KeyValuePair, Link } from '@grafana/data';
|
||||
|
||||
const getStyles = createStyle((theme: Theme) => {
|
||||
return {
|
||||
|
||||
@@ -19,7 +19,7 @@ import IoIosArrowDown from 'react-icons/lib/io/ios-arrow-down';
|
||||
import { css } from 'emotion';
|
||||
import cx from 'classnames';
|
||||
|
||||
import { Span } from '../types/trace';
|
||||
import { Span } from '@grafana/data';
|
||||
import spanAncestorIds from '../utils/span-ancestor-ids';
|
||||
|
||||
import { autoColor, createStyle, Theme, withTheme } from '../Theme';
|
||||
|
||||
@@ -29,7 +29,7 @@ import {
|
||||
import { Accessors } from '../ScrollManager';
|
||||
import { getColorByKey } from '../utils/color-generator';
|
||||
import { TNil } from '../types';
|
||||
import { Log, Span, Trace, KeyValuePair, Link } from '../types/trace';
|
||||
import { Log, Span, Trace, KeyValuePair, Link } from '@grafana/data';
|
||||
import TTraceTimeline from '../types/TTraceTimeline';
|
||||
|
||||
import { createStyle, Theme, withTheme } from '../Theme';
|
||||
|
||||
@@ -21,7 +21,7 @@ import { merge as mergeShortcuts } from '../keyboard-shortcuts';
|
||||
import { Accessors } from '../ScrollManager';
|
||||
import { TUpdateViewRangeTimeFunction, ViewRange, ViewRangeTimeUpdate } from './types';
|
||||
import { TNil } from '../types';
|
||||
import { Span, Trace, Log, KeyValuePair, Link } from '../types/trace';
|
||||
import { Span, Trace, Log, KeyValuePair, Link } from '@grafana/data';
|
||||
import TTraceTimeline from '../types/TTraceTimeline';
|
||||
import { autoColor, createStyle, Theme, withTheme } from '../Theme';
|
||||
import ExternalLinkContext from '../url/externalLinkContext';
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
import { Span } from '../types/trace';
|
||||
import { Span } from '@grafana/data';
|
||||
|
||||
export type ViewedBoundsFunctionType = (start: number, end: number) => { start: number; end: number };
|
||||
/**
|
||||
|
||||
@@ -17,7 +17,7 @@ import memoize from 'lru-memoize';
|
||||
import { getConfigValue } from '../utils/config/get-config';
|
||||
import { getParent } from './span';
|
||||
import { TNil } from '../types';
|
||||
import { Span, Link, KeyValuePair, Trace } from '..';
|
||||
import { Span, Link, KeyValuePair, Trace } from '@grafana/data';
|
||||
|
||||
const parameterRegExp = /#\{([^{}]*)\}/g;
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
import { Span } from '../types/trace';
|
||||
import { Span } from '@grafana/data';
|
||||
|
||||
/**
|
||||
* Searches the span.references to find 'CHILD_OF' reference type or returns null.
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
import { Span } from '../types';
|
||||
import { Span } from '@grafana/data';
|
||||
|
||||
export function getTraceName(spans: Span[]): string {
|
||||
const span = spans.filter(sp => !sp.references || !sp.references.length)[0];
|
||||
|
||||
@@ -17,7 +17,7 @@ import _isEqual from 'lodash/isEqual';
|
||||
// @ts-ignore
|
||||
import { getTraceSpanIdsAsTree } from '../selectors/trace';
|
||||
import { getConfigValue } from '../utils/config/get-config';
|
||||
import { KeyValuePair, Span, SpanData, Trace, TraceData } from '../types/trace';
|
||||
import { KeyValuePair, Span, SpanData, Trace, TraceData } from '@grafana/data';
|
||||
// @ts-ignore
|
||||
import TreeNode from '../utils/TreeNode';
|
||||
|
||||
|
||||
@@ -13,9 +13,8 @@
|
||||
// limitations under the License.
|
||||
|
||||
import { ApiError } from './api-error';
|
||||
import { Trace } from './trace';
|
||||
import { Trace } from '@grafana/data';
|
||||
|
||||
export * from './trace';
|
||||
export { default as TTraceTimeline } from './TTraceTimeline';
|
||||
export { default as TNil } from './TNil';
|
||||
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
// Copyright (c) 2017 Uber Technologies, Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
/**
|
||||
* All timestamps are in microseconds
|
||||
*/
|
||||
|
||||
// TODO: Everett Tech Debt: Fix KeyValuePair types
|
||||
export type KeyValuePair = {
|
||||
key: string;
|
||||
type?: string;
|
||||
value: any;
|
||||
};
|
||||
|
||||
export type Link = {
|
||||
url: string;
|
||||
text: string;
|
||||
};
|
||||
|
||||
export type Log = {
|
||||
timestamp: number;
|
||||
fields: KeyValuePair[];
|
||||
};
|
||||
|
||||
export type Process = {
|
||||
serviceName: string;
|
||||
tags: KeyValuePair[];
|
||||
};
|
||||
|
||||
export type SpanReference = {
|
||||
refType: 'CHILD_OF' | 'FOLLOWS_FROM';
|
||||
// eslint-disable-next-line no-use-before-define
|
||||
span?: Span | null | undefined;
|
||||
spanID: string;
|
||||
traceID: string;
|
||||
};
|
||||
|
||||
export type SpanData = {
|
||||
spanID: string;
|
||||
traceID: string;
|
||||
processID: string;
|
||||
operationName: string;
|
||||
startTime: number;
|
||||
duration: number;
|
||||
logs: Log[];
|
||||
tags?: KeyValuePair[];
|
||||
references?: SpanReference[];
|
||||
warnings?: string[] | null;
|
||||
flags: number;
|
||||
};
|
||||
|
||||
export type Span = SpanData & {
|
||||
depth: number;
|
||||
hasChildren: boolean;
|
||||
process: Process;
|
||||
relativeStartTime: number;
|
||||
tags: NonNullable<SpanData['tags']>;
|
||||
references: NonNullable<SpanData['references']>;
|
||||
warnings: NonNullable<SpanData['warnings']>;
|
||||
subsidiarilyReferencedBy: SpanReference[];
|
||||
};
|
||||
|
||||
export type TraceData = {
|
||||
processes: Record<string, Process>;
|
||||
traceID: string;
|
||||
warnings?: string[] | null;
|
||||
};
|
||||
|
||||
export type Trace = TraceData & {
|
||||
duration: number;
|
||||
endTime: number;
|
||||
spans: Span[];
|
||||
startTime: number;
|
||||
traceName: string;
|
||||
services: Array<{ name: string; numberOfSpans: number }>;
|
||||
};
|
||||
@@ -13,7 +13,7 @@
|
||||
// limitations under the License.
|
||||
|
||||
import React from 'react';
|
||||
import { SpanReference } from '../types/trace';
|
||||
import { SpanReference } from '@grafana/data';
|
||||
import ExternalLinkContext from './externalLinkContext';
|
||||
|
||||
type ReferenceLinkProps = {
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
import { KeyValuePair, Span } from '../types/trace';
|
||||
import { KeyValuePair, Span } from '@grafana/data';
|
||||
import { TNil } from '../types';
|
||||
|
||||
export default function filterSpans(textFilter: string, spans: Span[] | TNil) {
|
||||
|
||||
@@ -16,7 +16,7 @@ import _find from 'lodash/find';
|
||||
import _get from 'lodash/get';
|
||||
|
||||
import { TNil } from '../types';
|
||||
import { Span } from '../types/trace';
|
||||
import { Span } from '@grafana/data';
|
||||
|
||||
function getFirstAncestor(span: Span): Span | TNil {
|
||||
return _get(
|
||||
|
||||
Reference in New Issue
Block a user