Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

fix: use derived values for url and host attributes (#10218)

Yunus M07afef5c5ec3
diff --git a/frontend/src/container/ApiMonitoring/Explorer/Domains/DomainDetails/AllEndPoints.tsx b/frontend/src/container/ApiMonitoring/Explorer/Domains/DomainDetails/AllEndPoints.tsx
index 0b8e099222..2f7d80644d 100644
--- a/frontend/src/container/ApiMonitoring/Explorer/Domains/DomainDetails/AllEndPoints.tsx
+++ b/frontend/src/container/ApiMonitoring/Explorer/Domains/DomainDetails/AllEndPoints.tsx
@@ -202,7 +202,7 @@ function AllEndPoints({
const onRowClick = useCallback(
(props: any): void => {
- setSelectedEndPointName(props[SPAN_ATTRIBUTES.URL_PATH] as string);
+ setSelectedEndPointName(props[SPAN_ATTRIBUTES.HTTP_URL] as string);
setSelectedView(VIEWS.ENDPOINT_STATS);
const initialItems = [
...(filters?.items || []),
@@ -213,7 +213,7 @@ function AllEndPoints({
op: 'AND',
});
setParams({
- selectedEndPointName: props[SPAN_ATTRIBUTES.URL_PATH] as string,
+ selectedEndPointName: props[SPAN_ATTRIBUTES.HTTP_URL] as string,
selectedView: VIEWS.ENDPOINT_STATS,
endPointDetailsLocalFilters: {
items: initialItems,
diff --git a/frontend/src/container/ApiMonitoring/Explorer/Domains/DomainDetails/EndPointDetails.tsx b/frontend/src/container/ApiMonitoring/Explorer/Domains/DomainDetails/EndPointDetails.tsx
index 286f9fcae7..c5410ab38b 100644
--- a/frontend/src/container/ApiMonitoring/Explorer/Domains/DomainDetails/EndPointDetails.tsx
+++ b/frontend/src/container/ApiMonitoring/Explorer/Domains/DomainDetails/EndPointDetails.tsx
@@ -33,7 +33,7 @@ import { SPAN_ATTRIBUTES } from './constants';
const httpUrlKey = {
dataType: DataTypes.String,
- key: SPAN_ATTRIBUTES.URL_PATH,
+ key: SPAN_ATTRIBUTES.HTTP_URL,
type: 'tag',
};
@@ -93,7 +93,7 @@ function EndPointDetails({
return currentFilters; // No change needed, prevents loop
}
- // Rebuild filters: Keep non-http.url filters and add/update http.url filter based on prop
+ // Rebuild filters: Keep non-http_url filters and add/update http_url filter based on prop
const otherFilters = currentFilters?.items?.filter(
(item) => item.key?.key !== httpUrlKey.key,
);
@@ -125,7 +125,7 @@ function EndPointDetails({
(newFilters: IBuilderQuery['filters']): void => {
// 1. Update local filters state immediately
setFilters(newFilters);
- // Filter out http.url filter before saving to params
+ // Filter out http_url filter before saving to params
const filteredNewFilters = {
op: 'AND',
items:
@@ -299,7 +299,6 @@ function EndPointDetails({
endPointStatusCodeLatencyBarChartsDataQuery
}
domainName={domainName}
- endPointName={endPointName}
filters={filters}
timeRange={timeRange}
onDragSelect={onDragSelect}
diff --git a/frontend/src/container/ApiMonitoring/Explorer/Domains/DomainDetails/TopErrors.tsx b/frontend/src/container/ApiMonitoring/Explorer/Domains/DomainDetails/TopErrors.tsx
index 88cbe2a5f3..d33da3c368 100644
--- a/frontend/src/container/ApiMonitoring/Explorer/Domains/DomainDetails/TopErrors.tsx
+++ b/frontend/src/container/ApiMonitoring/Explorer/Domains/DomainDetails/TopErrors.tsx
@@ -56,15 +56,15 @@ function TopErrors({
{
items: endPointName
? [
- // Remove any existing http.url filters from initialFilters to avoid duplicates
+ // Remove any existing http_url filters from initialFilters to avoid duplicates
...(initialFilters?.items?.filter(
- (item) => item.key?.key !== SPAN_ATTRIBUTES.URL_PATH,
+ (item) => item.key?.key !== SPAN_ATTRIBUTES.HTTP_URL,
) || []),
{
id: '92b8a1c1',
key: {
dataType: DataTypes.String,
- key: SPAN_ATTRIBUTES.URL_PATH,
+ key: SPAN_ATTRIBUTES.HTTP_URL,
type: 'tag',
},
op: '=',
diff --git a/frontend/src/container/ApiMonitoring/Explorer/Domains/DomainDetails/components/DomainMetrics.test.tsx b/frontend/src/container/ApiMonitoring/Explorer/Domains/DomainDetails/components/DomainMetrics.test.tsx
index 2b355a46f7..8cc70a29d0 100644
--- a/frontend/src/container/ApiMonitoring/Explorer/Domains/DomainDetails/components/DomainMetrics.test.tsx
+++ b/frontend/src/container/ApiMonitoring/Explorer/Domains/DomainDetails/components/DomainMetrics.test.tsx
@@ -9,6 +9,7 @@ import { ENTITY_VERSION_V5 } from 'constants/app';
import { GetMetricQueryRange } from 'lib/dashboard/getQueryResults';
import { IBuilderQuery } from 'types/api/queryBuilder/queryBuilderData';
+import { SPAN_ATTRIBUTES } from '../constants';
import DomainMetrics from './DomainMetrics';
// Mock the API call
@@ -126,11 +127,9 @@ describe('DomainMetrics - V5 Query Payload Tests', () => {
'count()',
);
// Verify exact domain filter expression structure
+ expect(queryA.filter.expression).toContain("http_host = '0.0.0.0'");
expect(queryA.filter.expression).toContain(
- "(net.peer.name = '0.0.0.0' OR server.address = '0.0.0.0')",
- );
- expect(queryA.filter.expression).toContain(
- 'url.full EXISTS OR http.url EXISTS',
+ `${SPAN_ATTRIBUTES.HTTP_URL} EXISTS`,
);
// Verify Query B - p99 latency
@@ -142,17 +141,13 @@ describe('DomainMetrics - V5 Query Payload Tests', () => {
'p99(duration_nano)',
);
// Verify exact domain filter expression structure
- expect(queryB.filter.expression).toContain(
- "(net.peer.name = '0.0.0.0' OR server.address = '0.0.0.0')",
- );
+ expect(queryB.filter.expression).toContain("http_host = '0.0.0.0'");
// Verify Query C - error count (disabled)
const queryC = queryData.find((q: any) => q.queryName === 'C');
expect(queryC).toBeDefined();
expect(queryC.disabled).toBe(true);
- expect(queryC.filter.expression).toContain(
- "(net.peer.name = '0.0.0.0' OR server.address = '0.0.0.0')",
- );
+ expect(queryC.filter.expression).toContain("http_host = '0.0.0.0'");
expect(queryC.aggregations?.[0]).toBeDefined();
expect((queryC.aggregations?.[0] as TraceAggregation)?.expression).toBe(
'count()',
@@ -169,9 +164,7 @@ describe('DomainMetrics - V5 Query Payload Tests', () => {
'max(timestamp)',
);
// Verify exact domain filter expression structure
- expect(queryD.filter.expression).toContain(
- "(net.peer.name = '0.0.0.0' OR server.address = '0.0.0.0')",
- );
+ expect(queryD.filter.expression).toContain("http_host = '0.0.0.0'");
// Verify Formula F1 - error rate calculation
const formulas = payload.query.builder.queryFormulas;
diff --git a/frontend/src/container/ApiMonitoring/Explorer/Domains/DomainDetails/components/EndPointMetrics.test.tsx b/frontend/src/container/ApiMonitoring/Explorer/Domains/DomainDetails/components/EndPointMetrics.test.tsx
index 99de00228b..17b73d4d77 100644
--- a/frontend/src/container/ApiMonitoring/Explorer/Domains/DomainDetails/components/EndPointMetrics.test.tsx
+++ b/frontend/src/container/ApiMonitoring/Explorer/Domains/DomainDetails/components/EndPointMetrics.test.tsx
@@ -153,7 +153,7 @@ describe('EndPointMetrics - V5 Query Payload Tests', () => {
// Verify exact domain filter expression structure
if (queryA.filter) {
expect(queryA.filter.expression).toContain(
- "(net.peer.name = 'api.example.com' OR server.address = 'api.example.com')",
+ `http_host = 'api.example.com'`,
);
expect(queryA.filter.expression).toContain("kind_string = 'Client'");
}
@@ -171,7 +171,7 @@ describe('EndPointMetrics - V5 Query Payload Tests', () => {
// Verify exact domain filter expression structure
if (queryB.filter) {
expect(queryB.filter.expression).toContain(
- "(net.peer.name = 'api.example.com' OR server.address = 'api.example.com')",
+ `http_host = 'api.example.com'`,
);
expect(queryB.filter.expression).toContain("kind_string = 'Client'");
}
@@ -185,7 +185,7 @@ describe('EndPointMetrics - V5 Query Payload Tests', () => {
expect(queryC.aggregateOperator).toBe('count');
if (queryC.filter) {
expect(queryC.filter.expression).toContain(
- "(net.peer.name = 'api.example.com' OR server.address = 'api.example.com')",
+ `http_host = 'api.example.com'`,
);
expect(queryC.filter.expression).toContain("kind_string = 'Client'");
expect(queryC.filter.expression).toContain('has_error = true');
@@ -204,7 +204,7 @@ describe('EndPointMetrics - V5 Query Payload Tests', () => {
// Verify exact domain filter expression structure
if (queryD.filter) {
expect(queryD.filter.expression).toContain(
- "(net.peer.name = 'api.example.com' OR server.address = 'api.example.com')",
+ `http_host = 'api.example.com'`,
);
expect(queryD.filter.expression).toContain("kind_string = 'Client'");
}
@@ -221,7 +221,7 @@ describe('EndPointMetrics - V5 Query Payload Tests', () => {
}
if (queryE.filter) {
expect(queryE.filter.expression).toContain(
- "(net.peer.name = 'api.example.com' OR server.address = 'api.example.com')",
+ `http_host = 'api.example.com'`,
);
expect(queryE.filter.expression).toContain("kind_string = 'Client'");
}
@@ -291,7 +291,7 @@ describe('EndPointMetrics - V5 Query Payload Tests', () => {
expect(query.filter.expression).toContain('staging');
// Also verify domain filter is still present
expect(query.filter.expression).toContain(
- "(net.peer.name = 'api.internal.com' OR server.address = 'api.internal.com')",
+ "http_host = 'api.internal.com'",
);
// Verify client kind filter is present
expect(query.filter.expression).toContain("kind_string = 'Client'");
diff --git a/frontend/src/container/ApiMonitoring/Explorer/Domains/DomainDetails/components/StatusCodeBarCharts.tsx b/frontend/src/container/ApiMonitoring/Explorer/Domains/DomainDetails/components/StatusCodeBarCharts.tsx
index 3d8c06e9fa..2fbb62cdac 100644
--- a/frontend/src/container/ApiMonitoring/Explorer/Domains/DomainDetails/components/StatusCodeBarCharts.tsx
+++ b/frontend/src/container/ApiMonitoring/Explorer/Domains/DomainDetails/components/StatusCodeBarCharts.tsx
@@ -34,7 +34,6 @@ function StatusCodeBarCharts({
endPointStatusCodeBarChartsDataQuery,
endPointStatusCodeLatencyBarChartsDataQuery,
domainName,
- endPointName,
filters,
timeRange,
onDragSelect,
@@ -48,7 +47,6 @@ function StatusCodeBarCharts({
unknown
>;
domainName: string;
- endPointName: string;
filters: IBuilderQuery['filters'];
timeRange: {
startTime: number;
@@ -144,11 +142,11 @@ function StatusCodeBarCharts({
const widget = useMemo<Widgets>(
() =>
- getStatusCodeBarChartWidgetData(domainName, endPointName, {
+ getStatusCodeBarChartWidgetData(domainName, {
items: [...(filters?.items || [])],
op: filters?.op || 'AND',
}),
- [domainName, endPointName, filters],
+ [domainName, filters],
);
const graphClickHandler = useCallback(
@@ -166,6 +164,7 @@ function StatusCodeBarCharts({
xValue,
TWO_AND_HALF_MINUTES_IN_MILLISECONDS,
);
+
handleGraphClick({
xValue,
yValue,
diff --git a/frontend/src/container/ApiMonitoring/Explorer/Domains/DomainDetails/constants.ts b/frontend/src/container/ApiMonitoring/Explorer/Domains/DomainDetails/constants.ts
index 70d6f41483..32b6c10cbf 100644
--- a/frontend/src/container/ApiMonitoring/Explorer/Domains/DomainDetails/constants.ts
+++ b/frontend/src/container/ApiMonitoring/Explorer/Domains/DomainDetails/constants.ts
@@ -12,7 +12,7 @@ export const VIEW_TYPES = {
// Span attribute keys - these are the source of truth for all attribute keys
export const SPAN_ATTRIBUTES = {
- URL_PATH: 'http.url',
+ HTTP_URL: 'http_url',
RESPONSE_STATUS_CODE: 'response_status_code',
SERVER_NAME: 'http_host',
SERVER_PORT: 'net.peer.port',
diff --git a/frontend/src/container/ApiMonitoring/__tests__/APIMonitoringUtils.test.tsx b/frontend/src/container/ApiMonitoring/__tests__/APIMonitoringUtils.test.tsx
index 5c5f11b6ea..6049f9732c 100644
--- a/frontend/src/container/ApiMonitoring/__tests__/APIMonitoringUtils.test.tsx
+++ b/frontend/src/container/ApiMonitoring/__tests__/APIMonitoringUtils.test.tsx
@@ -280,7 +280,7 @@ describe('API Monitoring Utils', () => {
const endpointFilter = result?.items?.find(
(item) =>
item.key &&
- item.key.key === SPAN_ATTRIBUTES.URL_PATH &&
+ item.key.key === SPAN_ATTRIBUTES.HTTP_URL &&
item.value === endPointName,
);
expect(endpointFilter).toBeDefined();
@@ -344,13 +344,12 @@ describe('API Monitoring Utils', () => {
describe('getFormattedEndPointDropDownData', () => {
it('should format endpoint dropdown data correctly', () => {
// Arrange
- const URL_PATH_KEY = SPAN_ATTRIBUTES.URL_PATH;
+ const URL_PATH_KEY = SPAN_ATTRIBUTES.HTTP_URL;
const mockData = [
{
data: {
// eslint-disable-next-line sonarjs/no-duplicate-string
[URL_PATH_KEY]: '/api/users',
- 'url.full': 'http://example.com/api/users',
A: 150, // count or other metric
},
},
@@ -358,7 +357,6 @@ describe('API Monitoring Utils', () => {
data: {
// eslint-disable-next-line sonarjs/no-duplicate-string
[URL_PATH_KEY]: '/api/orders',
- 'url.full': 'http://example.com/api/orders',
A: 75,
},
},
@@ -406,7 +404,7 @@ describe('API Monitoring Utils', () => {
it('should handle items without URL path', () => {
// Arrange
- const URL_PATH_KEY = SPAN_ATTRIBUTES.URL_PATH;
+ const URL_PATH_KEY = SPAN_ATTRIBUTES.HTTP_URL;
type MockDataType = {
data: {
[key: string]: string | number;
@@ -712,13 +710,11 @@ describe('API Monitoring Utils', () => {
it('should generate widget configuration for status code bar chart', () => {
// Arrange
const domainName = 'test-domain';
- const endPointName = '/api/test';
const filters = { items: [], op: 'AND' };
// Act
const result = getStatusCodeBarChartWidgetData(
domainName,
- endPointName,
filters as IBuilderQuery['filters'],
);
@@ -741,21 +737,11 @@ describe('API Monitoring Utils', () => {
if (domainFilter) {
expect(domainFilter.value).toBe(domainName);
}
-
- // Should have endpoint filter if provided
- const endpointFilter = queryData.filters?.items?.find(
- (item) => item.key && item.key.key === SPAN_ATTRIBUTES.URL_PATH,
- );
- expect(endpointFilter).toBeDefined();
- if (endpointFilter) {
- expect(endpointFilter.value).toBe(endPointName);
- }
});
it('should include custom filters in the widget configuration', () => {
// Arrange
const domainName = 'test-domain';
- const endPointName = '/api/test';
const customFilter = {
id: 'custom-filter',
key: {
@@ -771,7 +757,6 @@ describe('API Monitoring Utils', () => {
// Act
const result = getStatusCodeBarChartWidgetData(
domainName,
- endPointName,
filters as IBuilderQuery['filters'],
);
diff --git a/frontend/src/container/ApiMonitoring/__tests__/AllEndPoints.test.tsx b/frontend/src/container/ApiMonitoring/__tests__/AllEndPoints.test.tsx
index 69860ba4e9..36f6a0698e 100644
--- a/frontend/src/container/ApiMonitoring/__tests__/AllEndPoints.test.tsx
+++ b/frontend/src/container/ApiMonitoring/__tests__/AllEndPoints.test.tsx
@@ -25,7 +25,7 @@ jest.mock('container/GridCardLayout/GridCard', () => ({
type="button"
data-testid="row-click-button"
onClick={(): void =>
- customOnRowClick({ [SPAN_ATTRIBUTES.URL_PATH]: '/api/test' })
+ customOnRowClick({ [SPAN_ATTRIBUTES.HTTP_URL]: '/api/test' })
}
>
Click Row
diff --git a/frontend/src/container/ApiMonitoring/__tests__/AllEndpointsWidgetV5Migration.test.tsx b/frontend/src/container/ApiMonitoring/__tests__/AllEndpointsWidgetV5Migration.test.tsx
index 0e2d37ad29..92a190f352 100644
--- a/frontend/src/container/ApiMonitoring/__tests__/AllEndpointsWidgetV5Migration.test.tsx
+++ b/frontend/src/container/ApiMonitoring/__tests__/AllEndpointsWidgetV5Migration.test.tsx
@@ -6,10 +6,10 @@
* These tests validate the migration from V4 to V5 format for getAllEndpointsWidgetData:
* - Filter format change: filters.items[] → filter.expression
* - Aggregation format: aggregateAttribute → aggregations[] array
- * - Domain filter: (net.peer.name OR server.address)
+ * - Domain filter: http_host = '${domainName}'
* - Kind filter: kind_string = 'Client'
* - Four queries: A (count), B (p99 latency), C (max timestamp), D (error count - disabled)
- * - GroupBy: Both http.url AND url.full with type 'attribute'
+ * - GroupBy: http_url with type 'attribute'
*/
import { getAllEndpointsWidgetData } from 'container/ApiMonitoring/utils';
import {
@@ -18,6 +18,8 @@ import {
} from 'types/api/queryBuilder/queryAutocompleteResponse';
import { IBuilderQuery } from 'types/api/queryBuilder/queryBuilderData';
+import { SPAN_ATTRIBUTES } from '../Explorer/Domains/DomainDetails/constants';
+
describe('AllEndpointsWidget - V5 Migration Validation', () => {
const mockDomainName = 'api.example.com';
const emptyFilters: IBuilderQuery['filters'] = {
@@ -92,28 +94,28 @@ describe('AllEndpointsWidget - V5 Migration Validation', () => {
const [queryA, queryB, queryC, queryD] = widget.query.builder.queryData;
- const baseExpression = `(net.peer.name = '${mockDomainName}' OR server.address = '${mockDomainName}') AND kind_string = 'Client'`;
+ const baseExpression = `http_host = '${mockDomainName}' AND kind_string = 'Client'`;
// Queries A, B, C have identical base filter
expect(queryA.filter?.expression).toBe(
- `${baseExpression} AND (http.url EXISTS OR url.full EXISTS)`,
+ `${baseExpression} AND ${SPAN_ATTRIBUTES.HTTP_URL} EXISTS`,
);
expect(queryB.filter?.expression).toBe(
- `${baseExpression} AND (http.url EXISTS OR url.full EXISTS)`,
+ `${baseExpression} AND ${SPAN_ATTRIBUTES.HTTP_URL} EXISTS`,
);
expect(queryC.filter?.expression).toBe(
- `${baseExpression} AND (http.url EXISTS OR url.full EXISTS)`,
+ `${baseExpression} AND ${SPAN_ATTRIBUTES.HTTP_URL} EXISTS`,
);
// Query D has additional has_error filter
expect(queryD.filter?.expression).toBe(
- `${baseExpression} AND has_error = true AND (http.url EXISTS OR url.full EXISTS)`,
+ `${baseExpression} AND has_error = true AND ${SPAN_ATTRIBUTES.HTTP_URL} EXISTS`,
);
});
});
describe('2. GroupBy Structure', () => {
- it('default groupBy includes both http.url and url.full with type attribute', () => {
+ it(`default groupBy includes ${SPAN_ATTRIBUTES.HTTP_URL} with type attribute`, () => {
const widget = getAllEndpointsWidgetData(
emptyGroupBy,
mockDomainName,
@@ -124,23 +126,13 @@ describe('AllEndpointsWidget - V5 Migration Validation', () => {
// All queries should have the same default groupBy
queryData.forEach((query) => {
- expect(query.groupBy).toHaveLength(2);
-
- // http.url
- expect(query.groupBy).toContainEqual({
- dataType: DataTypes.String,
- isColumn: false,
- isJSON: false,
- key: 'http.url',
- type: 'attribute',
- });
+ expect(query.groupBy).toHaveLength(1);
- // url.full
expect(query.groupBy).toContainEqual({
dataType: DataTypes.String,
isColumn: false,
isJSON: false,
- key: 'url.full',
+ key: SPAN_ATTRIBUTES.HTTP_URL,
type: 'attribute',
});
});
@@ -170,19 +162,18 @@ describe('AllEndpointsWidget - V5 Migration Validation', () => {
// All queries should have defaults + custom groupBy
queryData.forEach((query) => {
- expect(query.groupBy).toHaveLength(4); // 2 defaults + 2 custom
+ expect(query.groupBy).toHaveLength(3); // 1 default + 2 custom
- // First two should be defaults (http.url, url.full)
- expect(query.groupBy[0].key).toBe('http.url');
- expect(query.groupBy[1].key).toBe('url.full');
+ // First two should be defaults (http_url)
+ expect(query.groupBy[0].key).toBe(SPAN_ATTRIBUTES.HTTP_URL);
// Last two should be custom (matching subset of properties)
- expect(query.groupBy[2]).toMatchObject({
+ expect(query.groupBy[1]).toMatchObject({
dataType: DataTypes.String,
key: 'service.name',
type: 'resource',
});
- expect(query.groupBy[3]).toMatchObject({
+ expect(query.groupBy[2]).toMatchObject({
dataType: DataTypes.String,
key: 'deployment.environment',
type: 'resource',
diff --git a/frontend/src/container/ApiMonitoring/__tests__/EndPointDetails.test.tsx b/frontend/src/container/ApiMonitoring/__tests__/EndPointDetails.test.tsx
index c862344f9c..9ceb050690 100644
--- a/frontend/src/container/ApiMonitoring/__tests__/EndPointDetails.test.tsx
+++ b/frontend/src/container/ApiMonitoring/__tests__/EndPointDetails.test.tsx
@@ -258,7 +258,7 @@ describe('EndPointDetails Component', () => {
expect.objectContaining({
items: expect.arrayContaining([
expect.objectContaining({
- key: expect.objectContaining({ key: SPAN_ATTRIBUTES.URL_PATH }),
+ key: expect.objectContaining({ key: SPAN_ATTRIBUTES.HTTP_URL }),
value: '/api/test',
}),
]),
@@ -278,7 +278,7 @@ describe('EndPointDetails Component', () => {
expect.objectContaining({
items: expect.arrayContaining([
expect.objectContaining({
- key: expect.objectContaining({ key: SPAN_ATTRIBUTES.URL_PATH }),
+ key: expect.objectContaining({ key: SPAN_ATTRIBUTES.HTTP_URL }),
value: '/api/test',
}),
]),
@@ -360,7 +360,7 @@ describe('EndPointDetails Component', () => {
expect.objectContaining({
items: expect.arrayContaining([
expect.objectContaining({
- key: expect.objectContaining({ key: SPAN_ATTRIBUTES.URL_PATH }),
+ key: expect.objectContaining({ key: SPAN_ATTRIBUTES.HTTP_URL }),
value: '/api/test',
}),
]),
@@ -373,7 +373,7 @@ describe('EndPointDetails Component', () => {
expect.objectContaining({
items: expect.arrayContaining([
expect.objectContaining({
- key: expect.objectContaining({ key: SPAN_ATTRIBUTES.URL_PATH }),
+ key: expect.objectContaining({ key: SPAN_ATTRIBUTES.HTTP_URL }),
value: '/api/test',
}),
]),
diff --git a/frontend/src/container/ApiMonitoring/__tests__/EndPointsDropDown.test.tsx b/frontend/src/container/ApiMonitoring/__tests__/EndPointsDropDown.test.tsx
index 2ebe24057c..261b4198a2 100644
--- a/frontend/src/container/ApiMonitoring/__tests__/EndPointsDropDown.test.tsx
+++ b/frontend/src/container/ApiMonitoring/__tests__/EndPointsDropDown.test.tsx
@@ -191,7 +191,7 @@ describe('EndPointsDropDown Component', () => {
it('formats data using the utility function', () => {
const mockRows = [
- { data: { [SPAN_ATTRIBUTES.URL_PATH]: '/api/test', A: 10 } },
+ { data: { [SPAN_ATTRIBUTES.HTTP_URL]: '/api/test', A: 10 } },
];
const dataProps = {
diff --git a/frontend/src/container/ApiMonitoring/__tests__/EndpointDropdownV5Migration.test.tsx b/frontend/src/container/ApiMonitoring/__tests__/EndpointDropdownV5Migration.test.tsx
index 94df26a466..fcc6825263 100644
--- a/frontend/src/container/ApiMonitoring/__tests__/EndpointDropdownV5Migration.test.tsx
+++ b/frontend/src/container/ApiMonitoring/__tests__/EndpointDropdownV5Migration.test.tsx
@@ -6,15 +6,18 @@
* These tests validate the migration from V4 to V5 format for the third payload
* in getEndPointDetailsQueryPayload (endpoint dropdown data):
* - Filter format change: filters.items[] → filter.expression
- * - Domain handling: (net.peer.name OR server.address)
+ * - Domain handling: http_host = '${domainName}'
* - Kind filter: kind_string = 'Client'
- * - Existence check: (http.url EXISTS OR url.full EXISTS)
+ * - Existence check: http_url EXISTS
* - Aggregation: count() expression
- * - GroupBy: Both http.url AND url.full with type 'attribute'
+ * - GroupBy: http_url with type 'attribute'
*/
import { getEndPointDetailsQueryPayload } from 'container/ApiMonitoring/utils';
+import { DataTypes } from 'types/api/queryBuilder/queryAutocompleteResponse';
import { IBuilderQuery } from 'types/api/queryBuilder/queryBuilderData';
+import { SPAN_ATTRIBUTES } from '../Explorer/Domains/DomainDetails/constants';
+
describe('EndpointDropdown - V5 Migration Validation', () => {
const mockDomainName = 'api.example.com';
const mockStartTime = 1000;
@@ -43,9 +46,9 @@ describe('EndpointDropdown - V5 Migration Validation', () => {
expect(typeof queryA.filter?.expression).toBe('string');
expect(queryA).not.toHaveProperty('filters');
- // Base filter 1: Domain (net.peer.name OR server.address)
+ // Base filter 1: Domain http_host = '${domainName}'
expect(queryA.filter?.expression).toContain(
- `(net.peer.name = '${mockDomainName}' OR server.address = '${mockDomainName}')`,
+ `http_host = '${mockDomainName}'`,
);
// Base filter 2: Kind
@@ -53,7 +56,7 @@ describe('EndpointDropdown - V5 Migration Validation', () => {
// Base filter 3: Existence check
expect(queryA.filter?.expression).toContain(
- '(http.url EXISTS OR url.full EXISTS)',
+ `${SPAN_ATTRIBUTES.HTTP_URL} EXISTS`,
);
// V5 Aggregation format: aggregations array (not aggregateAttribute)
@@ -64,16 +67,11 @@ describe('EndpointDropdown - V5 Migration Validation', () => {
});
expect(queryA).not.toHaveProperty('aggregateAttribute');
- // GroupBy: Both http.url and url.full
- expect(queryA.groupBy).toHaveLength(2);
+ // GroupBy: http_url
+ expect(queryA.groupBy).toHaveLength(1);
expect(queryA.groupBy).toContainEqual({
- key: 'http.url',
- dataType: 'string',
- type: 'attribute',
- });
- expect(queryA.groupBy).toContainEqual({
- key: 'url.full',
- dataType: 'string',
+ key: SPAN_ATTRIBUTES.HTTP_URL,
+ dataType: DataTypes.String,
type: 'attribute',
});
});
@@ -120,53 +118,7 @@ describe('EndpointDropdown - V5 Migration Validation', () => {
// Exact filter expression with custom filters merged
expect(expression).toBe(
- "(net.peer.name = 'api.example.com' OR server.address = 'api.example.com') AND kind_string = 'Client' AND (http.url EXISTS OR url.full EXISTS) service.name = 'user-service' AND deployment.environment = 'production'",
- );
- });
- });
-
- describe('3. HTTP URL Filter Special Handling', () => {
- it('converts http.url filter to (http.url OR url.full) expression', () => {
- const filtersWithHttpUrl: IBuilderQuery['filters'] = {
- items: [
- {
- id: 'http-url-filter',
- key: {
- key: 'http.url',
- dataType: 'string' as any,
- type: 'tag',
- },
- op: '=',
- value: '/api/users',
- },
- {
- id: 'service-filter',
- key: {
- key: 'service.name',
- dataType: 'string' as any,
- type: 'resource',
- },
- op: '=',
- value: 'user-service',
- },
- ],
- op: 'AND',
- };
-
- const payload = getEndPointDetailsQueryPayload(
- mockDomainName,
- mockStartTime,
- mockEndTime,
- filtersWithHttpUrl,
- );
-
- const dropdownQuery = payload[2];
- const expression =
- dropdownQuery.query.builder.queryData[0].filter?.expression;
-
- // CRITICAL: Exact filter expression with http.url converted to OR logic
- expect(expression).toBe(
- "(net.peer.name = 'api.example.com' OR server.address = 'api.example.com') AND kind_string = 'Client' AND (http.url EXISTS OR url.full EXISTS) service.name = 'user-service' AND (http.url = '/api/users' OR url.full = '/api/users')",
+ `${SPAN_ATTRIBUTES.SERVER_NAME} = 'api.example.com' AND kind_string = 'Client' AND ${SPAN_ATTRIBUTES.HTTP_URL} EXISTS service.name = 'user-service' AND deployment.environment = 'production'`,
);
});
});
diff --git a/frontend/src/container/ApiMonitoring/__tests__/MetricOverTimeV5Migration.test.tsx b/frontend/src/container/ApiMonitoring/__tests__/MetricOverTimeV5Migration.test.tsx
index 9802382537..c305e48764 100644
--- a/frontend/src/container/ApiMonitoring/__tests__/MetricOverTimeV5Migration.test.tsx
+++ b/frontend/src/container/ApiMonitoring/__tests__/MetricOverTimeV5Migration.test.tsx
@@ -33,7 +33,7 @@ describe('MetricOverTime - V5 Migration Validation', () => {
expect(queryData).not.toHaveProperty('filters.items');
});
- it('uses new domain filter format: (net.peer.name OR server.address)', () => {
+ it('uses new domain filter format: (http_host)', () => {
const widget = getRateOverTimeWidgetData(
mockDomainName,
mockEndpointName,
@@ -44,7 +44,7 @@ describe('MetricOverTime - V5 Migration Validation', () => {
// Verify EXACT new filter format with OR operator
expect(queryData?.filter?.expression).toContain(
- `(net.peer.name = '${mockDomainName}' OR server.address = '${mockDomainName}')`,
+ `http_host = '${mockDomainName}'`,
);
// Endpoint name is used in legend, not filter
@@ -90,7 +90,7 @@ describe('MetricOverTime - V5 Migration Validation', () => {
// Verify domain filter is present
expect(queryData?.filter?.expression).toContain(
- `(net.peer.name = '${mockDomainName}' OR server.address = '${mockDomainName}')`,
+ `http_host = '${mockDomainName}'`,
);
// Verify custom filters are merged into the expression
@@ -120,7 +120,7 @@ describe('MetricOverTime - V5 Migration Validation', () => {
expect(queryData).not.toHaveProperty('filters.items');
});
- it('uses new domain filter format: (net.peer.name OR server.address)', () => {
+ it('uses new domain filter format: (http_host)', () => {
const widget = getLatencyOverTimeWidgetData(
mockDomainName,
mockEndpointName,
@@ -132,7 +132,7 @@ describe('MetricOverTime - V5 Migration Validation', () => {
// Verify EXACT new filter format with OR operator
expect(queryData.filter).toBeDefined();
expect(queryData?.filter?.expression).toContain(
- `(net.peer.name = '${mockDomainName}' OR server.address = '${mockDomainName}')`,
+ `http_host = '${mockDomainName}'`,
);
// Endpoint name is used in legend, not filter
@@ -166,7 +166,7 @@ describe('MetricOverTime - V5 Migration Validation', () => {
// Verify domain filter is present
expect(queryData?.filter?.expression).toContain(
- `(net.peer.name = '${mockDomainName}' OR server.address = '${mockDomainName}') service.name = 'user-service'`,
+ `http_host = '${mockDomainName}' service.name = 'user-service'`,
);
});
});
diff --git a/frontend/src/container/ApiMonitoring/__tests__/StatusCodeBarCharts.test.tsx b/frontend/src/container/ApiMonitoring/__tests__/StatusCodeBarCharts.test.tsx
index 9affe5ae7e..4d563a2b57 100644
--- a/frontend/src/container/ApiMonitoring/__tests__/StatusCodeBarCharts.test.tsx
+++ b/frontend/src/container/ApiMonitoring/__tests__/StatusCodeBarCharts.test.tsx
@@ -142,7 +142,6 @@ describe('StatusCodeBarCharts', () => {
endTime: 1609545600000,
};
const mockDomainName = 'test-domain';
- const mockEndPointName = '/api/test';
const onDragSelectMock = jest.fn();
const refetchFn = jest.fn();
@@ -232,7 +231,6 @@ describe('StatusCodeBarCharts', () => {
endPointStatusCodeBarChartsDataQuery={mockStatusCodeQuery as any}
endPointStatusCodeLatencyBarChartsDataQuery={mockLatencyQuery as any}
domainName={mockDomainName}
- endPointName={mockEndPointName}
filters={mockFilters}
timeRange={mockTimeRange}
onDragSelect={onDragSelectMock}
@@ -268,7 +266,6 @@ describe('StatusCodeBarCharts', () => {
endPointStatusCodeBarChartsDataQuery={mockStatusCodeQuery as any}
endPointStatusCodeLatencyBarChartsDataQuery={mockLatencyQuery as any}
domainName={mockDomainName}
- endPointName={mockEndPointName}
filters={mockFilters}
timeRange={mockTimeRange}
onDragSelect={onDragSelectMock}
@@ -311,7 +308,6 @@ describe('StatusCodeBarCharts', () => {
endPointStatusCodeBarChartsDataQuery={mockStatusCodeQuery as any}
endPointStatusCodeLatencyBarChartsDataQuery={mockLatencyQuery as any}
domainName={mockDomainName}
- endPointName={mockEndPointName}
filters={mockFilters}
timeRange={mockTimeRange}
onDragSelect={onDragSelectMock}
@@ -356,7 +352,6 @@ describe('StatusCodeBarCharts', () => {
endPointStatusCodeBarChartsDataQuery={mockStatusCodeQuery as any}
endPointStatusCodeLatencyBarChartsDataQuery={mockLatencyQuery as any}
domainName={mockDomainName}
- endPointName={mockEndPointName}
filters={mockFilters}
timeRange={mockTimeRange}
onDragSelect={onDragSelectMock}
@@ -404,7 +399,6 @@ describe('StatusCodeBarCharts', () => {
endPointStatusCodeBarChartsDataQuery={mockStatusCodeQuery as any}
endPointStatusCodeLatencyBarChartsDataQuery={mockLatencyQuery as any}
domainName={mockDomainName}
- endPointName={mockEndPointName}
filters={mockFilters}
timeRange={mockTimeRange}
onDragSelect={onDragSelectMock}
@@ -419,7 +413,6 @@ describe('StatusCodeBarCharts', () => {
// but we've confirmed the function is mocked and ready to be tested
expect(getStatusCodeBarChartWidgetData).toHaveBeenCalledWith(
mockDomainName,
- mockEndPointName,
expect.objectContaining({
items: [],
op: 'AND',
@@ -467,7 +460,6 @@ describe('StatusCodeBarCharts', () => {
endPointStatusCodeBarChartsDataQuery={mockStatusCodeQuery as any}
endPointStatusCodeLatencyBarChartsDataQuery={mockLatencyQuery as any}
domainName={mockDomainName}
- endPointName={mockEndPointName}
filters={mockCustomFilters as IBuilderQuery['filters']}
timeRange={mockTimeRange}
onDragSelect={onDragSelectMock}
@@ -477,7 +469,6 @@ describe('StatusCodeBarCharts', () => {
// Assert widget creation was called with the correct parameters
expect(getStatusCodeBarChartWidgetData).toHaveBeenCalledWith(
mockDomainName,
- mockEndPointName,
expect.objectContaining({
items: expect.arrayContaining([
expect.objectContaining({ id: 'custom-filter' }),
diff --git a/frontend/src/container/ApiMonitoring/__tests__/StatusCodeBarChartsV5Migration.test.tsx b/frontend/src/container/ApiMonitoring/__tests__/StatusCodeBarChartsV5Migration.test.tsx
index b6528c1c6a..feeec52731 100644
--- a/frontend/src/container/ApiMonitoring/__tests__/StatusCodeBarChartsV5Migration.test.tsx
+++ b/frontend/src/container/ApiMonitoring/__tests__/StatusCodeBarChartsV5Migration.test.tsx
@@ -10,7 +10,7 @@
*
* V5 Changes:
* - Filter format change: filters.items[] → filter.expression
- * - Domain filter: (net.peer.name OR server.address)
+ * - Domain filter: (http_host)
* - Kind filter: kind_string = 'Client'
* - stepInterval: 60 → null
* - Grouped by response_status_code
@@ -47,9 +47,9 @@ describe('StatusCodeBarCharts - V5 Migration Validation', () => {
expect(typeof queryA.filter?.expression).toBe('string');
expect(queryA).not.toHaveProperty('filters.items');
- // Base filter 1: Domain (net.peer.name OR server.address)
+ // Base filter 1: Domain (http_host)
expect(queryA.filter?.expression).toContain(
- `(net.peer.name = '${mockDomainName}' OR server.address = '${mockDomainName}')`,
+ `http_host = '${mockDomainName}'`,
);
// Base filter 2: Kind
@@ -96,9 +96,9 @@ describe('StatusCodeBarCharts - V5 Migration Validation', () => {
expect(typeof queryA.filter?.expression).toBe('string');
expect(queryA).not.toHaveProperty('filters.items');
- // Base filter 1: Domain (net.peer.name OR server.address)
+ // Base filter 1: Domain (http_host)
expect(queryA.filter?.expression).toContain(
- `(net.peer.name = '${mockDomainName}' OR server.address = '${mockDomainName}')`,
+ `http_host = '${mockDomainName}'`,
);
// Base filter 2: Kind
@@ -177,7 +177,7 @@ describe('StatusCodeBarCharts - V5 Migration Validation', () => {
expect(callsExpression).toBe(latencyExpression);
// Verify base filters
- expect(callsExpression).toContain('net.peer.name');
+ expect(callsExpression).toContain('http_host');
expect(callsExpression).toContain("kind_string = 'Client'");
// Verify custom filters are merged
@@ -187,51 +187,4 @@ describe('StatusCodeBarCharts - V5 Migration Validation', () => {
expect(callsExpression).toContain('production');
});
});
-
- describe('4. HTTP URL Filter Handling', () => {
- it('converts http.url filter to (http.url OR url.full) expression in both charts', () => {
- const filtersWithHttpUrl: IBuilderQuery['filters'] = {
- items: [
- {
- id: 'http-url-filter',
- key: {
- key: 'http.url',
- dataType: 'string' as any,
- type: 'tag',
- },
- op: '=',
- value: '/api/metrics',
- },
- ],
- op: 'AND',
- };
-
- const payload = getEndPointDetailsQueryPayload(
- mockDomainName,
- mockStartTime,
- mockEndTime,
- filtersWithHttpUrl,
- );
-
- const callsChartQuery = payload[4];
- const latencyChartQuery = payload[5];
-
- const callsExpression =
- callsChartQuery.query.builder.queryData[0].filter?.expression;
- const latencyExpression =
- latencyChartQuery.query.builder.queryData[0].filter?.expression;
-
- // CRITICAL: http.url converted to OR logic
- expect(callsExpression).toContain(
- "(http.url = '/api/metrics' OR url.full = '/api/metrics')",
- );
- expect(latencyExpression).toContain(
- "(http.url = '/api/metrics' OR url.full = '/api/metrics')",
- );
-
- // Base filters still present
- expect(callsExpression).toContain('net.peer.name');
- expect(callsExpression).toContain("kind_string = 'Client'");
- });
- });
});
diff --git a/frontend/src/container/ApiMonitoring/__tests__/StatusCodeTableV5Migration.test.tsx b/frontend/src/container/ApiMonitoring/__tests__/StatusCodeTableV5Migration.test.tsx
index 8d606d20b5..e01a5ec7c9 100644
--- a/frontend/src/container/ApiMonitoring/__tests__/StatusCodeTableV5Migration.test.tsx
+++ b/frontend/src/container/ApiMonitoring/__tests__/StatusCodeTableV5Migration.test.tsx
@@ -6,8 +6,8 @@
* These tests validate the migration from V4 to V5 format for the second payload
* in getEndPointDetailsQueryPayload (status code table data):
* - Filter format change: filters.items[] → filter.expression
- * - URL handling: Special logic for (http.url OR url.full)
- * - Domain filter: (net.peer.name OR server.address)
+ * - URL handling: Special logic for http_url
+ * - Domain filter: http_host = '${domainName}'
* - Kind filter: kind_string = 'Client'
* - Kind filter: response_status_code EXISTS
* - Three queries: A (count), B (p99 latency), C (rate)
@@ -45,9 +45,9 @@ describe('StatusCodeTable - V5 Migration Validation', () => {
expect(typeof queryA.filter?.expression).toBe('string');
expect(queryA).not.toHaveProperty('filters.items');
- // Base filter 1: Domain (net.peer.name OR server.address)
+ // Base filter 1: Domain (http_host)
expect(queryA.filter?.expression).toContain(
- `(net.peer.name = '${mockDomainName}' OR server.address = '${mockDomainName}')`,
+ `http_host = '${mockDomainName}'`,
);
// Base filter 2: Kind
@@ -149,7 +149,7 @@ describe('StatusCodeTable - V5 Migration Validation', () => {
statusCodeQuery.query.builder.queryData[0].filter?.expression;
// Base filters present
- expect(expression).toContain('net.peer.name');
+ expect(expression).toContain('http_host');
expect(expression).toContain("kind_string = 'Client'");
expect(expression).toContain('response_status_code EXISTS');
@@ -165,62 +165,4 @@ describe('StatusCodeTable - V5 Migration Validation', () => {
expect(queries[1].filter?.expression).toBe(queries[2].filter?.expression);
});
});
-
- describe('4. HTTP URL Filter Handling', () => {
- it('converts http.url filter to (http.url OR url.full) expression', () => {
- const filtersWithHttpUrl: IBuilderQuery['filters'] = {
- items: [
- {
- id: 'http-url-filter',
- key: {
- key: 'http.url',
- dataType: 'string' as any,
- type: 'tag',
- },
- op: '=',
- value: '/api/users',
- },
- {
- id: 'service-filter',
- key: {
- key: 'service.name',
- dataType: 'string' as any,
- type: 'resource',
- },
- op: '=',
- value: 'user-service',
- },
- ],
- op: 'AND',
- };
-
- const payload = getEndPointDetailsQueryPayload(
- mockDomainName,
- mockStartTime,
- mockEndTime,
- filtersWithHttpUrl,
- );
-
- const statusCodeQuery = payload[1];
- const expression =
- statusCodeQuery.query.builder.queryData[0].filter?.expression;
-
- // CRITICAL: http.url converted to OR logic
- expect(expression).toContain(
- "(http.url = '/api/users' OR url.full = '/api/users')",
- );
-
- // Other filters still present
- expect(expression).toContain('service.name');
- expect(expression).toContain('user-service');
-
- // Base filters present
- expect(expression).toContain('net.peer.name');
- expect(expression).toContain("kind_string = 'Client'");
- expect(expression).toContain('response_status_code EXISTS');
-
- // All ANDed together (at least 2 ANDs: domain+kind, custom filter, url condition)
- expect(expression?.match(/AND/g)?.length).toBeGreaterThanOrEqual(2);
- });
- });
});
diff --git a/frontend/src/container/ApiMonitoring/__tests__/TopErrors.test.tsx b/frontend/src/container/ApiMonitoring/__tests__/TopErrors.test.tsx
index 53b722cb02..1159d6372f 100644
--- a/frontend/src/container/ApiMonitoring/__tests__/TopErrors.test.tsx
+++ b/frontend/src/container/ApiMonitoring/__tests__/TopErrors.test.tsx
@@ -84,7 +84,7 @@ describe('TopErrors', () => {
{
columns: [
{
- name: 'http.url',
+ name: SPAN_ATTRIBUTES.HTTP_URL,
fieldDataType: 'string',
fieldContext: 'attribute',
},
@@ -124,7 +124,7 @@ describe('TopErrors', () => {
table: {
rows: [
{
- 'http.url': '/api/test',
+ http_url: '/api/test',
A: 100,
},
],
@@ -206,7 +206,7 @@ describe('TopErrors', () => {
expect(navigateMock).toHaveBeenCalledWith({
filters: expect.arrayContaining([
expect.objectContaining({
- key: expect.objectContaining({ key: 'http.url' }),
+ key: expect.objectContaining({ key: SPAN_ATTRIBUTES.HTTP_URL }),
op: '=',
value: '/api/test',
}),
@@ -335,7 +335,7 @@ describe('TopErrors', () => {
// Verify all required filters are present
expect(filterExpression).toContain(
- `kind_string = 'Client' AND (http.url EXISTS OR url.full EXISTS) AND (net.peer.name = 'test-domain' OR server.address = 'test-domain') AND has_error = true`,
+ `kind_string = 'Client' AND ${SPAN_ATTRIBUTES.HTTP_URL} EXISTS AND ${SPAN_ATTRIBUTES.SERVER_NAME} = 'test-domain' AND has_error = true`,
);
});
});
diff --git a/frontend/src/container/ApiMonitoring/utils.tsx b/frontend/src/container/ApiMonitoring/utils.tsx
index ee2abf5b50..12d5a71930 100644
--- a/frontend/src/container/ApiMonitoring/utils.tsx
+++ b/frontend/src/container/ApiMonitoring/utils.tsx
@@ -15,7 +15,6 @@ import { getWidgetQueryBuilder } from 'container/MetricsApplication/MetricsAppli
import { convertNanoToMilliseconds } from 'container/MetricsExplorer/Summary/utils';
import dayjs from 'dayjs';
import { GetQueryResultsProps } from 'lib/dashboard/getQueryResults';
-import { RowData } from 'lib/query/createTableColumnsFromQuery';
import { cloneDeep } from 'lodash-es';
import { ArrowUpDown, ChevronDown, ChevronRight, Info } from 'lucide-react';
import { getWidgetQuery } from 'pages/MessagingQueues/MQDetails/MetricPage/MetricPageUtil';
@@ -57,12 +56,12 @@ export const getDisplayValue = (value: unknown): string =>
isEmptyFilterValue(value) ? '-' : String(value);
export const getDomainNameFilterExpression = (domainName: string): string =>
- `(net.peer.name = '${domainName}' OR server.address = '${domainName}')`;
+ `http_host = '${domainName}'`;
export const clientKindExpression = `kind_string = 'Client'`;
/**
- * Converts filters to expression, handling http.url specially by creating (http.url OR url.full) condition
+ * Converts filters to expression
* @param filters Filters to convert
* @param baseExpression Base expression to combine with filters
* @returns Filter expression string
@@ -75,34 +74,6 @@ export const convertFiltersWithUrlHandling = (
return baseExpression;
}
- // Check if filters contain http.url (SPAN_ATTRIBUTES.URL_PATH)
- const httpUrlFilter = filters.items?.find(
- (item) => item.key?.key === SPAN_ATTRIBUTES.URL_PATH,
- );
-
- // If http.url filter exists, create modified filters with (http.url OR url.full)
- if (httpUrlFilter && httpUrlFilter.value) {
- // Remove ALL http.url filters from items (guards against duplicates)
- const otherFilters = filters.items?.filter(
- (item) => item.key?.key !== SPAN_ATTRIBUTES.URL_PATH,
- );
-
- // Convert to expression first with other filters
- const {
- filter: intermediateFilter,
- } = convertFiltersToExpressionWithExistingQuery(
- { ...filters, items: otherFilters || [] },
- baseExpression,
- );
-
- // Add the OR condition for http.url and url.full
- const urlValue = httpUrlFilter.value;
- const urlCondition = `(http.url = '${urlValue}' OR url.full = '${urlValue}')`;
- return intermediateFilter.expression.trim()
- ? `${intermediateFilter.expression} AND ${urlCondition}`
- : urlCondition;
- }
-
const { filter } = convertFiltersToExpressionWithExistingQuery(
filters,
baseExpression,
@@ -371,7 +342,7 @@ export const formatDataForTable = (
});
};
-const urlExpression = `(url.full EXISTS OR http.url EXISTS)`;
+const urlExpression = `${SPAN_ATTRIBUTES.HTTP_URL} EXISTS`;
export const getDomainMetricsQueryPayload = (
domainName: string,
@@ -588,14 +559,7 @@ const defaultGroupBy = [
dataType: DataTypes.String,
isColumn: false,
isJSON: false,
- key: SPAN_ATTRIBUTES.URL_PATH,
- type: 'attribute',
- },
- {
- dataType: DataTypes.String,
- isColumn: false,
- isJSON: false,
- key: 'url.full',
+ key: SPAN_ATTRIBUTES.HTTP_URL,
type: 'attribute',
},
// {
@@ -867,8 +831,8 @@ function buildFilterExpression(
): string {
const baseFilterParts = [
`kind_string = 'Client'`,
- `(http.url EXISTS OR url.full EXISTS)`,
- `(net.peer.name = '${domainName}' OR server.address = '${domainName}')`,
+ `${SPAN_ATTRIBUTES.HTTP_URL} EXISTS`,
+ `${SPAN_ATTRIBUTES.SERVER_NAME} = '${domainName}'`,
`has_error = true`,
];
if (showStatusCodeErrors) {
@@ -910,12 +874,7 @@ export const getTopErrorsQueryPayload = (
filter: { expression: filterExpression },
groupBy: [
{
- name: 'http.url',
- fieldDataType: 'string',
- fieldContext: 'attribute',
- },
- {
- name: 'url.full',
+ name: SPAN_ATTRIBUTES.HTTP_URL,
fieldDataType: 'string',
fieldContext: 'attribute',
},
@@ -1134,11 +1093,11 @@ export const formatEndPointsDataForTable = (
if (!isGroupedByAttribute) {
formattedData = data?.map((endpoint) => {
const { port } = extractPortAndEndpoint(
- (endpoint.data[SPAN_ATTRIBUTES.URL_PATH] as string) || '',
+ (endpoint.data[SPAN_ATTRIBUTES.HTTP_URL] as string) || '',
);
return {
key: v4(),
- endpointName: (endpoint.data[SPAN_ATTRIBUTES.URL_PATH] as string) || '-',
+ endpointName: (endpoint.data[SPAN_ATTRIBUTES.HTTP_URL] as string) || '-',
port,
callCount:
endpoint.data.A === 'n/a' || endpoint.data.A === undefined
@@ -1262,9 +1221,7 @@ export const formatTopErrorsDataForTable = (
return {
key: v4(),
- endpointName: getDisplayValue(
- rowObj[SPAN_ATTRIBUTES.URL_PATH] || rowObj['url.full'],
- ),
+ endpointName: getDisplayValue(rowObj[SPAN_ATTRIBUTES.HTTP_URL]),
statusCode: getDisplayValue(rowObj[SPAN_ATTRIBUTES.RESPONSE_STATUS_CODE]),
statusMessage: getDisplayValue(rowObj.status_message),
count: getDisplayValue(rowObj.__result_0),
@@ -1281,10 +1238,10 @@ export const getTopErrorsCoRelationQueryFilters = (
{
id: 'ea16470b',
key: {
- key: 'http.url',
+ key: SPAN_ATTRIBUTES.HTTP_URL,
dataType: DataTypes.String,
type: 'tag',
- id: 'http.url--string--tag--false',
+ id: `${SPAN_ATTRIBUTES.HTTP_URL}--string--tag--false`,
},
op: '=',
value: endPointName,
@@ -1781,7 +1738,7 @@ export const getEndPointDetailsQueryPayload = (
filters || { items: [], op: 'AND' },
`${getDomainNameFilterExpression(
domainName,
- )} AND ${clientKindExpression} AND (http.url EXISTS OR url.full EXISTS)`,
+ )} AND ${clientKindExpression} AND ${SPAN_ATTRIBUTES.HTTP_URL} EXISTS`,
),
},
expression: 'A',
@@ -1793,12 +1750,7 @@ export const getEndPointDetailsQueryPayload = (
orderBy: [],
groupBy: [
{
- key: SPAN_ATTRIBUTES.URL_PATH,
- dataType: DataTypes.String,
- type: 'attribute',
- },
- {
- key: 'url.full',
+ key: SPAN_ATTRIBUTES.HTTP_URL,
dataType: DataTypes.String,
type: 'attribute',
},
@@ -2225,7 +2177,7 @@ export const getEndPointZeroStateQueryPayload = (
orderBy: [],
groupBy: [
{
- key: SPAN_ATTRIBUTES.URL_PATH,
+ key: SPAN_ATTRIBUTES.HTTP_URL,
dataType: DataTypes.String,
type: 'tag',
},
@@ -2419,8 +2371,7 @@ export const statusCodeWidgetInfo = [
interface EndPointDropDownResponseRow {
data: {
- [SPAN_ATTRIBUTES.URL_PATH]: string;
- 'url.full': string;
+ [SPAN_ATTRIBUTES.HTTP_URL]: string;
A: number;
};
}
@@ -2439,8 +2390,8 @@ export const getFormattedEndPointDropDownData = (
}
return data.map((row) => ({
key: v4(),
- label: row.data[SPAN_ATTRIBUTES.URL_PATH] || row.data['url.full'] || '-',
- value: row.data[SPAN_ATTRIBUTES.URL_PATH] || row.data['url.full'] || '-',
+ label: row.data[SPAN_ATTRIBUTES.HTTP_URL] || '-',
+ value: row.data[SPAN_ATTRIBUTES.HTTP_URL] || '-',
}));
};
@@ -2769,7 +2720,6 @@ export const groupStatusCodes = (
export const getStatusCodeBarChartWidgetData = (
domainName: string,
- endPointName: string,
filters: IBuilderQuery['filters'],
): Widgets => ({
query: {
@@ -2798,20 +2748,6 @@ export const getStatusCodeBarChartWidgetData = (
op: '=',
value: domainName,
},
- ...(endPointName
- ? [
- {
- id: '8b1be6f0',
- key: {
- dataType: DataTypes.String,
- key: SPAN_ATTRIBUTES.URL_PATH,
- type: 'tag',
- },
- op: '=',
- value: endPointName,
- },
- ]
- : []),
...(filters?.items || []),
],
op: 'AND',
@@ -2933,7 +2869,7 @@ export const getAllEndpointsWidgetData = (
filters,
`${getDomainNameFilterExpression(
domainName,
- )} AND ${clientKindExpression} AND (http.url EXISTS OR url.full EXISTS)`,
+ )} AND ${clientKindExpression} AND http_url EXISTS`,
),
},
functions: [],
@@ -2965,7 +2901,7 @@ export const getAllEndpointsWidgetData = (
filters,
`${getDomainNameFilterExpression(
domainName,
- )} AND ${clientKindExpression} AND (http.url EXISTS OR url.full EXISTS)`,
+ )} AND ${clientKindExpression} AND http_url EXISTS`,
),
},
functions: [],
@@ -2997,7 +2933,7 @@ export const getAllEndpointsWidgetData = (
filters,
`${getDomainNameFilterExpression(
domainName,
- )} AND ${clientKindExpression} AND (http.url EXISTS OR url.full EXISTS)`,
+ )} AND ${clientKindExpression} AND http_url EXISTS`,
),
},
functions: [],
@@ -3029,7 +2965,7 @@ export const getAllEndpointsWidgetData = (
filters,
`${getDomainNameFilterExpression(
domainName,
- )} AND ${clientKindExpression} AND has_error = true AND (http.url EXISTS OR url.full EXISTS)`,
+ )} AND ${clientKindExpression} AND has_error = true AND http_url EXISTS`,
),
},
functions: [],
@@ -3060,24 +2996,12 @@ export const getAllEndpointsWidgetData = (
);
widget.renderColumnCell = {
- [SPAN_ATTRIBUTES.URL_PATH]: (
- url: string | number,
- record?: RowData,
- ): ReactNode => {
- // First try to use the url from the column value
- let urlValue = url;
-
- // If url is empty/null and we have the record, fallback to url.full
- if (isEmptyFilterValue(url) && record) {
- const { 'url.full': urlFull } = record;
- urlValue = urlFull;
- }
-
- if (!urlValue || urlValue === 'n/a') {
+ [SPAN_ATTRIBUTES.HTTP_URL]: (url: string | number): ReactNode => {
+ if (isEmptyFilterValue(url) || !url || url === 'n/a') {
return <span>-</span>;
}
- const { endpoint } = extractPortAndEndpoint(String(urlValue));
+ const { endpoint } = extractPortAndEndpoint(String(url));
return <span>{getDisplayValue(endpoint)}</span>;
},
A: (numOfCalls: any): ReactNode => (
@@ -3132,8 +3056,8 @@ export const getAllEndpointsWidgetData = (
};
widget.customColTitles = {
- [SPAN_ATTRIBUTES.URL_PATH]: 'Endpoint',
- 'net.peer.port': 'Port',
+ [SPAN_ATTRIBUTES.HTTP_URL]: 'Endpoint',
+ [SPAN_ATTRIBUTES.SERVER_PORT]: 'Port',
};
widget.title = (
@@ -3158,12 +3082,10 @@ export const getAllEndpointsWidgetData = (
</div>
);
- widget.hiddenColumns = ['url.full'];
-
return widget;
};
-const keysToRemove = ['http.url', 'url.full', 'A', 'B', 'C', 'F1'];
+const keysToRemove = [SPAN_ATTRIBUTES.HTTP_URL, 'A', 'B', 'C', 'F1'];
export const getGroupByFiltersFromGroupByValues = (
rowData: any,
@@ -3221,7 +3143,7 @@ export const getRateOverTimeWidgetData = (
filter: {
expression: convertFiltersWithUrlHandling(
filters || { items: [], op: 'AND' },
- `(net.peer.name = '${domainName}' OR server.address = '${domainName}')`,
+ `http_host = '${domainName}'`,
),
},
functions: [],
@@ -3272,7 +3194,7 @@ export const getLatencyOverTimeWidgetData = (
filter: {
expression: convertFiltersWithUrlHandling(
filters || { items: [], op: 'AND' },
- `(net.peer.name = '${domainName}' OR server.address = '${domainName}')`,
+ `http_host = '${domainName}'`,
),
},
functions: [],
diff --git a/frontend/src/container/SpanDetailsDrawer/__tests__/AttributeActions.userflow.test.tsx b/frontend/src/container/SpanDetailsDrawer/__tests__/AttributeActions.userflow.test.tsx
index 49f11e7484..8d7b10ae66 100644
--- a/frontend/src/container/SpanDetailsDrawer/__tests__/AttributeActions.userflow.test.tsx
+++ b/frontend/src/container/SpanDetailsDrawer/__tests__/AttributeActions.userflow.test.tsx
@@ -3,6 +3,7 @@ import { MemoryRouter, Route } from 'react-router-dom';
import { fireEvent, render, screen, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import ROUTES from 'constants/routes';
+import { SPAN_ATTRIBUTES } from 'container/ApiMonitoring/Explorer/Domains/DomainDetails/constants';
import { AppProvider } from 'providers/App/App';
import MockQueryClientProvider from 'providers/test/MockQueryClientProvider';
import { Span } from 'types/api/trace/getTraceV2';
@@ -108,7 +109,7 @@ const createMockSpan = (): Span => ({
statusMessage: '',
tagMap: {
'http.method': 'GET',
- 'http.url': '/api/users?page=1',
+ [SPAN_ATTRIBUTES.HTTP_URL]: '/api/users?page=1',
'http.status_code': '200',
'service.name': 'frontend-service',
'span.kind': 'server',
diff --git a/frontend/src/container/SpanDetailsDrawer/__tests__/SpanDetailsDrawer.test.tsx b/frontend/src/container/SpanDetailsDrawer/__tests__/SpanDetailsDrawer.test.tsx
index 512b6f73a8..4860f741e6 100644
--- a/frontend/src/container/SpanDetailsDrawer/__tests__/SpanDetailsDrawer.test.tsx
+++ b/frontend/src/container/SpanDetailsDrawer/__tests__/SpanDetailsDrawer.test.tsx
@@ -5,6 +5,7 @@ import getSpanPercentiles from 'api/trace/getSpanPercentiles';
import getUserPreference from 'api/v1/user/preferences/name/get';
import { QueryParams } from 'constants/query';
import ROUTES from 'constants/routes';
+import { SPAN_ATTRIBUTES } from 'container/ApiMonitoring/Explorer/Domains/DomainDetails/constants';
import { GetMetricQueryRange } from 'lib/dashboard/getQueryResults';
import { server } from 'mocks-server/server';
import { QueryBuilderContext } from 'providers/QueryBuilder';
@@ -878,7 +879,9 @@ describe('SpanDetailsDrawer', () => {
// Verify only matching attributes are shown (use getAllByText for all since they appear in multiple places)
expect(screen.getAllByText('http.method').length).toBeGreaterThan(0);
- expect(screen.getAllByText('http.url').length).toBeGreaterThan(0);
+ expect(screen.getAllByText(SPAN_ATTRIBUTES.HTTP_URL).length).toBeGreaterThan(
+ 0,
+ );
expect(screen.getAllByText('http.status_code').length).toBeGreaterThan(0);
});
@@ -1126,7 +1129,7 @@ describe('SpanDetailsDrawer - Search Visibility User Flows', () => {
// User sees all attributes initially
expect(screen.getByText('http.method')).toBeInTheDocument();
- expect(screen.getByText('http.url')).toBeInTheDocument();
+ expect(screen.getByText(SPAN_ATTRIBUTES.HTTP_URL)).toBeInTheDocument();
expect(screen.getByText('http.status_code')).toBeInTheDocument();
// User types "method" in search
@@ -1136,7 +1139,7 @@ describe('SpanDetailsDrawer - Search Visibility User Flows', () => {
// User sees only matching attributes
await waitFor(() => {
expect(screen.getByText('http.method')).toBeInTheDocument();
- expect(screen.queryByText('http.url')).not.toBeInTheDocument();
+ expect(screen.queryByText(SPAN_ATTRIBUTES.HTTP_URL)).not.toBeInTheDocument();
expect(screen.queryByText('http.status_code')).not.toBeInTheDocument();
});
});
diff --git a/frontend/src/container/SpanDetailsDrawer/__tests__/mockData.ts b/frontend/src/container/SpanDetailsDrawer/__tests__/mockData.ts
index dbea38ba0f..98a0dd6d11 100644
--- a/frontend/src/container/SpanDetailsDrawer/__tests__/mockData.ts
+++ b/frontend/src/container/SpanDetailsDrawer/__tests__/mockData.ts
@@ -1,3 +1,4 @@
+import { SPAN_ATTRIBUTES } from 'container/ApiMonitoring/Explorer/Domains/DomainDetails/constants';
import { ILog } from 'types/api/logs/log';
import { Span } from 'types/api/trace/getTraceV2';
@@ -22,7 +23,7 @@ export const mockSpan: Span = {
event: [],
tagMap: {
'http.method': 'GET',
- 'http.url': '/api/test',
+ [SPAN_ATTRIBUTES.HTTP_URL]: '/api/test',
'http.status_code': '200',
},
hasError: false,
diff --git a/frontend/src/mocks-server/__mockdata__/tracedetail.ts b/frontend/src/mocks-server/__mockdata__/tracedetail.ts
index c0e439f65f..9afd2425df 100644
--- a/frontend/src/mocks-server/__mockdata__/tracedetail.ts
+++ b/frontend/src/mocks-server/__mockdata__/tracedetail.ts
@@ -1,3 +1,5 @@
+import { SPAN_ATTRIBUTES } from 'container/ApiMonitoring/Explorer/Domains/DomainDetails/constants';
+
/* eslint-disable sonarjs/no-duplicate-string */
export const traceDetailResponse = [
{
@@ -35,7 +37,7 @@ export const traceDetailResponse = [
'component',
'host.name',
'http.method',
- 'http.url',
+ SPAN_ATTRIBUTES.HTTP_URL,
'ip',
'http.status_code',
'opencensus.exporterversion',
@@ -84,7 +86,7 @@ export const traceDetailResponse = [
'signoz.collector.id',
'component',
'http.method',
- 'http.url',
+ SPAN_ATTRIBUTES.HTTP_URL,
'ip',
],
[
@@ -741,7 +743,7 @@ export const traceDetailResponse = [
'component',
'http.method',
'http.status_code',
- 'http.url',
+ SPAN_ATTRIBUTES.HTTP_URL,
'net/http.reused',
'net/http.was_idle',
'service.name',
@@ -833,7 +835,7 @@ export const traceDetailResponse = [
'opencensus.exporterversion',
'signoz.collector.id',
'host.name',
- 'http.url',
+ SPAN_ATTRIBUTES.HTTP_URL,
'net/http.reused',
'net/http.was_idle',
],
@@ -916,7 +918,7 @@ export const traceDetailResponse = [
'net/http.was_idle',
'component',
'host.name',
- 'http.url',
+ SPAN_ATTRIBUTES.HTTP_URL,
'ip',
'service.name',
'signoz.collector.id',
diff --git a/frontend/src/pages/TracesExplorer/Filter/filterUtils.ts b/frontend/src/pages/TracesExplorer/Filter/filterUtils.ts
index 1dcc6622f8..a585ee9178 100644
--- a/frontend/src/pages/TracesExplorer/Filter/filterUtils.ts
+++ b/frontend/src/pages/TracesExplorer/Filter/filterUtils.ts
@@ -2,6 +2,7 @@
import { Dispatch, SetStateAction, useEffect, useState } from 'react';
import { getAttributesValues } from 'api/queryBuilder/getAttributesValues';
import { DATA_TYPE_VS_ATTRIBUTE_VALUES_KEY } from 'constants/queryBuilder';
+import { SPAN_ATTRIBUTES } from 'container/ApiMonitoring/Explorer/Domains/DomainDetails/constants';
import {
BaseAutocompleteData,
DataTypes,
@@ -31,7 +32,7 @@ export const AllTraceFilterKeyValue: Record<string, string> = {
httpRoute: 'HTTP Route',
'http.route': 'HTTP Route',
httpUrl: 'HTTP URL',
- 'http.url': 'HTTP URL',
+ [SPAN_ATTRIBUTES.HTTP_URL]: 'HTTP URL',
traceID: 'Trace ID',
trace_id: 'Trace ID',
} as const;