-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/fiberless' of https://github.com/monti-apm/mont…
…i-apm-agent into 3.0-disable-await-detector
- Loading branch information
Showing
31 changed files
with
1,101 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
.build* | ||
node_modules/ | ||
.npm | ||
.npm/.package-garbage-* | ||
smart.lock | ||
versions.json | ||
.idea | ||
.eslintcache | ||
packages/ | ||
.envrc | ||
/packages/* | ||
/packages/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
This directory and the files immediately inside it are automatically generated | ||
when you change this package's NPM dependencies. Commit the files in this | ||
directory (npm-shrinkwrap.json, .gitignore, and this README) to source control | ||
so that others run the same versions of sub-dependencies. | ||
|
||
You should NOT check in the node_modules directory that Meteor automatically | ||
creates; if you are using git, the .gitignore file tells git to ignore it. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { checkModuleUsed } from './commonjs-utils'; | ||
|
||
export function wrapAgenda () { | ||
Meteor.startup(() => { | ||
if (checkModuleUsed('@hokify/agenda')) { | ||
instrumentAgendaTs(); | ||
} | ||
if (checkModuleUsed('agenda')) { | ||
instrumentAgenda(); | ||
} | ||
}); | ||
} | ||
|
||
function instrumentAgendaTs () { | ||
// eslint-disable-next-line global-require | ||
let agenda = require('@hokify/agenda'); | ||
let Job = agenda.Job; | ||
|
||
instrumentJob(Job.prototype); | ||
} | ||
|
||
function instrumentAgenda () { | ||
// eslint-disable-next-line global-require | ||
let Job = require('agenda/dist/job').Job; | ||
instrumentJob(Job.prototype); | ||
} | ||
|
||
function instrumentJob (JobMethods) { | ||
let oldSaveJob = JobMethods.save; | ||
JobMethods.save = function () { | ||
let id = this.attrs._id; | ||
|
||
if (!id) { | ||
let name = this.attrs.name; | ||
Kadira.models.jobs.trackNewJob(name); | ||
} | ||
|
||
return oldSaveJob.apply(this, arguments); | ||
}; | ||
|
||
let oldRun = JobMethods.run; | ||
JobMethods.run = function (...args) { | ||
let name = this.attrs.name; | ||
let waitTime = Date.now() - this.attrs.nextRunAt; | ||
let details = { | ||
name, | ||
waitTime, | ||
data: this.attrs.data | ||
}; | ||
|
||
return Kadira.traceJob(details, () => oldRun.apply(this, args)); | ||
}; | ||
} |
Oops, something went wrong.