![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
@madgex/datadog-monitoring
Advanced tools
All your Hapi + Datadog needs, in one handy package.
When used as a module, this library exports hapi-pino and a function to set up dd-trace. You can use one or both of these in the setup file for your server:
const { pino, trace } = require('@madgex/datadog-monitoring');
async function createServer() {
await trace({
hostname: DD_AGENT_HOSTNAME || '',
service: 'my-service-name',
hapiOptions: {
blacklist: ['/healthcheck']
},
});
await server.register([
{
plugin: pino,
options: {
prettyPrint: IS_DEV,
level: LOG_LEVEL,
redact: ['req.headers.authorization'],
ignorePaths: ['/healthcheck'],
},
},
]);
return server;
}
All available options for the dd-trace Hapi plugin can be passed as hapiOptions
. Hostname, if not set, will default to the discoverable Datadog agent host on AWS. The trace
function returns the tracer instance so further plugin configuration can be added if you wish, eg:
async function createServer() {
const tracer = await trace({
hostname: DD_AGENT_HOSTNAME || '',
service: 'my-service-name',
hapiOptions: {
blacklist: ['/healthcheck']
},
});
tracer.use('redis', { analytics: true });
return server;
}
The hapi-pino plugin should be set up as described in its documentation.
This library also includes a custom transport to pipe Pino logs from a server's stdout to a Datadog agent over UDP, transforming the JSON format for processing and display. Optionally it can also echo the transformed messages to stdout. It should be used in your npm scripts like so:
"start": "dd-monitor /path/to/server.js --hostname [hostname] --port [port] --echo"
Hostname and port relate to the Datadog agent to which the transport should transmit logs, and are optional. If not set, hostname will default first to a DD_AGENT_HOSTNAME environment variable, and then to looking up the discoverable host on AWS. Port will default to a Logging__DataDogLoggingPort environment variable.
FAQs
All your Hapi + Datadog needs, in one handy package.
The npm package @madgex/datadog-monitoring receives a total of 81 weekly downloads. As such, @madgex/datadog-monitoring popularity was classified as not popular.
We found that @madgex/datadog-monitoring demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.