you can get the package from the npm: https://www.npmjs.com/package/@runsidekick/sidekick-client
Node.js client for Sidekick. Send your Sidekick logs and traces to any target in seconds!
Explore the docs »
Sidekick Home
·
Report Bug & Request Feature
Table of Contents
Sidekick is a production debugging and on-demand logging tool where you can debug your running applications while they keep on running. Sidekick provides the ability to add logs and put non-breaking breakpoints in your application code which captures the snapshot of the application state, the call stack, variables, etc.
Sidekick Actions:
- A tracepoint is basically a non-breaking remote breakpoint. In short, it takes a snapshot of the variables when the code hits that line.
- Logpoints open the way for dynamic logging to Sidekick users. Replacing traditional logging with dynamic logging has the potential to lower stage sizes, costs, and time for log searching while adding the ability to add new logpoints without editing the source code, redeploying or restarting the application
- A tracepoint is basically a non-breaking remote breakpoint. In short, it takes a screenshot of the variables when the code hits that line.
- Logpoints open the way for dynamic logging to Sidekick users. Replacing
tested with node v16.14.2
- npm
npm install npm@latest -g
-
Install sidekick-client
npm i sidekick-client
-
Import sidekickConnect from sidekick-client
const { sidekickConnect } = require('sidekick-client')
-
Create an
ingest
function that will send collected data to desired target:function ingestFunc () { return async function (data) { // Implement your own function to send data to any target } }
-
Initialize Sidekick client with proper parameters.
const { sidekickConnect } = require('sidekickingesterbeta') const sidekickClient = { sidekick_email : <sidekick_email>, sidekick_password : <sidekick_password>, tracepointFunction : ingestFunc(), logpointFunction : ingestFunc(), stdout : false // enable console log } sidekickConnect(sidekickClient); ```
If you have an on-premise setup add the fields below to client object:
"sidekick_host": "ws://127.0.0.1",
"sidekick_port": "7777"
If have your user token you can use it instead of email & password :
"sidekick_token": "<>"
You can use Sidekick client with any db integration, here is a elasticsearch integration example:
-
Create a
config.json
according to your needs"sidekick_tracepoint_index": "sidekick_tracepoint", "sidekick_logpoint_index": "sidekick_logpoint", "sidekick_email":"<>", "sidekick_password":"<>",
-
Create an
ingest
function with using elasticsearch client:function ingestFunc (index) { return async function (data) { console.log(JSON.stringify({index,data})); } }
-
Call sidekickconnect function with proper parameters.
const { sidekickConnect } = require('sidekickingesterbeta') const sidekickClient = { sidekick_email : config['sidekick_email'], sidekick_password : config['sidekick_password'], tracepointFunction : ingestFunc(config['sidekick_tracepoint_index']), logpointFunction : ingestFunc(config['sidekick_logpoint_index']) } sidekickConnect(sidekickClient); ```
-
Run your app!
- Add websocket support
- Custom ingest function
- Add support for programattically putting logpoints & tracepoints
Barış Kaya - @boroskoyo
Sidekick: website
Emin Bilgiç - linkedin