Skip to content

Commit dda72c0

Browse files
authored
Fix OTEL Services integration (#1770)
* Improve error message for invalid integration in unit tests Signed-off-by: Simeon Widdis <[email protected]> * Fix otel integration to pass validation tests Signed-off-by: Simeon Widdis <[email protected]> --------- Signed-off-by: Simeon Widdis <[email protected]>
1 parent 9aee128 commit dda72c0

10 files changed

+21
-96
lines changed

server/adaptors/integrations/__data__/repository/otel-services/data/traces-samples.json

Lines changed: 6 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -66,23 +66,7 @@
6666
},
6767
"db.instance": "ffs",
6868
"db.name": "ffs",
69-
"db.statement": ""
70-
"SELECT f0."
71-
id
72-
", f0."
73-
description
74-
", f0."
75-
enabled
76-
", f0."
77-
name
78-
", f0."
79-
inserted_at
80-
", f0."
81-
updated_at
82-
" FROM "
83-
featureflags
84-
" AS f0"
85-
"",
69+
"db.statement": "SELECT f0.\"id\", f0.\"description\", f0.\"enabled\", f0.\"name\", f0.\"inserted_at\", f0.\"updated_at\" FROM \"featureflags\" AS f0",
8670
"db.type": "sql",
8771
"db.url": "ecto://ffs_postgres",
8872
"decode_time_microseconds": 216,
@@ -193,23 +177,7 @@
193177
},
194178
"db.instance": "ffs",
195179
"db.name": "ffs",
196-
"db.statement": ""
197-
"SELECT f0."
198-
id
199-
", f0."
200-
description
201-
", f0."
202-
enabled
203-
", f0."
204-
name
205-
", f0."
206-
inserted_at
207-
", f0."
208-
updated_at
209-
" FROM "
210-
featureflags
211-
" AS f0"
212-
"",
180+
"db.statement": "SELECT f0.\"id\", f0.\"description\", f0.\"enabled\", f0.\"name\", f0.\"inserted_at\", f0.\"updated_at\" FROM \"featureflags\" AS f0",
213181
"db.type": "sql",
214182
"db.url": "ecto://ffs_postgres",
215183
"decode_time_microseconds": 24,
@@ -252,7 +220,7 @@
252220
"@timestamp": "0001-01-01T00:00:00Z",
253221
"traceId": "e3335d43c7790064a14318ef59602e56",
254222
"traceState": ""
255-
}
223+
},
256224
{
257225
"attributes": {
258226
"data_stream": {
@@ -320,23 +288,7 @@
320288
},
321289
"db.instance": "ffs",
322290
"db.name": "ffs",
323-
"db.statement": ""
324-
"SELECT f0."
325-
id
326-
", f0."
327-
description
328-
", f0."
329-
enabled
330-
", f0."
331-
name
332-
", f0."
333-
inserted_at
334-
", f0."
335-
updated_at
336-
" FROM "
337-
featureflags
338-
" AS f0"
339-
"",
291+
"db.statement": "SELECT f0.\"id\", f0.\"description\", f0.\"enabled\", f0.\"name\", f0.\"inserted_at\", f0.\"updated_at\" FROM \"featureflags\" AS f0",
340292
"db.type": "sql",
341293
"db.url": "ecto://ffs_postgres",
342294
"decode_time_microseconds": 11,
@@ -447,23 +399,7 @@
447399
},
448400
"db.instance": "ffs",
449401
"db.name": "ffs",
450-
"db.statement": ""
451-
"SELECT f0."
452-
id
453-
", f0."
454-
description
455-
", f0."
456-
enabled
457-
", f0."
458-
name
459-
", f0."
460-
inserted_at
461-
", f0."
462-
updated_at
463-
" FROM "
464-
featureflags
465-
" AS f0"
466-
"",
402+
"db.statement": "SELECT f0.\"id\", f0.\"description\", f0.\"enabled\", f0.\"name\", f0.\"inserted_at\", f0.\"updated_at\" FROM \"featureflags\" AS f0",
467403
"db.type": "sql",
468404
"db.url": "ecto://ffs_postgres",
469405
"decode_time_microseconds": 104,
@@ -574,23 +510,7 @@
574510
},
575511
"db.instance": "ffs",
576512
"db.name": "ffs",
577-
"db.statement": ""
578-
"SELECT f0."
579-
id
580-
", f0."
581-
description
582-
", f0."
583-
enabled
584-
", f0."
585-
name
586-
", f0."
587-
inserted_at
588-
", f0."
589-
updated_at
590-
" FROM "
591-
featureflags
592-
" AS f0"
593-
"",
513+
"db.statement": "SELECT f0.\"id\", f0.\"description\", f0.\"enabled\", f0.\"name\", f0.\"inserted_at\", f0.\"updated_at\" FROM \"featureflags\" AS f0",
594514
"db.type": "sql",
595515
"db.url": "ecto://ffs_postgres",
596516
"decode_time_microseconds": 10,

