Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add newrelic custom attributes #4300

Merged
merged 2 commits into from
Oct 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions apps/worker/src/app/workflow/usecases/run-job/run-job.usecase.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const nr = require('newrelic');

import { Injectable, Logger } from '@nestjs/common';
import { JobEntity, JobRepository, JobStatusEnum } from '@novu/dal';
import { StepTypeEnum } from '@novu/shared';
Expand Down Expand Up @@ -33,12 +35,17 @@ export class RunJob {
if (!job) throw new PlatformException(`Job with id ${command.jobId} not found`);

try {
this.logger?.assign({
const contextData = {
transactionId: job.transactionId,
environmentId: job._environmentId,
organizationId: job._organizationId,
jobId: job._id,
});
jobType: job.type,
};

nr.addCustomAttributes(contextData);

this.logger?.assign(contextData);
} catch (e) {
Logger.error(e, 'RunJob');
}
Expand Down
Loading