mirror of
https://github.com/hyperdxio/hyperdx
synced 2026-04-21 13:37:15 +00:00
fix: Set team and connection attributes on span instead of trace (#1266)
Closes HDX-2506 `setTraceAttributes` is not working (see HDX-2599), so for now we will replace it with span attributes, to ensure that we have some way of correlating alert job logs to teams. <img width="492" height="209" alt="Screenshot 2025-10-14 at 4 07 36 PM" src="https://github.com/user-attachments/assets/46f9391e-e4c9-4a12-bc6b-a37d53ecadf6" />
This commit is contained in:
parent
3332d5eaf5
commit
c428d98412
2 changed files with 10 additions and 9 deletions
5
.changeset/afraid-trains-sort.md
Normal file
5
.changeset/afraid-trains-sort.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
"@hyperdx/api": patch
|
||||
---
|
||||
|
||||
fix: Set team and connection attributes on span instead of trace
|
||||
|
|
@ -9,7 +9,6 @@ import {
|
|||
ChartConfigWithOptDateRange,
|
||||
DisplayType,
|
||||
} from '@hyperdx/common-utils/dist/types';
|
||||
import { setTraceAttributes } from '@hyperdx/node-opentelemetry';
|
||||
import * as fns from 'date-fns';
|
||||
import { chunk, isString } from 'lodash';
|
||||
import { ObjectId } from 'mongoose';
|
||||
|
|
@ -436,10 +435,11 @@ export default class CheckAlertTask implements HdxTask<CheckAlertsTaskArgs> {
|
|||
teamWebhooksById: Map<string, IWebhook>,
|
||||
) {
|
||||
await tasksTracer.startActiveSpan('processAlertTask', async span => {
|
||||
setTraceAttributes({
|
||||
'hyperdx.alerts.team.id': alertTask.conn.team.toString(),
|
||||
'hyperdx.alerts.connection.id': alertTask.conn.id,
|
||||
});
|
||||
span.setAttribute(
|
||||
'hyperdx.alerts.team.id',
|
||||
alertTask.conn.team.toString(),
|
||||
);
|
||||
span.setAttribute('hyperdx.alerts.connection.id', alertTask.conn.id);
|
||||
|
||||
try {
|
||||
const { alerts, conn } = alertTask;
|
||||
|
|
@ -486,10 +486,6 @@ export default class CheckAlertTask implements HdxTask<CheckAlertsTaskArgs> {
|
|||
args: this.args,
|
||||
});
|
||||
|
||||
setTraceAttributes({
|
||||
'hyperdx.alerts.provider': this.provider.constructor.name,
|
||||
});
|
||||
|
||||
const alertTasks = await this.provider.getAlertTasks();
|
||||
const taskCount = alertTasks.length;
|
||||
logger.debug({
|
||||
|
|
|
|||
Loading…
Reference in a new issue