Skip to content

Commit b4013b3

Browse files
ps48joshuali925
andauthored
fix(sample-data): exclude Observability (otel) sample set on AnalyticEngine data sources (#12216)
* fix(sample-data): exclude Observability (otel) sample set on AnalyticEngine The sample data list route already limits the available sample sets for an AnalyticEngine (Mustang) data source. It kept both 'logs' and 'otel', but the Observability sample set (otel) cannot be installed on a Mustang domain: its trace index mappings declare 'nested' fields (events/links), which the pluggable data format rejects at index creation: mapper_parsing_exception: nested type is not supported with pluggable data format on field [links] so the install fails with an internal server error ('Unable to install sample data set: Sample Observability Logs, Traces, and Metrics'). Restrict the AnalyticEngine sample set list to 'logs' (Sample web logs), which has no nested fields and installs cleanly. Updates the route's unit test to assert only 'logs' is returned for an AnalyticEngine data source; non-AnalyticEngine sources are unchanged. Signed-off-by: Shenoy Pratik <pshenoy36@gmail.com> * chore: add changelog fragment for #12216 Signed-off-by: Shenoy Pratik <pshenoy36@gmail.com> * Update src/plugins/home/server/services/sample_data/routes/list.ts Co-authored-by: Joshua Li <joshuali925@gmail.com> Signed-off-by: Shenoy Pratik <sgguruda@amazon.com> --------- Signed-off-by: Shenoy Pratik <pshenoy36@gmail.com> Signed-off-by: Shenoy Pratik <sgguruda@amazon.com> Co-authored-by: Joshua Li <joshuali925@gmail.com>
1 parent dd7b404 commit b4013b3

3 files changed

Lines changed: 13 additions & 8 deletions

File tree

changelogs/fragments/12216.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
fix:
2+
- Exclude the Observability (otel) sample data set on AnalyticEngine data sources, since its nested-field trace mappings cannot be created on a pluggable-dataformat domain ([#12216](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/12216))

src/plugins/home/server/services/sample_data/routes/list.test.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ describe('sample data list route', () => {
274274
);
275275
});
276276

277-
it('filters sample datasets to only logs and otel for AnalyticEngine data source', async () => {
277+
it('filters sample datasets to only logs for AnalyticEngine data source', async () => {
278278
const mockDataSourceId = 'analyticEngineDataSource';
279279
const mockClient = jest.fn().mockResolvedValueOnce(true).mockResolvedValueOnce({ count: 1 });
280280

@@ -342,10 +342,11 @@ describe('sample data list route', () => {
342342
expect(mockSOClient.get).toHaveBeenCalledWith('data-source', mockDataSourceId);
343343
expect(mockResponse.ok).toBeCalled();
344344

345-
// Verify that only logs and otel datasets are returned
345+
// Verify that only the logs dataset is returned (otel is excluded because its
346+
// nested-field trace mappings cannot be created on an AnalyticEngine domain)
346347
const responseBody = mockResponse.ok.mock.calls[0]?.[0]?.body as any[];
347-
expect(responseBody).toHaveLength(2);
348-
expect(responseBody.map((ds) => ds.id).sort()).toEqual(['logs', 'otel']);
348+
expect(responseBody).toHaveLength(1);
349+
expect(responseBody.map((ds) => ds.id).sort()).toEqual(['logs']);
349350
});
350351

351352
it('returns all sample datasets for non-AnalyticEngine data source', async () => {

src/plugins/home/server/services/sample_data/routes/list.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,14 @@ export const createListRoute = (router: IRouter, sampleDatasets: SampleDatasetSc
5454
const workspaceState = getWorkspaceState(req);
5555
const workspaceId = workspaceState?.requestWorkspaceId;
5656

57-
// For AnalyticEngine (Mustang) datasource, only support Sample Observability Logs (otel) and Sample web logs (logs)
57+
// For AnalyticEngine datasource, only support Sample web logs (logs). The
58+
// Observability sample set (otel) is excluded because its trace index mappings use
59+
// `nested` fields (events/links), which the pluggable data format rejects at index
60+
// creation ("nested type is not supported with pluggable data format"), so installing
61+
// it against an AnalyticEngine domain fails with an internal server error.
5862
let filteredSampleDatasets = sampleDatasets;
5963
if (await isAnalyticEngineDataSource(dataSourceId, context.core.savedObjects.client)) {
60-
filteredSampleDatasets = sampleDatasets.filter(
61-
(dataset) => dataset.id === 'logs' || dataset.id === 'otel'
62-
);
64+
filteredSampleDatasets = sampleDatasets.filter((dataset) => dataset.id === 'logs');
6365
}
6466

6567
const registeredSampleDatasets = filteredSampleDatasets.map((sampleDataset) => {

0 commit comments

Comments
 (0)