Commit 5f923be2 by Zoltán Bedi Committed by GitHub

Plugins: move jaeger trace type to grafana data (#25403)

* Plugins: move jaeger trace type to grafana data

* Remove unnecessary type from tsconfig
parent ce127acf
......@@ -24,6 +24,7 @@ export * from './fieldColor';
export * from './theme';
export * from './orgs';
export * from './flot';
export * from './trace';
import * as AppEvents from './appEvents';
import { AppEvent } from './appEvents';
......
......@@ -14,6 +14,7 @@
"typescript": "3.7.5"
},
"dependencies": {
"@grafana/data": "7.1.0-pre.0",
"@types/classnames": "^2.2.7",
"@types/deep-freeze": "^0.1.1",
"@types/hoist-non-react-statics": "^3.3.1",
......
......@@ -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) => {
......
......@@ -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';
......
......@@ -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';
......
......@@ -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(
......
{
"compilerOptions": {
"baseUrl": "node_modules/@types",
"typeRoots": ["node_modules/@types"]
},
"extends": "@grafana/tsconfig",
"include": ["src/**/*.ts*", "typings"]
"include": ["src/**/*.ts*", "typings", "../../public/app/types/jquery/*.ts"]
}
import React from 'react';
import { shallow } from 'enzyme';
import { TraceView } from './TraceView';
import { SpanData, TraceData, TracePageHeader, TraceTimelineViewer } from '@jaegertracing/jaeger-ui-components';
import { TracePageHeader, TraceTimelineViewer } from '@jaegertracing/jaeger-ui-components';
import { TraceData, SpanData } from '@grafana/data';
function renderTraceView() {
const wrapper = shallow(<TraceView trace={response} />);
......
import React, { useCallback, useMemo, useState } from 'react';
import {
KeyValuePair,
Link,
Span,
SpanData,
ThemeOptions,
ThemeProvider,
ThemeType,
Trace,
TraceData,
TracePageHeader,
TraceTimelineViewer,
transformTraceData,
......@@ -22,6 +16,7 @@ import { useChildrenState } from './useChildrenState';
import { useDetailState } from './useDetailState';
import { useHoverIndentGuide } from './useHoverIndentGuide';
import { colors, useTheme } from '@grafana/ui';
import { TraceData, SpanData, Trace, Span, KeyValuePair, Link } from '@grafana/data';
type Props = {
trace: TraceData & { spans: SpanData[] };
......
import { renderHook, act } from '@testing-library/react-hooks';
import { useChildrenState } from './useChildrenState';
import { Span } from '@jaegertracing/jaeger-ui-components';
import { Span } from '@grafana/data';
describe('useChildrenState', () => {
describe('childrenToggle', () => {
......
import { useCallback, useState } from 'react';
import { Span } from '@jaegertracing/jaeger-ui-components';
import { Span } from '@grafana/data';
/**
* Children state means whether spans are collapsed or not. Also provides some functions to manipulate that state.
......
import { renderHook, act } from '@testing-library/react-hooks';
import { Log } from '@jaegertracing/jaeger-ui-components';
import { Log } from '@grafana/data';
import { useDetailState } from './useDetailState';
describe('useDetailState', () => {
......
import { useCallback, useState } from 'react';
import { DetailState, Log } from '@jaegertracing/jaeger-ui-components';
import { DetailState } from '@jaegertracing/jaeger-ui-components';
import { Log } from '@grafana/data';
/**
* Keeps state of the span detail. This means whether span details are open but also state of each detail subitem
......
import { renderHook, act } from '@testing-library/react-hooks';
import { useSearch } from './useSearch';
import { Span } from '@jaegertracing/jaeger-ui-components';
import { Span } from '@grafana/data';
describe('useSearch', () => {
it('returns matching span IDs', async () => {
......
import { useMemo, useState } from 'react';
import { Span, filterSpans } from '@jaegertracing/jaeger-ui-components';
import { filterSpans } from '@jaegertracing/jaeger-ui-components';
import { Span } from '@grafana/data';
/**
* Controls the state of search input that highlights spans if they match the search string.
......
......@@ -2,9 +2,8 @@ import React from 'react';
import { JaegerDatasource, JaegerQuery } from './datasource';
import { ButtonCascader, CascaderOption } from '@grafana/ui';
import { AppEvents, ExploreQueryFieldProps } from '@grafana/data';
import { AppEvents, ExploreQueryFieldProps, Span, TraceData } from '@grafana/data';
import { appEvents } from '../../../core/core';
import { Span, TraceData } from '@jaegertracing/jaeger-ui-components';
const ALL_OPERATIONS_KEY = '__ALL__';
const NO_TRACES_KEY = '__NO_TRACES__';
......
import { SpanData, TraceData } from '@jaegertracing/jaeger-ui-components';
import { SpanData, TraceData } from '@grafana/data';
import { ZipkinSpan } from '../types';
export const zipkinResponse: ZipkinSpan[] = [
......
import { identity } from 'lodash';
import { keyBy } from 'lodash';
import { ZipkinAnnotation, ZipkinEndpoint, ZipkinSpan } from '../types';
import { KeyValuePair, Log, Process, SpanData, TraceData } from '@jaegertracing/jaeger-ui-components';
import { KeyValuePair, Log, Process, SpanData, TraceData } from '@grafana/data';
/**
* Transforms response to format similar to Jaegers as we use Jaeger ui on the frontend.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment