diff --git a/.betterer.results b/.betterer.results index 02141dd6154..9cbe7c612b7 100644 --- a/.betterer.results +++ b/.betterer.results @@ -4300,9 +4300,6 @@ exports[`better eslint`] = { [0, 0, 0, "Do not re-export imported variable (\`./TNil\`)", "3"], [0, 0, 0, "Do not re-export imported variable (\`./links\`)", "4"] ], - "public/app/features/explore/TraceView/components/types/trace.ts:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"] - ], "public/app/features/explore/TraceView/components/utils/DraggableManager/demo/DraggableManagerDemo.tsx:5381": [ [0, 0, 0, "No untranslated strings. Wrap text with ", "0"], [0, 0, 0, "No untranslated strings. Wrap text with ", "1"], @@ -6510,9 +6507,6 @@ exports[`better eslint`] = { "public/app/plugins/datasource/jaeger/_importedDependencies/types/index.tsx:5381": [ [0, 0, 0, "Do not re-export imported variable (\`./trace\`)", "0"] ], - "public/app/plugins/datasource/jaeger/_importedDependencies/types/trace.ts:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"] - ], "public/app/plugins/datasource/jaeger/components/QueryEditor.tsx:5381": [ [0, 0, 0, "\'HorizontalGroup\' import from \'@grafana/ui\' is restricted from being used by a pattern. Use Stack component instead.", "0"] ], @@ -6524,9 +6518,6 @@ exports[`better eslint`] = { [0, 0, 0, "Do not use any type assertions.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "1"] ], - "public/app/plugins/datasource/jaeger/types.ts:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"] - ], "public/app/plugins/datasource/loki/LanguageProvider.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], diff --git a/packages/grafana-data/src/types/trace.ts b/packages/grafana-data/src/types/trace.ts index 8346f07dfb9..a63852685e6 100644 --- a/packages/grafana-data/src/types/trace.ts +++ b/packages/grafana-data/src/types/trace.ts @@ -4,6 +4,7 @@ export type TraceKeyValuePair = { key: string; value: T; + type?: string; }; /** diff --git a/public/app/features/explore/TraceView/components/TraceTimelineViewer/SpanDetail/AccordianKeyValues.tsx b/public/app/features/explore/TraceView/components/TraceTimelineViewer/SpanDetail/AccordianKeyValues.tsx index 29399e29552..4255ef39737 100644 --- a/public/app/features/explore/TraceView/components/TraceTimelineViewer/SpanDetail/AccordianKeyValues.tsx +++ b/public/app/features/explore/TraceView/components/TraceTimelineViewer/SpanDetail/AccordianKeyValues.tsx @@ -16,11 +16,11 @@ import { css } from '@emotion/css'; import cx from 'classnames'; import * as React from 'react'; -import { GrafanaTheme2 } from '@grafana/data'; +import { GrafanaTheme2, TraceKeyValuePair } from '@grafana/data'; import { Icon, useStyles2 } from '@grafana/ui'; import { autoColor } from '../../Theme'; -import { TraceKeyValuePair, TraceLink, TNil } from '../../types'; +import { TraceLink, TNil } from '../../types'; import * as markers from './AccordianKeyValues.markers'; import KeyValuesTable from './KeyValuesTable'; diff --git a/public/app/features/explore/TraceView/components/TraceTimelineViewer/SpanDetail/AccordianLogs.tsx b/public/app/features/explore/TraceView/components/TraceTimelineViewer/SpanDetail/AccordianLogs.tsx index 6ecfec0f80d..ab2824286fb 100644 --- a/public/app/features/explore/TraceView/components/TraceTimelineViewer/SpanDetail/AccordianLogs.tsx +++ b/public/app/features/explore/TraceView/components/TraceTimelineViewer/SpanDetail/AccordianLogs.tsx @@ -16,12 +16,12 @@ import { css } from '@emotion/css'; import { sortBy as _sortBy } from 'lodash'; import * as React from 'react'; -import { GrafanaTheme2 } from '@grafana/data'; +import { GrafanaTheme2, TraceKeyValuePair, TraceLog } from '@grafana/data'; import { Icon, useStyles2 } from '@grafana/ui'; import { autoColor } from '../../Theme'; import { TNil } from '../../types'; -import { TraceLog, TraceKeyValuePair, TraceLink } from '../../types/trace'; +import { TraceLink } from '../../types/trace'; import { formatDuration } from '../utils'; import AccordianKeyValues from './AccordianKeyValues'; diff --git a/public/app/features/explore/TraceView/components/TraceTimelineViewer/SpanDetail/DetailState.tsx b/public/app/features/explore/TraceView/components/TraceTimelineViewer/SpanDetail/DetailState.tsx index da040f4d2dc..95cf63f645e 100644 --- a/public/app/features/explore/TraceView/components/TraceTimelineViewer/SpanDetail/DetailState.tsx +++ b/public/app/features/explore/TraceView/components/TraceTimelineViewer/SpanDetail/DetailState.tsx @@ -12,7 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -import { TraceLog, TraceSpanReference } from '../../types/trace'; +import { TraceLog } from '@grafana/data'; + +import { TraceSpanReference } from '../../types/trace'; /** * Which items of a {@link SpanDetail} component are expanded. diff --git a/public/app/features/explore/TraceView/components/TraceTimelineViewer/SpanDetail/KeyValuesTable.tsx b/public/app/features/explore/TraceView/components/TraceTimelineViewer/SpanDetail/KeyValuesTable.tsx index 92b0731d467..e8adfa4f64f 100644 --- a/public/app/features/explore/TraceView/components/TraceTimelineViewer/SpanDetail/KeyValuesTable.tsx +++ b/public/app/features/explore/TraceView/components/TraceTimelineViewer/SpanDetail/KeyValuesTable.tsx @@ -17,12 +17,12 @@ import cx from 'classnames'; import { PropsWithChildren } from 'react'; import * as React from 'react'; -import { GrafanaTheme2 } from '@grafana/data'; +import { GrafanaTheme2, TraceKeyValuePair } from '@grafana/data'; import { Icon, useStyles2 } from '@grafana/ui'; import { autoColor } from '../../Theme'; import CopyIcon from '../../common/CopyIcon'; -import { TraceKeyValuePair, TraceLink, TNil } from '../../types'; +import { TraceLink, TNil } from '../../types'; import jsonMarkup from './jsonMarkup'; diff --git a/public/app/features/explore/TraceView/components/TraceTimelineViewer/SpanDetail/index.tsx b/public/app/features/explore/TraceView/components/TraceTimelineViewer/SpanDetail/index.tsx index 2b12605abd0..e42d646d5bf 100644 --- a/public/app/features/explore/TraceView/components/TraceTimelineViewer/SpanDetail/index.tsx +++ b/public/app/features/explore/TraceView/components/TraceTimelineViewer/SpanDetail/index.tsx @@ -17,7 +17,15 @@ import { SpanStatusCode } from '@opentelemetry/api'; import cx from 'classnames'; import * as React from 'react'; -import { DataFrame, dateTimeFormat, GrafanaTheme2, IconName, LinkModel } from '@grafana/data'; +import { + DataFrame, + dateTimeFormat, + GrafanaTheme2, + IconName, + LinkModel, + TraceKeyValuePair, + TraceLog, +} from '@grafana/data'; import { TraceToProfilesOptions } from '@grafana/o11y-ds-frontend'; import { config, locationService, reportInteraction } from '@grafana/runtime'; import { TimeZone } from '@grafana/schema'; @@ -30,7 +38,7 @@ import LabeledList from '../../common/LabeledList'; import { KIND, LIBRARY_NAME, LIBRARY_VERSION, STATUS, STATUS_MESSAGE, TRACE_STATE } from '../../constants/span'; import { SpanLinkFunc, TNil } from '../../types'; import { SpanLinkDef, SpanLinkType } from '../../types/links'; -import { TraceKeyValuePair, TraceLink, TraceLog, TraceSpan, TraceSpanReference } from '../../types/trace'; +import { TraceLink, TraceSpan, TraceSpanReference } from '../../types/trace'; import { formatDuration } from '../utils'; import AccordianKeyValues from './AccordianKeyValues'; diff --git a/public/app/features/explore/TraceView/components/TraceTimelineViewer/SpanDetailRow.tsx b/public/app/features/explore/TraceView/components/TraceTimelineViewer/SpanDetailRow.tsx index 4daee5b4db8..d93c6cb0ef1 100644 --- a/public/app/features/explore/TraceView/components/TraceTimelineViewer/SpanDetailRow.tsx +++ b/public/app/features/explore/TraceView/components/TraceTimelineViewer/SpanDetailRow.tsx @@ -16,14 +16,14 @@ import { css } from '@emotion/css'; import classNames from 'classnames'; import { PureComponent } from 'react'; -import { GrafanaTheme2, LinkModel } from '@grafana/data'; +import { GrafanaTheme2, LinkModel, TraceKeyValuePair, TraceLog } from '@grafana/data'; import { TraceToProfilesOptions } from '@grafana/o11y-ds-frontend'; import { TimeZone } from '@grafana/schema'; import { Button, clearButtonStyles, stylesFactory, withTheme2 } from '@grafana/ui'; import { autoColor } from '../Theme'; import { SpanLinkFunc } from '../types'; -import { TraceLog, TraceSpan, TraceKeyValuePair, TraceLink, TraceSpanReference } from '../types/trace'; +import { TraceSpan, TraceLink, TraceSpanReference } from '../types/trace'; import SpanDetail, { TraceFlameGraphs } from './SpanDetail'; import DetailState from './SpanDetail/DetailState'; diff --git a/public/app/features/explore/TraceView/components/TraceTimelineViewer/VirtualizedTraceView.tsx b/public/app/features/explore/TraceView/components/TraceTimelineViewer/VirtualizedTraceView.tsx index d1101c49ffa..7061cf78357 100644 --- a/public/app/features/explore/TraceView/components/TraceTimelineViewer/VirtualizedTraceView.tsx +++ b/public/app/features/explore/TraceView/components/TraceTimelineViewer/VirtualizedTraceView.tsx @@ -18,7 +18,7 @@ import memoizeOne from 'memoize-one'; import * as React from 'react'; import { RefObject } from 'react'; -import { GrafanaTheme2, LinkModel } from '@grafana/data'; +import { GrafanaTheme2, LinkModel, TraceKeyValuePair, TraceLog } from '@grafana/data'; import { TraceToProfilesOptions } from '@grafana/o11y-ds-frontend'; import { config, reportInteraction } from '@grafana/runtime'; import { TimeZone } from '@grafana/schema'; @@ -27,7 +27,7 @@ import { stylesFactory, withTheme2, ToolbarButton } from '@grafana/ui'; import { PEER_SERVICE } from '../constants/tag-keys'; import { CriticalPathSection, SpanBarOptions, SpanLinkFunc, TNil } from '../types'; import TTraceTimeline from '../types/TTraceTimeline'; -import { TraceLog, TraceSpan, Trace, TraceKeyValuePair, TraceLink, TraceSpanReference } from '../types/trace'; +import { TraceSpan, Trace, TraceLink, TraceSpanReference } from '../types/trace'; import { getColorByKey } from '../utils/color-generator'; import ListView from './ListView'; diff --git a/public/app/features/explore/TraceView/components/TraceTimelineViewer/index.tsx b/public/app/features/explore/TraceView/components/TraceTimelineViewer/index.tsx index dba6d3d3ae0..8cdb5953884 100644 --- a/public/app/features/explore/TraceView/components/TraceTimelineViewer/index.tsx +++ b/public/app/features/explore/TraceView/components/TraceTimelineViewer/index.tsx @@ -15,7 +15,7 @@ import { css } from '@emotion/css'; import { PureComponent, RefObject } from 'react'; -import { GrafanaTheme2, LinkModel } from '@grafana/data'; +import { GrafanaTheme2, LinkModel, TraceKeyValuePair, TraceLog } from '@grafana/data'; import { SpanBarOptions, TraceToProfilesOptions } from '@grafana/o11y-ds-frontend'; import { config, reportInteraction } from '@grafana/runtime'; import { TimeZone } from '@grafana/schema'; @@ -25,7 +25,7 @@ import { autoColor } from '../Theme'; import { merge as mergeShortcuts } from '../keyboard-shortcuts'; import { CriticalPathSection, SpanLinkFunc, TNil } from '../types'; import TTraceTimeline from '../types/TTraceTimeline'; -import { TraceSpan, Trace, TraceLog, TraceKeyValuePair, TraceLink, TraceSpanReference } from '../types/trace'; +import { TraceSpan, Trace, TraceLink, TraceSpanReference } from '../types/trace'; import { TraceFlameGraphs } from './SpanDetail'; import TimelineHeaderRow from './TimelineHeaderRow'; diff --git a/public/app/features/explore/TraceView/components/demo/trace-generators.ts b/public/app/features/explore/TraceView/components/demo/trace-generators.ts index 85101b3f436..b10486b2ffe 100644 --- a/public/app/features/explore/TraceView/components/demo/trace-generators.ts +++ b/public/app/features/explore/TraceView/components/demo/trace-generators.ts @@ -14,12 +14,8 @@ import Chance from 'chance'; -import { - TraceSpanData, - TraceProcess, - TraceKeyValuePair, - TraceResponse, -} from 'app/features/explore/TraceView/components/types/trace'; +import { TraceKeyValuePair } from '@grafana/data'; +import { TraceSpanData, TraceProcess, TraceResponse } from 'app/features/explore/TraceView/components/types/trace'; import { getSpanId } from '../selectors/span'; diff --git a/public/app/features/explore/TraceView/components/model/transform-trace-data.tsx b/public/app/features/explore/TraceView/components/model/transform-trace-data.tsx index e4d294c8eb2..8220af49732 100644 --- a/public/app/features/explore/TraceView/components/model/transform-trace-data.tsx +++ b/public/app/features/explore/TraceView/components/model/transform-trace-data.tsx @@ -15,8 +15,10 @@ import { isEqual as _isEqual } from 'lodash'; // @ts-ignore +import { TraceKeyValuePair } from '@grafana/data'; + import { getTraceSpanIdsAsTree } from '../selectors/trace'; -import { TraceKeyValuePair, TraceSpan, Trace, TraceResponse, TraceProcess } from '../types'; +import { TraceSpan, Trace, TraceResponse, TraceProcess } from '../types'; // @ts-ignore import TreeNode from '../utils/TreeNode'; import { getConfigValue } from '../utils/config/get-config'; diff --git a/public/app/features/explore/TraceView/components/types/index.tsx b/public/app/features/explore/TraceView/components/types/index.tsx index 2c1ad3dca5d..0d8c47117b1 100644 --- a/public/app/features/explore/TraceView/components/types/index.tsx +++ b/public/app/features/explore/TraceView/components/types/index.tsx @@ -12,15 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -export { - TraceSpan, - TraceResponse, - Trace, - TraceProcess, - TraceKeyValuePair, - TraceLink, - CriticalPathSection, -} from './trace'; +export { TraceSpan, TraceResponse, Trace, TraceProcess, TraceLink, CriticalPathSection } from './trace'; export { SpanBarOptions, SpanBarOptionsData } from '../settings/SpanBarSettings'; export { default as TTraceTimeline } from './TTraceTimeline'; export { default as TNil } from './TNil'; diff --git a/public/app/features/explore/TraceView/components/types/trace.ts b/public/app/features/explore/TraceView/components/types/trace.ts index bee45e059b4..0c38b7ba584 100644 --- a/public/app/features/explore/TraceView/components/types/trace.ts +++ b/public/app/features/explore/TraceView/components/types/trace.ts @@ -12,28 +12,17 @@ // See the License for the specific language governing permissions and // limitations under the License. +import { TraceKeyValuePair, TraceLog } from '@grafana/data'; + /** * All timestamps are in microseconds */ -// TODO: Everett Tech Debt: Fix KeyValuePair types -export type TraceKeyValuePair = { - key: string; - type?: string; - value: any; -}; - export type TraceLink = { url: string; text: string; }; -export type TraceLog = { - timestamp: number; - fields: TraceKeyValuePair[]; - name?: string; -}; - export type TraceProcess = { serviceName: string; tags: TraceKeyValuePair[]; diff --git a/public/app/features/explore/TraceView/components/utils/filter-spans.tsx b/public/app/features/explore/TraceView/components/utils/filter-spans.tsx index 9f6d908d52e..d2caf084568 100644 --- a/public/app/features/explore/TraceView/components/utils/filter-spans.tsx +++ b/public/app/features/explore/TraceView/components/utils/filter-spans.tsx @@ -14,9 +14,11 @@ import { SpanStatusCode } from '@opentelemetry/api'; +import { TraceKeyValuePair } from '@grafana/data'; + import { SearchProps, Tag } from '../../useSearch'; import { KIND, LIBRARY_NAME, LIBRARY_VERSION, STATUS, STATUS_MESSAGE, TRACE_STATE, ID } from '../constants/span'; -import { TNil, TraceKeyValuePair, TraceSpan } from '../types'; +import { TNil, TraceSpan } from '../types'; // filter spans where all filters added need to be true for each individual span that is returned // i.e. the more filters added -> the more specific that the returned results are diff --git a/public/app/features/explore/TraceView/useDetailState.test.ts b/public/app/features/explore/TraceView/useDetailState.test.ts index cbf9066369c..4c797d0cec5 100644 --- a/public/app/features/explore/TraceView/useDetailState.test.ts +++ b/public/app/features/explore/TraceView/useDetailState.test.ts @@ -1,8 +1,7 @@ import { act, renderHook } from '@testing-library/react'; -import { DataFrame } from '@grafana/data'; +import { DataFrame, TraceLog } from '@grafana/data'; -import { TraceLog } from './components/types/trace'; import { useDetailState } from './useDetailState'; const sampleFrame: DataFrame = { diff --git a/public/app/features/explore/TraceView/useDetailState.ts b/public/app/features/explore/TraceView/useDetailState.ts index e3e4df4c75a..48414154995 100644 --- a/public/app/features/explore/TraceView/useDetailState.ts +++ b/public/app/features/explore/TraceView/useDetailState.ts @@ -1,9 +1,9 @@ import { useCallback, useState, useEffect } from 'react'; -import { DataFrame } from '@grafana/data'; +import { DataFrame, TraceLog } from '@grafana/data'; import { DetailState } from './components'; -import { TraceLog, TraceSpanReference } from './components/types/trace'; +import { TraceSpanReference } from './components/types/trace'; /** * Keeps state of the span detail. This means whether span details are open but also state of each detail subitem * like logs or tags. diff --git a/public/app/plugins/datasource/jaeger/_importedDependencies/model/transform-trace-data.tsx b/public/app/plugins/datasource/jaeger/_importedDependencies/model/transform-trace-data.tsx index 97eb98b50fa..f095fe3d8c1 100644 --- a/public/app/plugins/datasource/jaeger/_importedDependencies/model/transform-trace-data.tsx +++ b/public/app/plugins/datasource/jaeger/_importedDependencies/model/transform-trace-data.tsx @@ -14,8 +14,10 @@ import { isEqual as _isEqual } from 'lodash'; +import { TraceKeyValuePair } from '@grafana/data'; + import { getTraceSpanIdsAsTree } from '../selectors/trace'; -import { TraceKeyValuePair, TraceSpan, Trace, TraceResponse, TraceProcess } from '../types'; +import { TraceSpan, Trace, TraceResponse, TraceProcess } from '../types'; import TreeNode from '../utils/TreeNode'; import { getConfigValue } from '../utils/config/get-config'; diff --git a/public/app/plugins/datasource/jaeger/_importedDependencies/types/index.tsx b/public/app/plugins/datasource/jaeger/_importedDependencies/types/index.tsx index 5eaae6e676e..990c2e506b0 100644 --- a/public/app/plugins/datasource/jaeger/_importedDependencies/types/index.tsx +++ b/public/app/plugins/datasource/jaeger/_importedDependencies/types/index.tsx @@ -12,12 +12,4 @@ // See the License for the specific language governing permissions and // limitations under the License. -export { - TraceSpan, - TraceResponse, - Trace, - TraceProcess, - TraceKeyValuePair, - TraceLink, - CriticalPathSection, -} from './trace'; +export { TraceSpan, TraceResponse, Trace, TraceProcess, TraceLink, CriticalPathSection } from './trace'; diff --git a/public/app/plugins/datasource/jaeger/_importedDependencies/types/trace.ts b/public/app/plugins/datasource/jaeger/_importedDependencies/types/trace.ts index bee45e059b4..0c38b7ba584 100644 --- a/public/app/plugins/datasource/jaeger/_importedDependencies/types/trace.ts +++ b/public/app/plugins/datasource/jaeger/_importedDependencies/types/trace.ts @@ -12,28 +12,17 @@ // See the License for the specific language governing permissions and // limitations under the License. +import { TraceKeyValuePair, TraceLog } from '@grafana/data'; + /** * All timestamps are in microseconds */ -// TODO: Everett Tech Debt: Fix KeyValuePair types -export type TraceKeyValuePair = { - key: string; - type?: string; - value: any; -}; - export type TraceLink = { url: string; text: string; }; -export type TraceLog = { - timestamp: number; - fields: TraceKeyValuePair[]; - name?: string; -}; - export type TraceProcess = { serviceName: string; tags: TraceKeyValuePair[]; diff --git a/public/app/plugins/datasource/jaeger/types.ts b/public/app/plugins/datasource/jaeger/types.ts index 3fc5f8de320..7173be50a1f 100644 --- a/public/app/plugins/datasource/jaeger/types.ts +++ b/public/app/plugins/datasource/jaeger/types.ts @@ -1,22 +1,10 @@ -import { DataQuery } from '@grafana/data'; - -export type TraceKeyValuePair = { - key: string; - type?: string; - value: any; -}; +import { DataQuery, TraceKeyValuePair, TraceLog } from '@grafana/data'; export type TraceLink = { url: string; text: string; }; -export type TraceLog = { - timestamp: number; - fields: TraceKeyValuePair[]; - name?: string; -}; - export type TraceProcess = { serviceName: string; tags: TraceKeyValuePair[];