mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Tracing: Remove redundant types (#91835)
* Display event name of a span * Clean up * Retrigger the build * Show colon only when there are fields to display * Rollback * Use event name when exporting to OTLP * Allow filtering spans by event name * Remove redundant types * Remove redundant TraceLog * Update betterer report
This commit is contained in:
parent
8c702d4a6b
commit
3514504240
.betterer.results
packages/grafana-data/src/types
public/app
features/explore/TraceView
components
useDetailState.test.tsuseDetailState.tsplugins/datasource/jaeger
@ -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 <Trans />", "0"],
|
||||
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "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"]
|
||||
],
|
||||
|
@ -4,6 +4,7 @@
|
||||
export type TraceKeyValuePair<T = any> = {
|
||||
key: string;
|
||||
value: T;
|
||||
type?: string;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -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';
|
||||
|
@ -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';
|
||||
|
@ -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.
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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';
|
||||
|
@ -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';
|
||||
|
@ -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';
|
||||
|
@ -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';
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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';
|
||||
|
@ -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';
|
||||
|
@ -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[];
|
||||
|
@ -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
|
||||
|
@ -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 = {
|
||||
|
@ -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.
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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';
|
||||
|
@ -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[];
|
||||
|
@ -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[];
|
||||
|
Loading…
Reference in New Issue
Block a user