mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Explore: Sort trace process attributes alphabetically (#51261)
* Explore: Sort trace process attributes alphabetically * Update betterer?
This commit is contained in:
parent
dc68213114
commit
620309ced5
@ -7694,19 +7694,11 @@ exports[`no explicit any`] = {
|
||||
"public/app/plugins/panel/nodeGraph/ViewControls.tsx:1224159931": [
|
||||
[27, 59, 3, "Unexpected any. Specify a different type.", "193409811"]
|
||||
],
|
||||
"public/app/plugins/panel/nodeGraph/editor/ArcOptionsEditor.tsx:1375628706": [
|
||||
[9, 62, 3, "Unexpected any. Specify a different type.", "193409811"],
|
||||
[9, 85, 3, "Unexpected any. Specify a different type.", "193409811"],
|
||||
[13, 5, 3, "Unexpected any. Specify a different type.", "193409811"]
|
||||
],
|
||||
"public/app/plugins/panel/nodeGraph/layout.test.ts:1938392112": [
|
||||
[5, 35, 3, "Unexpected any. Specify a different type.", "193409811"],
|
||||
[6, 37, 3, "Unexpected any. Specify a different type.", "193409811"],
|
||||
[7, 35, 3, "Unexpected any. Specify a different type.", "193409811"]
|
||||
],
|
||||
"public/app/plugins/panel/nodeGraph/types.ts:3308622216": [
|
||||
[17, 10, 3, "Unexpected any. Specify a different type.", "193409811"]
|
||||
],
|
||||
"public/app/plugins/panel/nodeGraph/usePanning.ts:887807615": [
|
||||
[186, 16, 3, "Unexpected any. Specify a different type.", "193409811"]
|
||||
],
|
||||
|
@ -16,7 +16,7 @@ import { isEqual as _isEqual } from 'lodash';
|
||||
|
||||
// @ts-ignore
|
||||
import { getTraceSpanIdsAsTree } from '../selectors/trace';
|
||||
import { TraceKeyValuePair, TraceSpan, Trace, TraceResponse } from '../types/trace';
|
||||
import { TraceKeyValuePair, TraceSpan, Trace, TraceResponse, TraceProcess } from '../types/trace';
|
||||
// @ts-ignore
|
||||
import TreeNode from '../utils/TreeNode';
|
||||
import { getConfigValue } from '../utils/config/get-config';
|
||||
@ -40,7 +40,7 @@ export function deduplicateTags(spanTags: TraceKeyValuePair[]) {
|
||||
|
||||
// exported for tests
|
||||
export function orderTags(spanTags: TraceKeyValuePair[], topPrefixes?: string[]) {
|
||||
const orderedTags: TraceKeyValuePair[] = spanTags.slice();
|
||||
const orderedTags: TraceKeyValuePair[] = spanTags?.slice() ?? [];
|
||||
const tp = (topPrefixes || []).map((p: string) => p.toLowerCase());
|
||||
|
||||
orderedTags.sort((a, b) => {
|
||||
@ -87,11 +87,20 @@ export default function transformTraceData(data: TraceResponse | undefined): Tra
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
data.spans = data.spans.filter((span) => Boolean(span.startTime));
|
||||
|
||||
// Sort process tags
|
||||
data.processes = Object.entries(data.processes).reduce<Record<string, TraceProcess>>((processes, [id, process]) => {
|
||||
processes[id] = {
|
||||
...process,
|
||||
tags: orderTags(process.tags),
|
||||
};
|
||||
return processes;
|
||||
}, {});
|
||||
|
||||
const max = data.spans.length;
|
||||
for (let i = 0; i < max; i++) {
|
||||
const span: TraceSpan = data.spans[i] as TraceSpan;
|
||||
const { startTime, duration, processID } = span;
|
||||
//
|
||||
|
||||
let spanID = span.spanID;
|
||||
// check for start / end time for the trace
|
||||
if (startTime < traceStartTime) {
|
||||
|
@ -1,17 +1,14 @@
|
||||
import { css } from '@emotion/css';
|
||||
import React from 'react';
|
||||
|
||||
import { Field, FieldNamePickerConfigSettings, StandardEditorProps, StandardEditorsRegistryItem } from '@grafana/data';
|
||||
import { Field, StandardEditorProps } from '@grafana/data';
|
||||
import { Button, ColorPicker, useStyles2 } from '@grafana/ui';
|
||||
import { FieldNamePicker } from '@grafana/ui/src/components/MatchersUI/FieldNamePicker';
|
||||
|
||||
import { ArcOption, NodeGraphOptions } from '../types';
|
||||
|
||||
type ArcOptionsEditorProps = StandardEditorProps<ArcOption[], any, NodeGraphOptions, any>;
|
||||
|
||||
const fieldNamePickerSettings: StandardEditorsRegistryItem<string, FieldNamePickerConfigSettings> = {
|
||||
settings: { filter: (field: Field) => field.name.includes('arc__') },
|
||||
} as any;
|
||||
type Settings = { filter: (field: Field) => boolean };
|
||||
type ArcOptionsEditorProps = StandardEditorProps<ArcOption[], Settings, NodeGraphOptions, undefined>;
|
||||
|
||||
export const ArcOptionsEditor = ({ value, onChange, context }: ArcOptionsEditorProps) => {
|
||||
const styles = useStyles2(getStyles);
|
||||
@ -44,7 +41,14 @@ export const ArcOptionsEditor = ({ value, onChange, context }: ArcOptionsEditorP
|
||||
onChange={(val) => {
|
||||
updateField(i, 'field', val);
|
||||
}}
|
||||
item={fieldNamePickerSettings}
|
||||
item={{
|
||||
settings: {
|
||||
filter: (field: Field) => field.name.includes('arc__'),
|
||||
},
|
||||
id: `arc-field-${i}`,
|
||||
name: `arc-field-${i}`,
|
||||
editor: () => null,
|
||||
}}
|
||||
/>
|
||||
<ColorPicker
|
||||
color={arc.color || '#808080'}
|
||||
|
@ -15,7 +15,7 @@ interface NodeOptions {
|
||||
|
||||
export interface ArcOption {
|
||||
field?: string;
|
||||
color?: any;
|
||||
color?: string;
|
||||
}
|
||||
|
||||
interface EdgeOptions {
|
||||
|
Loading…
Reference in New Issue
Block a user