Git Product home page Git Product logo

pino-datadog's People

Contributors

0x2me avatar abalhier avatar alphashuro-br avatar dependabot[bot] avatar devillecodes avatar francisu avatar greenkeeper[bot] avatar jsclayton avatar nhacsam avatar ovhemert avatar snyk-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

pino-datadog's Issues

An in-range update of tap is breaking the build 🚨

The devDependency tap was updated from 13.1.2 to 13.1.3.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

tap is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • βœ… continuous-integration/appveyor/branch: AppVeyor build succeeded (Details).
  • ❌ Travis CI - Branch: The build errored.

Commits

The new version differs by 4 commits.

  • 6f014d0 13.1.3
  • 72dc4fe Support empty rejected promise in t.rejects
  • afde705 fixed directory
  • 6ab6c49 update travis to include node 12 instead of 11

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of tap is breaking the build 🚨

The devDependency tap was updated from 14.7.0 to 14.7.1.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

tap is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details

Commits

The new version differs by 7 commits.

  • 876ab9c 14.7.1
  • 5f23990 Always hook source map support into the right places
  • 328487e temporarily depend on tapjs git fork of source-map-support
  • fd7fe27 update async-hook-domain to fix stack overflows
  • bfb0610 docs: update fixtures doc links
  • 355b20c docs: update changelog
  • b59ef75 update cli doc

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of snyk is breaking the build 🚨

The dependency snyk was updated from 1.246.0 to 1.247.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

snyk is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details

Release Notes for v1.247.0

1.247.0 (2019-11-13)

Features

Commits

The new version differs by 4 commits.

  • e69ef82 Merge pull request #861 from snyk/feat/introduce-jar-files
  • e699598 feat: add *.war support
  • 0189a39 chore: split up test and monitor tests
  • e845d19 feat: detect *.jar files as maven

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

TypeScript support

πŸš€ Feature Proposal

Please add TypeScript types to this project. It is written in JavaScript and does not bundle type definitions. If that's not possible, please consider adding types to @types/pino-datadog.

Motivation

I'm working on a project in TypeScript and would like to use this library to stream logs to Datadog.

Example

While I could not find other pino loggers for Datadog, there are a few examples available for Winston that might serve as a starting point:

Debug logging does not work

Before you submit an issue we recommend you first check if an existing issue does not already exist.

Please read this entire template before posting any issue. If you ignore these instructions
and post an issue here that does not follow the instructions, your issue might be closed.

πŸ› Bug Report

Using log.debug({ object }, "Debug message"); does not send into Datadog

To Reproduce

Steps to reproduce the behavior:

Paste your code here:

import pino from "pino";
import datadog from "pino-datadog";

const streams = [
  { stream: process.stdout },
  { 
    stream: datadog.createWriteStreamSync({
      apiKey: process.env.DD_API_KEY,
      ddtags: `env:${process.env.NODE_ENV}`,
      eu: true,
    }); 
  }
];

const logger = pino( { level: "debug" }, pino.multistream(streams) );

logger.debug({ foo: "bar" }, "debug message");

Expected behavior

A clear and concise description of what you expected to happen.

Paste the results here:

A message in Datadog with:

{"level":20,"time":1670932284621,"pid":214789,"hostname":"service.host","foo": "bar","msg":"debug message"}

Your Environment

  • os: Mac, Windows, Linux
  • any other relevant information

An in-range update of snyk is breaking the build 🚨

The dependency snyk was updated from 1.230.8 to 1.231.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

snyk is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details

Release Notes for v1.231.0

1.231.0 (2019-10-04)

Features

  • Multi licenses formatting (3a7e995)
Commits

The new version differs by 3 commits.

  • 2791798 Merge pull request #792 from snyk/feat/multi-licenses-formatting
  • c802bc7 test: Update test to expect array
  • 3a7e995 feat: Multi licenses formatting

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of tap is breaking the build 🚨

The devDependency tap was updated from 14.10.0 to 14.10.1.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

tap is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details

Commits

The new version differs by 4 commits ahead by 4, behind by 2.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Log error for non-JSON log lines

πŸš€ Feature Proposal

It would be great if the library logged an error to the console when encountering non-JSON lines.

Motivation

When we first implemented pino-datadog, we had an existing configuration that looked at process.env.NODE_ENV and used pino’s prettyPrint when not in production. Separately, we set the stream to either be process.stdout or pino-datadog's writeStream, depending on the existence of process.env.DD_API_KEY. This led to some confusion + debugging time, as it was failing silently locally (we've since changed our code to base both the log format and stream on process.env.DD_API_KEY).

Considering the library logs errors if the Axios request fails (also useful for debugging), I think it'd also be nice to log when JSON-parsing fails.

cli.js is not executable

The CLI documentation states that you have to globally install the package for it to be used in this mode.

If you make the CLI executable (chmod +x src/cli.js) however, the global install requirement is removed and you can install pino-datadog as a normal dependency.

This is similar to how pino-pretty works.

