Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
@adonisjs/profiler
Advanced tools
Profiler to time actions in your code with context.
Profiler is a tiny library to time functions in your Node.js code with context, so that you can present related actions after they have been completed.
Install the package from the npm registry as follows:
npm i @adonisjs/profiler
# yarn
yarn add @adonisjs/profiler
and then use it as follows
import { Profiler } from '@adonisjs/profiler/build/standalone'
const profiler = new Profiler({
enabled: true,
whitelist: [],
blacklist: [],
})
The @adonisjs/core
module includes this module by default. However, here's how you can set it up manually.
const providers = [
'@adonisjs/profiler/build/providers/ProfilerProvider'
]
And then also register the typings file inside tsconfig.json
file.
{
"files": ["./node_modules/@adonisjs/profiler/build/adonis-typings/profiler.d.ts"]
}
You will need only one instance of the profiler in your entire application and then you will work with rows
and actions
to time function calls.
The profiling data is delivered to a subscriber function and then subscriber can decide the storage or representation of data.
profiler.subscribe((packet) => {
// write somewhere
})
You can only have one subscriber listening for profiler packets at a given time. This is done for the simplicitiy and performance, since we want the profiler to have minimum overhead to your applications.
The scope of profiling should always trim down as your application get mature, in that scanerio, instead of removing profiler calls, you can blacklist or whitelist actions and they will result in noop. For example:
const profiler = new Profiler({
enabled: true,
whitelist: [],
blacklist: ['find:route'],
})
const row = profile.create('http:request', { url: '/' })
row.profile('find:route', {}, () => {
// Code to find route
})
Without changing anything in your code, the find:route
action will have no impact. If you will blacklist a row label, then all of it's actions will be disabled as well.
Following are the autogenerated files via Typedoc
FAQs
Profiler to time function calls in AdonisJs with context
The npm package @adonisjs/profiler receives a total of 10,615 weekly downloads. As such, @adonisjs/profiler popularity was classified as popular.
We found that @adonisjs/profiler demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.