Skip to content

Commit 507477a

Browse files
authored
Merge branch '3.0' into backport/backport-2412-to-3.0
2 parents f1fdf49 + 14877ae commit 507477a

File tree

7 files changed

+54
-10
lines changed

7 files changed

+54
-10
lines changed

opensearch_dashboards.json

+9-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"id": "observabilityDashboards",
3-
"version": "3.0.0.0-beta1",
3+
"version": "3.0.0.0",
44
"opensearchDashboardsVersion": "3.0.0",
55
"server": true,
66
"ui": true,
@@ -26,7 +26,12 @@
2626
"dataSource",
2727
"dataSourceManagement"
2828
],
29-
"configPath": ["observability"],
29+
"configPath": [
30+
"observability"
31+
],
3032
"supportedOSDataSourceVersions": ">=2.9.0",
31-
"requiredOSDataSourcePlugins": ["opensearch-sql", "opensearch-observability"]
32-
}
33+
"requiredOSDataSourcePlugins": [
34+
"opensearch-sql",
35+
"opensearch-observability"
36+
]
37+
}

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "observability-dashboards",
3-
"version": "3.0.0.0-beta1",
3+
"version": "3.0.0.0",
44
"main": "index.ts",
55
"license": "Apache-2.0",
66
"scripts": {
@@ -84,4 +84,4 @@
8484
"node_modules/*",
8585
"target/*"
8686
]
87-
}
87+
}

public/components/trace_analytics/components/common/__tests__/helper_functions.test.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -171,13 +171,15 @@ describe('Trace analytics helper functions', () => {
171171
});
172172

173173
describe('getAttributeFieldNames', () => {
174-
it("should return only field names starting with 'resource.attributes' or 'span.attributes'", () => {
174+
it("should return only field names starting with 'resource.attributes' or 'span.attributes' or 'attributes'", () => {
175175
const expectedFields = [
176176
'span.attributes.http@url',
177177
'span.attributes.net@peer@ip',
178178
'span.attributes.http@user_agent.keyword',
179179
'resource.attributes.telemetry@[email protected]',
180180
181+
'attributes.url',
182+
'attributes.custom_field.keyword',
181183
];
182184
const result = getAttributeFieldNames(fieldCapQueryResponse1);
183185
expect(result).toEqual(expectedFields);

public/components/trace_analytics/components/common/helper_functions.tsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,10 @@ export const filtersToDsl = (
581581

582582
export const getAttributeFieldNames = (response: FieldCapResponse): string[] => {
583583
return Object.keys(response.fields).filter(
584-
(field) => field.startsWith('resource.attributes') || field.startsWith('span.attributes')
584+
(field) =>
585+
field.startsWith('resource.attributes') ||
586+
field.startsWith('span.attributes') ||
587+
field.startsWith('attributes')
585588
);
586589
};
587590

public/components/trace_analytics/components/traces/trace_table_helpers.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export const fetchDynamicColumns = (columnItems: string[]) => {
3434
</EuiText>
3535
),
3636
align: 'right',
37-
sortable: true,
37+
sortable: false,
3838
truncateText: true,
3939
render: (item) =>
4040
item ? (

public/components/trace_analytics/components/traces/traces_custom_indices_table.tsx

+21-1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,26 @@ export function TracesCustomIndicesTable(props: TracesLandingTableProps) {
5050
onSort,
5151
} = props;
5252

53+
const resolveFieldValue = (item: any, field: string) => {
54+
if (!item) return '-';
55+
56+
const matchPrefix = (prefix: string, container?: any) => {
57+
if (field.startsWith(prefix) && container) {
58+
const attr = field.slice(prefix.length);
59+
return container[attr] ?? '-';
60+
}
61+
return null;
62+
};
63+
64+
return (
65+
matchPrefix('resource.attributes.', item.resource?.attributes) ??
66+
matchPrefix('span.attributes.', item.attributes) ??
67+
matchPrefix('attributes.', item.attributes) ??
68+
item[field] ??
69+
'-'
70+
);
71+
};
72+
5373
const renderCellValue = useMemo(() => {
5474
return ({ rowIndex, columnId }: { rowIndex: number; columnId: string }) => {
5575
const isTracesMode = props.tracesTableMode === 'traces';
@@ -58,7 +78,7 @@ export function TracesCustomIndicesTable(props: TracesLandingTableProps) {
5878
: rowIndex - pagination.pageIndex * pagination.pageSize;
5979

6080
if (!items.hasOwnProperty(adjustedRowIndex)) return '-';
61-
const value = items[adjustedRowIndex]?.[columnId];
81+
const value = resolveFieldValue(items[adjustedRowIndex], columnId);
6282

6383
if (!value && columnId !== 'status.code' && columnId !== 'error_count') return '-';
6484

test/constants.ts

+14
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,20 @@ export const fieldCapQueryResponse1 = {
763763
aggregatable: false,
764764
},
765765
},
766+
'attributes.url': {
767+
text: {
768+
type: 'text',
769+
searchable: true,
770+
aggregatable: false,
771+
},
772+
},
773+
'attributes.custom_field.keyword': {
774+
keyword: {
775+
type: 'keyword',
776+
searchable: true,
777+
aggregatable: true,
778+
},
779+
},
766780
},
767781
};
768782

0 commit comments

Comments
 (0)