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 1d751a4196 Preserve metric entity context in trace handoffs
1d751a4196 is described below
commit 1d751a41967c7a7c98fe97a44abe98352f62c439
Author: Logic <[email protected]>
AuthorDate: Tue Jun 9 18:58:15 2026 +0800
Preserve metric entity context in trace handoffs
---
web-next/lib/signal-dashboards.test.ts | 2 +-
web-next/lib/signal-dashboards.ts | 22 +++++++++++++++++++++-
2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/web-next/lib/signal-dashboards.test.ts
b/web-next/lib/signal-dashboards.test.ts
index eca9f67102..6b85963243 100644
--- a/web-next/lib/signal-dashboards.test.ts
+++ b/web-next/lib/signal-dashboards.test.ts
@@ -2031,7 +2031,7 @@ describe('signal dashboards API client', () => {
serviceNamespace: 'payments',
resourceFilter: 'db.system=postgresql',
relatedSignal: 'traces',
- relatedHandoffHref:
'/trace/manage?view=list&spanScope=all&serviceName=checkout&serviceNamespace=payments&resourceFilter=db.system%3Dpostgresql&returnTo=%2Fdashboard%3Fstart%3D1000%26end%3D3000&start=1000&end=3000'
+ relatedHandoffHref:
'/trace/manage?view=list&spanScope=all&serviceName=checkout&serviceNamespace=payments&resourceFilter=db.system%3Dpostgresql&entityId=4200&entityType=service&entityName=Checkout+API&source=otlp&collector=collector-a&template=spring-boot&returnTo=%2Fdashboard%3Fstart%3D1000%26end%3D3000&start=1000&end=3000'
}),
expect.objectContaining({
panelId: 'external-metrics-panel',
diff --git a/web-next/lib/signal-dashboards.ts
b/web-next/lib/signal-dashboards.ts
index 0c8d8090fb..09388d4cbe 100644
--- a/web-next/lib/signal-dashboards.ts
+++ b/web-next/lib/signal-dashboards.ts
@@ -3408,6 +3408,18 @@ function metricResourceFilter(key: string, value:
string) {
return `${key}=${value}`;
}
+function metricHertzBeatHandoffContext(labels: Record<string, string>) {
+ return {
+ environment: metricLabelValue(labels, ['deployment.environment.name',
'deployment_environment_name', 'environment']),
+ entityId: metricLabelValue(labels, ['hertzbeat.entity_id',
'hertzbeat.entity.id', 'entity_id', 'entity.id', 'entityId']),
+ entityType: metricLabelValue(labels, ['hertzbeat.entity_type',
'hertzbeat.entity.type', 'entity_type', 'entity.type', 'entityType']),
+ entityName: metricLabelValue(labels, ['hertzbeat.entity_name',
'hertzbeat.entity.name', 'entity_name', 'entity.name', 'entityName']),
+ source: metricLabelValue(labels, ['hertzbeat.source', 'signal.source',
'signal_source', 'source']),
+ collector: metricLabelValue(labels, ['hertzbeat.collector', 'collector']),
+ template: metricLabelValue(labels, ['hertzbeat.template', 'template'])
+ };
+}
+
const METRIC_BREAKOUT_ATTRIBUTE_PRIORITY = [
'service.name',
'service.namespace',
@@ -3458,15 +3470,23 @@ function syncTooltipMetricRelatedHandoff(
const dbSystem = metricLabelValue(labels, ['db.system', 'dbSystem',
'db_system']);
const externalAddress = metricLabelValue(labels,
['external.service.address', 'externalServiceAddress',
'external_service_address', 'server.address', 'net.peer.name']);
const operationName = metricOperationName(labels);
+ const hertzBeatContext = metricHertzBeatHandoffContext(labels);
const resourceFilter = dbSystem
? metricResourceFilter('db.system', dbSystem)
: externalAddress ? metricResourceFilter('external.service.address',
externalAddress) : '';
- if (!serviceName && !resourceFilter && !operationName) return {};
+ if (!serviceName && !resourceFilter && !operationName &&
!hertzBeatContext.entityId && !hertzBeatContext.entityName) return {};
const params = new URLSearchParams({ view: 'list', spanScope: 'all' });
if (serviceName) params.set('serviceName', serviceName);
if (serviceNamespace) params.set('serviceNamespace', serviceNamespace);
if (resourceFilter) params.set('resourceFilter', resourceFilter);
if (operationName) params.set('operationName', operationName);
+ if (hertzBeatContext.environment) params.set('environment',
hertzBeatContext.environment);
+ if (hertzBeatContext.entityId) params.set('entityId',
hertzBeatContext.entityId);
+ if (hertzBeatContext.entityType) params.set('entityType',
hertzBeatContext.entityType);
+ if (hertzBeatContext.entityName) params.set('entityName',
hertzBeatContext.entityName);
+ if (hertzBeatContext.source) params.set('source', hertzBeatContext.source);
+ if (hertzBeatContext.collector) params.set('collector',
hertzBeatContext.collector);
+ if (hertzBeatContext.template) params.set('template',
hertzBeatContext.template);
return {
...(serviceName ? { serviceName } : {}),
...(serviceNamespace ? { serviceNamespace } : {}),
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]