honeycombio / beeline-nodejs

Legacy instrumentation for node.js applications with Honeycomb
https://honeycomb.io
Apache License 2.0
54 stars 57 forks source link

Allow sending event data asynchronously to api.honeycomb.com, add support to configure generating events to STDOUT #221

Closed robwdux closed 4 years ago

robwdux commented 4 years ago

We are using AWS Lambda and AWS Cloudwatch would like the ability same as what is provided in the Golang Beeline.

performance - allow trading user facing latency with http synchronous calls for a slight delay in event data arriving at Honeycomb in addition to Cloudwatch costs

durability - allows buffering data with Cloudwatch/Kinesis if necessary at times (don't drop any event data on the floor)

reliability/determinism - had issues with Lambda / Node non-async handler / callback with event loop due to having to have startTrace outside async functions.

Also noted here

In the Honeycomb Serverless stack, we emit structured events to logfiles, and then use lambda functions that upload these logs to Honeycomb

toshok commented 4 years ago

so there is a way to get event traffic to stdout:

require("honeycomb-beeline")({
  transmission: "writer"
});

but there's a libhoney issue with quoting the output, fixed in https://github.com/honeycombio/libhoney-js/pull/73. we'll need to land that fix + bump the libhoney dep here.

toshok commented 4 years ago

The fix for quoting required adding a new transmission type, so the above snippet will become this, post libhoney release:

require("honeycomb-beeline")({
  transmission: "console"
});
robwdux commented 4 years ago

thanks again @toshok for this. When transmission is set to console, may the writekey not be required? .writeKey must be a non-empty string