server/adaptors/integrations/__data__/repository/otel-services/otel-services-1.0.0.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"description": "Otel Services Demo App with OpenSearch Observability",
66
"license": "Apache-2.0",
77
"type": "traces",
8-
"labels": ["log", "traces", "metrics", "Flint S3"],
8+
"labels": ["log", "traces", "metrics"],
99
"author": "OpenSearch",
1010
"sourceUrl": "https://github.com/opensearch-project/dashboards-observability/tree/main/server/adaptors/integrations/__data__/repository/otel-services/info",
1111
"workflows": [
@@ -70,35 +70,35 @@
7070
],
7171
"assets": [
7272
{
73-
"name": "otel-services-dashboard",
73+
"name": "otel_services_dashboard",
7474
"version": "1.0.0",
7575
"extension": "ndjson",
7676
"type": "savedObjectBundle",
7777
"workflows": ["dashboards"]
7878
},
7979
{
80-
"name": "otel-single-service-dashboard",
80+
"name": "otel_single_service_dashboard",
8181
"version": "1.0.0",
8282
"extension": "ndjson",
8383
"type": "savedObjectBundle",
8484
"workflows": ["dashboards"]
8585
},
8686
{
87-
"name": "otel-ingestion-rate-dashboard",
87+
"name": "otel_ingestion_rate_dashboard",
8888
"version": "1.0.0",
8989
"extension": "ndjson",
9090
"type": "savedObjectBundle",
9191
"workflows": ["dashboards"]
9292
},
9393
{
94-
"name": "otel-amp-network-metrics-dashboard",
94+
"name": "otel_amp_network_metrics_dashboard",
9595
"version": "1.0.0",
9696
"extension": "ndjson",
9797
"type": "savedObjectBundle",
9898
"workflows": ["dashboards"]
9999
},
100100
{
101-
"name": "otel-apm-network-services",
101+
"name": "otel_apm_network_services",
102102
"version": "1.0.0",
103103
"extension": "ndjson",
104104
"type": "savedObjectBundle",

server/adaptors/integrations/__test__/json_repository.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ const fetchSerializedIntegrations = async (): Promise<Result<SerializedIntegrati
3737
describe('The Local Serialized Catalog', () => {
3838
it('Should serialize without errors', async () => {
3939
const serialized = await fetchSerializedIntegrations();
40+
expect(serialized.error).not.toBeDefined();
4041
expect(serialized.ok).toBe(true);
4142
});
4243

server/adaptors/integrations/repository/__test__/integration_reader.test.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,9 @@ describe('Integration', () => {
8383

8484
const result = await integration.getConfig(TEST_INTEGRATION_CONFIG.version);
8585

86-
expect(result.error?.message).toBe('Unable to parse file as JSON or NDJson');
86+
expect(result.error?.message).toBe(
87+
"Unable to parse file 'sample-2.0.0.json' as JSON or NDJson"
88+
);
8789
});
8890

8991
it('should return an error if the integration config does not exist', async () => {
@@ -134,7 +136,9 @@ describe('Integration', () => {
134136

135137
const result = await integration.getAssets(TEST_INTEGRATION_CONFIG.version);
136138

137-
expect(result.error?.message).toBe('Unable to parse file as JSON or NDJson');
139+
expect(result.error?.message).toBe(
140+
"Unable to parse file 'sample-1.0.1.ndjson' as JSON or NDJson"
141+
);
138142
});
139143
});
140144

@@ -262,7 +266,7 @@ describe('Integration', () => {
262266

263267
const result = await integration.getSampleData();
264268

265-
expect(result.error?.message).toBe('Unable to parse file as JSON or NDJson');
269+
expect(result.error?.message).toBe("Unable to parse file 'sample.json' as JSON or NDJson");
266270
});
267271
});
268272
});

server/adaptors/integrations/repository/fs_data_adaptor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export class FileSystemDataAdaptor implements CatalogDataAdaptor {
5454
}
5555
return {
5656
ok: false,
57-
error: new Error('Unable to parse file as JSON or NDJson', { cause: err }),
57+
error: new Error(`Unable to parse file '${filename}' as JSON or NDJson`, { cause: err }),
5858
};
5959
}
6060
}

0 commit comments

Comments
 (0)