Skip to content

Commit bdc3199

Browse files
TackAdamAdam Tackett
andauthored
Explore:Traces Empty state (#10724)
* trace empty state Signed-off-by: Adam Tackett <[email protected]> * changelog Signed-off-by: Adam Tackett <[email protected]> * fix test Signed-off-by: Adam Tackett <[email protected]> * fix test Signed-off-by: Adam Tackett <[email protected]> * fix conflcit Signed-off-by: Adam Tackett <[email protected]> * ui feedback Signed-off-by: Adam Tackett <[email protected]> * update to cover additional schema Signed-off-by: Adam Tackett <[email protected]> * fix conflcit Signed-off-by: Adam Tackett <[email protected]> --------- Signed-off-by: Adam Tackett <[email protected]> Signed-off-by: Adam Tackett <[email protected]> Co-authored-by: Adam Tackett <[email protected]>
1 parent 9850413 commit bdc3199

File tree

9 files changed

+993
-215
lines changed

9 files changed

+993
-215
lines changed

changelogs/fragments/10724.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
fix:
2+
- Explore:Traces Empty state error handling ([#10724](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/10724))

src/plugins/explore/public/application/pages/traces/trace_details/public/utils/helper_functions.tsx

Lines changed: 73 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44
*/
55

66
import React from 'react';
7-
import { EuiCallOut } from '@elastic/eui';
7+
import { EuiCallOut, EuiSpacer, EuiText, EuiLink } from '@elastic/eui';
88
import { i18n } from '@osd/i18n';
99
import { resolveServiceNameFromSpan } from '../traces/ppl_resolve_helpers';
10+
import { Dataset } from '../../../../../../../../data/common';
11+
import { getMissingFieldsDescription } from '../../../../../../utils/trace_field_validation';
1012

1113
export function microToMilliSec(micro: number) {
1214
if (typeof micro !== 'number' || isNaN(micro)) return 0;
@@ -87,3 +89,73 @@ export function NoMatchMessage({ traceId }: NoMatchMessageProps) {
8789
</EuiCallOut>
8890
);
8991
}
92+
93+
interface MissingFieldsEmptyStateProps {
94+
missingFields: string[];
95+
dataset?: Dataset;
96+
workspaceId?: string;
97+
}
98+
99+
export function MissingFieldsEmptyState({
100+
missingFields,
101+
dataset,
102+
workspaceId,
103+
}: MissingFieldsEmptyStateProps) {
104+
return (
105+
<div style={{ padding: '24px' }}>
106+
<EuiCallOut
107+
title={i18n.translate('explore.traceDetails.missingFields.title', {
108+
defaultMessage: 'Unable to display trace detail',
109+
})}
110+
color="warning"
111+
iconType="iInCircle"
112+
>
113+
<EuiText size="s">
114+
<p>
115+
{i18n.translate('explore.traceDetails.missingFields.description', {
116+
defaultMessage:
117+
'The trace detail page cannot be displayed due to missing fields from the ',
118+
})}
119+
<EuiLink
120+
href="https://github.com/opensearch-project/data-prepper/blob/main/data-prepper-plugins/opensearch/src/main/resources/index-template/otel-v1-apm-span-index-standard-template.json"
121+
target="_blank"
122+
external
123+
>
124+
{i18n.translate('explore.traceDetails.missingFields.schemaLink', {
125+
defaultMessage: 'Data-Prepper OTel schema',
126+
})}
127+
</EuiLink>
128+
{i18n.translate('explore.traceDetails.missingFields.descriptionContinued', {
129+
defaultMessage:
130+
'. We recommend checking the source data or dataset for missing or improperly mapped fields.',
131+
})}
132+
</p>
133+
</EuiText>
134+
135+
<EuiSpacer size="m" />
136+
137+
<EuiText size="s">
138+
<p>
139+
<strong>
140+
{i18n.translate('explore.traceDetails.missingFields.missingFieldsLabel', {
141+
defaultMessage: 'Missing fields:',
142+
})}
143+
</strong>
144+
</p>
145+
</EuiText>
146+
147+
<EuiSpacer size="s" />
148+
149+
<EuiText size="s">
150+
<div>
151+
{getMissingFieldsDescription(missingFields).map((field, index) => (
152+
<div key={index} style={{ marginBottom: '8px' }}>
153+
<strong>{field.name}</strong> - {field.description}
154+
</div>
155+
))}
156+
</div>
157+
</EuiText>
158+
</EuiCallOut>
159+
</div>
160+
);
161+
}

src/plugins/explore/public/application/pages/traces/trace_details/trace_view.test.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,8 @@ describe('TraceDetails', () => {
180180
startTimeUnixNano: '2023-01-01T00:00:00.000000000Z',
181181
endTimeUnixNano: '2023-01-01T00:00:01.000000000Z',
182182
durationInNanos: 1000000000,
183+
parentSpanId: '',
184+
status: { code: 0 },
183185
},
184186
{
185187
spanId: 'span-2',
@@ -191,6 +193,8 @@ describe('TraceDetails', () => {
191193
startTimeUnixNano: '2023-01-01T00:00:01.000000000Z',
192194
endTimeUnixNano: '2023-01-01T00:00:02.000000000Z',
193195
durationInNanos: 1000000000,
196+
parentSpanId: 'span-1',
197+
status: { code: 0 },
194198
},
195199
];
196200

@@ -731,6 +735,7 @@ describe('TraceDetails', () => {
731735
status: { code: 2 }, // Error
732736
startTimeUnixNano: '2023-01-01T00:00:00.000000000Z',
733737
endTimeUnixNano: '2023-01-01T00:00:01.000000000Z',
738+
parentSpanId: '',
734739
},
735740
{
736741
spanId: 'span-2',
@@ -740,6 +745,7 @@ describe('TraceDetails', () => {
740745
status: { code: 0 }, // No error
741746
startTimeUnixNano: '2023-01-01T00:00:01.000000000Z',
742747
endTimeUnixNano: '2023-01-01T00:00:02.000000000Z',
748+
parentSpanId: 'span-1',
743749
},
744750
];
745751

0 commit comments

Comments
 (0)