Release a version with the axios vulnerability fix (CVE-2020-28168)

πŸ› Bug Report

We use pino-datadog in all our projects and receive this advisory alert on every npm i asaxios is a dependency of pino-datadog.
Please could you release a new version with the new axios version that has already been committed to master by snyk-bot. I'm happy to do it if you share details on how you want it done?

To Reproduce

Steps to reproduce the behaviour:

Paste your code here:

npm install pino-datadog
npm audit

Expected behaviour

Should not have any high severity vulnerabilities (or higher) that have already been resolved by dependency maintainers.

Actual behaviour

image

Your Environment

  • os: Mac
  • node: 14.16.0
  • npm: 6.14.11

Does this use a worker thread?

Hi,

You mention that the createWriteStreamAsync() is "async for compatibility reasons". Does this mean it does not use a worker thread?

Thanks!

-e (--eu) CLI flag doesn't seem to work

When including the -e (or --eu) CLI flag I get a status 403:

> node --unhandled-rejections=strict --optimize_for_size --max_old_space_size=115 --gc_interval=100 . | pino-datadog

{"level":30,"time":1574122975941,"pid":91734,"hostname":"[redacted]","msg":"App is running under env 'development', listening on port 8080, and has an available heap size of 113303784 bytes (~0.11GB)","v":1}
The previous log have not been saved
Request failed with status code 403
Error: Request failed with status code 403
    at createError (/Users/devillexio/Developer/devillexio/pino-datadog/node_modules/axios/lib/core/createError.js:16:15)
    at settle (/Users/devillexio/Developer/devillexio/pino-datadog/node_modules/axios/lib/core/settle.js:17:12)
    at IncomingMessage.handleStreamEnd (/Users/devillexio/Developer/devillexio/pino-datadog/node_modules/axios/lib/adapters/http.js:237:11)
    at IncomingMessage.emit (events.js:215:7)
    at endReadableNT (_stream_readable.js:1183:12)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)

The same config works when I exclude the flag.

Batch entries should be submitted after a timeout

πŸš€ Feature Proposal

Send log batches after timeout even if the batch is not complete.

Motivation

Services may have non-uniform traffic patterns and as such, it may be the case that some logs take a long time before being submitted.

Example

We could add a new option timeout that default maybe to 30s? This option would mean that every timeout seconds the stream will be flushed even if less than size entries are present.

Support for disabling stdout

Currently, having the package included in a project as well as the datadog agent running with log collection enabled in the cluster means that logs are duplicated in the datadog interface, and the duplicated logs are neither tagged nor formatted correctly.

I've created a PR adding a commandline option for this here

An in-range update of snyk is breaking the build 🚨

The dependency snyk was updated from 1.239.5 to 1.240.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

snyk is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details

Release Notes for v1.240.0

1.240.0 (2019-10-30)

Features

  • introduce spinner lib to replace custom one (05738b1)
  • user external spinner in npm and monitor (bf6c40e)
Commits

The new version differs by 3 commits.

  • 2248b5c Merge pull request #807 from snyk/feat/replace-spinner
  • bf6c40e feat: user external spinner in npm and monitor
  • 05738b1 feat: introduce spinner lib to replace custom one

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Strange behavious with option "size"

Stream with option "size": 10 seems to behave really weird thus it won't send my Logs to the DataDog API but when I remove the options everything works fine.

Is there something broken with the implementation?

Because taken from the docs:

size
Type: String (optional)

The number of log messages to send as a single batch (defaults to 1).

What I would have expected was that if I want to send a single Log to the DataDog API that there shouldnt be a problem.

But as long as I kept that option no Log got through.

question..

Hi,

I am trying to send my pino logs to datadog. I currently use pino like below.. would it be difficult to add pino-datadog on top ?


const config = require('../config')

var getNamespace = require('cls-hooked').getNamespace;


const pino = (config.nodeEnv == 'local') ? require('pino')({
  transport: {
    target: 'pino-pretty',
    options: {
      colorize: true
    },
    messageFormat: "[Request: {requestId}] {msg}",
    ignore: "pid,hostname"

  }
}) : require('pino')(require('pino').destination({ sync: false }));



//decorates with request id, user id and business id
const format = (obj_or_message) => {
  let clsNamespace = getNamespace('app');
  const request_id = clsNamespace.get("request_id")
  const user_id = clsNamespace.get("user_id")
  const business_id = clsNamespace.get("business_id")

  if (typeof obj_or_message == 'object') {
    return Object.assign(obj_or_message, { request_id: request_id, user_id: user_id, business_id: business_id })
  } else {
    return { request_id: request_id, user_id: user_id, business_id: business_id, message: obj_or_message }
  }
}

const wrappedPino = {

  debug: (obj) => {
    pino.debug(format(obj))
  },
  warn: (obj) => {
    pino.warn(format(obj))
  },
  info: (obj) => {
    pino.info(format(obj))
  },
  error: (obj) => {
    pino.error(format(obj))
  },
}


module.exports = wrappedPino;

where do I specify my datadog key?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.