Skip to content

Commit

Permalink
update descriptions
Browse files Browse the repository at this point in the history
Signed-off-by: Shenoy Pratik <[email protected]>
  • Loading branch information
ps48 committed Sep 23, 2024
1 parent 0ba456b commit bb121de
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 29 deletions.
45 changes: 20 additions & 25 deletions common/constants/trace_analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,33 +26,28 @@ export const TRACE_CUSTOM_SPAN_INDEX_SETTING = 'observability:traceAnalyticsSpan
export const TRACE_CUSTOM_SERVICE_INDEX_SETTING = 'observability:traceAnalyticsServiceIndices';

export enum TRACE_TABLE_TITLES {
all_spans = 'Spans',
trace_root_spans = 'Trace root spans',
service_entry_spans = 'Service entry spans',
all_spans = 'All Spans',
root_spans = 'Root Spans',
entry_spans = 'Service Entry Spans',
traces = 'Traces',
}

export const TRACE_TABLE_OPTIONS = [
{
label: TRACE_TABLE_TITLES.all_spans,
key: 'all_spans',
'aria-describedby': 'All spans from all traces',
},
{
label: TRACE_TABLE_TITLES.trace_root_spans,
key: 'trace_root_spans',
'aria-describedby': 'The root spans which represent the starting point of a trace',
},
{
label: TRACE_TABLE_TITLES.service_entry_spans,
key: 'service_entry_spans',
'aria-describedby': 'The spans that mark start of server-side processing (SPAN_KIND_SERVER)',
},
{
label: TRACE_TABLE_TITLES.traces,
key: 'traces',
'aria-describedby': 'Aggregates all spans by traceId to show all traces',
},
];
// Updated descriptions with standardized terms
const getDescription = (key: keyof typeof TRACE_TABLE_TITLES): string => {
const descriptions: Record<keyof typeof TRACE_TABLE_TITLES, string> = {
all_spans: 'Spans representing all activities in all traces across the system',
root_spans: 'Spans marking the root or starting point of each trace',
entry_spans: 'Spans that indicate the entry point of service-side processing',
traces: 'Spans grouped by traceId to show a complete trace lifecycle',
};
return descriptions[key];
};

// Standardized TRACE_TABLE_OPTIONS
export const TRACE_TABLE_OPTIONS = Object.entries(TRACE_TABLE_TITLES).map(([key, label]) => ({
label,
key,
'aria-describedby': getDescription(key as keyof typeof TRACE_TABLE_TITLES),
}));

export const TRACE_TABLE_TYPE_KEY = 'TraceAnalyticsTraceTableType';
4 changes: 3 additions & 1 deletion common/types/trace_analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { TRACE_TABLE_TITLES } from '../constants/trace_analytics';

export type SpanField =
| 'SPAN_ID'
| 'PARENT_SPAN_ID'
Expand Down Expand Up @@ -54,4 +56,4 @@ export interface GraphVisEdge {
}

export type TraceAnalyticsMode = 'jaeger' | 'data_prepper' | 'custom_data_prepper';
export type TraceQueryMode = 'trace_root_spans' | 'all_spans' | 'traces' | 'service_entry_spans';
export type TraceQueryMode = keyof typeof TRACE_TABLE_TITLES;
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export function TracesCustomIndicesTable(props: TracesLandingTableProps) {
'data-test-subj': 'traceTableMode',
}}
renderOption={renderTableOptions}
listProps={{ rowHeight: 75 }}
listProps={{ rowHeight: 80 }}
options={tableOptions}
onChange={(newOptions) => {
setTableOptions(newOptions);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -571,13 +571,13 @@ export const getCustomIndicesTracesQuery = (
track_total_hits: false,
};

if (queryMode === 'trace_root_spans') {
if (queryMode === 'root_spans') {
dataPrepperQuery.query.bool.filter.push({
term: {
parentSpanId: '', // Data prepper root span doesn't have any parent.
},
});
} else if (queryMode === 'service_entry_spans') {
} else if (queryMode === 'entry_spans') {
dataPrepperQuery.query.bool.filter.push({
term: {
kind: 'SPAN_KIND_SERVER',
Expand Down

0 comments on commit bb121de

Please sign in to comment.