Skip to content

Commit

Permalink
Fix OTEL Services integration (#1770)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
Swiddis authored Apr 30, 2024
1 parent 9aee128 commit dda72c0
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 96 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,23 +66,7 @@
},
"db.instance": "ffs",
"db.name": "ffs",
"db.statement": ""
"SELECT f0."
id
", f0."
description
", f0."
enabled
", f0."
name
", f0."
inserted_at
", f0."
updated_at
" FROM "
featureflags
" AS f0"
"",
"db.statement": "SELECT f0.\"id\", f0.\"description\", f0.\"enabled\", f0.\"name\", f0.\"inserted_at\", f0.\"updated_at\" FROM \"featureflags\" AS f0",
"db.type": "sql",
"db.url": "ecto://ffs_postgres",
"decode_time_microseconds": 216,
Expand Down Expand Up @@ -193,23 +177,7 @@
},
"db.instance": "ffs",
"db.name": "ffs",
"db.statement": ""
"SELECT f0."
id
", f0."
description
", f0."
enabled
", f0."
name
", f0."
inserted_at
", f0."
updated_at
" FROM "
featureflags
" AS f0"
"",
"db.statement": "SELECT f0.\"id\", f0.\"description\", f0.\"enabled\", f0.\"name\", f0.\"inserted_at\", f0.\"updated_at\" FROM \"featureflags\" AS f0",
"db.type": "sql",
"db.url": "ecto://ffs_postgres",
"decode_time_microseconds": 24,
Expand Down Expand Up @@ -252,7 +220,7 @@
"@timestamp": "0001-01-01T00:00:00Z",
"traceId": "e3335d43c7790064a14318ef59602e56",
"traceState": ""
}
},
{
"attributes": {
"data_stream": {
Expand Down Expand Up @@ -320,23 +288,7 @@
},
"db.instance": "ffs",
"db.name": "ffs",
"db.statement": ""
"SELECT f0."
id
", f0."
description
", f0."
enabled
", f0."
name
", f0."
inserted_at
", f0."
updated_at
" FROM "
featureflags
" AS f0"
"",
"db.statement": "SELECT f0.\"id\", f0.\"description\", f0.\"enabled\", f0.\"name\", f0.\"inserted_at\", f0.\"updated_at\" FROM \"featureflags\" AS f0",
"db.type": "sql",
"db.url": "ecto://ffs_postgres",
"decode_time_microseconds": 11,
Expand Down Expand Up @@ -447,23 +399,7 @@
},
"db.instance": "ffs",
"db.name": "ffs",
"db.statement": ""
"SELECT f0."
id
", f0."
description
", f0."
enabled
", f0."
name
", f0."
inserted_at
", f0."
updated_at
" FROM "
featureflags
" AS f0"
"",
"db.statement": "SELECT f0.\"id\", f0.\"description\", f0.\"enabled\", f0.\"name\", f0.\"inserted_at\", f0.\"updated_at\" FROM \"featureflags\" AS f0",
"db.type": "sql",
"db.url": "ecto://ffs_postgres",
"decode_time_microseconds": 104,
Expand Down Expand Up @@ -574,23 +510,7 @@
},
"db.instance": "ffs",
"db.name": "ffs",
"db.statement": ""
"SELECT f0."
id
", f0."
description
", f0."
enabled
", f0."
name
", f0."
inserted_at
", f0."
updated_at
" FROM "
featureflags
" AS f0"
"",
"db.statement": "SELECT f0.\"id\", f0.\"description\", f0.\"enabled\", f0.\"name\", f0.\"inserted_at\", f0.\"updated_at\" FROM \"featureflags\" AS f0",
"db.type": "sql",
"db.url": "ecto://ffs_postgres",
"decode_time_microseconds": 10,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"description": "Otel Services Demo App with OpenSearch Observability",
"license": "Apache-2.0",
"type": "traces",
"labels": ["log", "traces", "metrics", "Flint S3"],
"labels": ["log", "traces", "metrics"],
"author": "OpenSearch",
"sourceUrl": "https://github.com/opensearch-project/dashboards-observability/tree/main/server/adaptors/integrations/__data__/repository/otel-services/info",
"workflows": [
Expand Down Expand Up @@ -70,35 +70,35 @@
],
"assets": [
{
"name": "otel-services-dashboard",
"name": "otel_services_dashboard",
"version": "1.0.0",
"extension": "ndjson",
"type": "savedObjectBundle",
"workflows": ["dashboards"]
},
{
"name": "otel-single-service-dashboard",
"name": "otel_single_service_dashboard",
"version": "1.0.0",
"extension": "ndjson",
"type": "savedObjectBundle",
"workflows": ["dashboards"]
},
{
"name": "otel-ingestion-rate-dashboard",
"name": "otel_ingestion_rate_dashboard",
"version": "1.0.0",
"extension": "ndjson",
"type": "savedObjectBundle",
"workflows": ["dashboards"]
},
{
"name": "otel-amp-network-metrics-dashboard",
"name": "otel_amp_network_metrics_dashboard",
"version": "1.0.0",
"extension": "ndjson",
"type": "savedObjectBundle",
"workflows": ["dashboards"]
},
{
"name": "otel-apm-network-services",
"name": "otel_apm_network_services",
"version": "1.0.0",
"extension": "ndjson",
"type": "savedObjectBundle",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const fetchSerializedIntegrations = async (): Promise<Result<SerializedIntegrati
describe('The Local Serialized Catalog', () => {
it('Should serialize without errors', async () => {
const serialized = await fetchSerializedIntegrations();
expect(serialized.error).not.toBeDefined();
expect(serialized.ok).toBe(true);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ describe('Integration', () => {

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

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

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

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

expect(result.error?.message).toBe('Unable to parse file as JSON or NDJson');
expect(result.error?.message).toBe(
"Unable to parse file 'sample-1.0.1.ndjson' as JSON or NDJson"
);
});
});

Expand Down Expand Up @@ -262,7 +266,7 @@ describe('Integration', () => {

const result = await integration.getSampleData();

expect(result.error?.message).toBe('Unable to parse file as JSON or NDJson');
expect(result.error?.message).toBe("Unable to parse file 'sample.json' as JSON or NDJson");
});
});
});
2 changes: 1 addition & 1 deletion server/adaptors/integrations/repository/fs_data_adaptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export class FileSystemDataAdaptor implements CatalogDataAdaptor {
}
return {
ok: false,
error: new Error('Unable to parse file as JSON or NDJson', { cause: err }),
error: new Error(`Unable to parse file '${filename}' as JSON or NDJson`, { cause: err }),
};
}
}
Expand Down

0 comments on commit dda72c0

Please sign in to comment.