This is an automated email from the ASF dual-hosted git repository.
zqr10159 pushed a commit to branch 2.0.0
in repository https://gitbox.apache.org/repos/asf/hertzbeat.git
The following commit(s) were added to refs/heads/2.0.0 by this push:
new b21e29fb73 Add operation filters to metric trace handoffs
b21e29fb73 is described below
commit b21e29fb73f7385fc633494e962ff73ae0b278a4
Author: Logic <[email protected]>
AuthorDate: Wed Jun 10 09:32:01 2026 +0800
Add operation filters to metric trace handoffs
---
web-next/lib/otlp-metrics/view-model.test.ts | 9 +++++++++
web-next/lib/otlp-metrics/view-model.ts | 12 ++++++++++++
2 files changed, 21 insertions(+)
diff --git a/web-next/lib/otlp-metrics/view-model.test.ts
b/web-next/lib/otlp-metrics/view-model.test.ts
index 065b5a30db..4560745bb5 100644
--- a/web-next/lib/otlp-metrics/view-model.test.ts
+++ b/web-next/lib/otlp-metrics/view-model.test.ts
@@ -1120,6 +1120,7 @@ describe('otlp metrics view model', () => {
expect(traceParams.get('traceId')).toBe('trace-series-42');
expect(traceParams.get('spanId')).toBe('span-series-42');
expect(traceParams.get('operationName')).toBe('/inventory/{id}');
+ expect(traceParams.get('attributeFilter')).toBeNull();
expect(traceParams.get('entityId')).toBe('42');
expect(traceParams.get('entityType')).toBe('service');
@@ -1223,6 +1224,14 @@ describe('otlp metrics view model', () => {
expect(logParams.get('serviceNamespace')).toBe('payments');
expect(logParams.get('operationName')).toBe('/checkout/:id');
expect(logParams.get('attributeFilter')).toBe('http.route="/checkout/:id"');
+
+ const traceParams = new URL(result.tracesHref,
'https://example.com').searchParams;
+ expect(traceParams.get('traceId')).toBeNull();
+ expect(traceParams.get('spanId')).toBeNull();
+ expect(traceParams.get('serviceName')).toBe('checkout');
+ expect(traceParams.get('serviceNamespace')).toBe('payments');
+ expect(traceParams.get('operationName')).toBe('/checkout/:id');
+
expect(traceParams.get('attributeFilter')).toBe('http.route="/checkout/:id"');
});
it('opens trace-linked metric logs as history records without an extra text
search filter', () => {
diff --git a/web-next/lib/otlp-metrics/view-model.ts
b/web-next/lib/otlp-metrics/view-model.ts
index 6172543882..0f42432402 100644
--- a/web-next/lib/otlp-metrics/view-model.ts
+++ b/web-next/lib/otlp-metrics/view-model.ts
@@ -224,6 +224,16 @@ function buildMetricsLogsOperationAttributeFilter(
return buildLogAttributeFilterExpression('span.name', operationName);
}
+function buildMetricsTraceOperationAttributeFilter(
+ selectedSeries: OtlpMetricSeriesView | null | undefined,
+ traceId: string | undefined,
+ spanId: string | undefined
+) {
+ if (traceId || spanId) return undefined;
+ const httpRoute = readSeriesLabel(selectedSeries, 'http.route',
'http_route');
+ return httpRoute ? buildLogAttributeFilterExpression('http.route',
httpRoute) : undefined;
+}
+
export function buildConsoleFacts(
data: OtlpMetricsConsole,
t: Translator,
@@ -1046,6 +1056,8 @@ export function buildMetricsHandoffLinks(
if (spanId) traceParams.set('spanId', spanId);
if (serviceName) traceParams.set('serviceName', serviceName);
appendSignalRouteContext(traceParams, signalContext);
+ const traceOperationAttributeFilter =
buildMetricsTraceOperationAttributeFilter(selectedSeries, traceId, spanId);
+ if (traceOperationAttributeFilter) traceParams.set('attributeFilter',
traceOperationAttributeFilter);
const entityParams = new URLSearchParams();
if (serviceName) entityParams.set('search', serviceName);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]