Skip to content

Repository files navigation

Sidekick Node.js Agent

Sidekick LicenceSidekick Discord ChannelForesight monitoringSidekick Sandbox

Table of Contents
  1. What is Sidekick?
  2. Sidekick Node.js Agent
  3. Usage
  4. Build the agent
  5. Official Sidekick Agents
  6. Resources
  7. Questions? Problems? Suggestions?
  8. Contact

What is Sidekick?

Sidekick is a live application debugger that lets you troubleshoot your applications while they keep on running.

Add dynamic logs and put non-breaking breakpoints in your running application without the need of stopping & redeploying.

Sidekick Open Source is here to allow self-hosting and make live debugging more accessible. Built for everyone who needs extra information from their running applications.

Sidekick Actions:

Sidekick has two major actions; Tracepoints & Logpoints.

  • A tracepoint is 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(on-demand) 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.

Supported runtimes: Java, Python, Node.js

To learn more about Sidekick features and capabilities, see our web page.

(back to top)

Sidekick Node.js Agent

Sidekick Node.js agent allows you to inject tracepoints (non-breaking breakpoints) and logpoints dynamically to capture call stack snapshots (with variables) and add log messages on the fly without code modification, re-build and re-deploy. So it helps you, your team, and your organization to reduce MTTR (Minimum Time to Repair/Resolve).

To achieve this, Sidekick Node.js agent makes use of V8's inspector API.

The advantages of Sidekick over classical APM solutions is that, Sidekick

  • can debug and trace any location (your code base or 3rd party dependency) in your application, not just the external (DB, API, etc ...) calls like APM solutions
  • has zero overhead when you don't have any tracepoint or logpoint but APMs have always
  • doesn't produce too much garbage data because it collects data only at the certain points you specified as long as that point (tracepoint/logpoint) is active

Usage

npm install @runsidekick/sidekick-agent-nodejs

Docs

There are two way to integrate Sidekick agent to your application.

Integrate Agent with Environment Variable

You can easily integrate Sidekick using below environment variables.

  • set SIDEKICK_APIKEY environment variable with your Sidekick api key.
  • set NODE_OPTIONS environment variable with '-r @runsidekick/sidekick-agent-nodejs/dist/bootstrap'

Integrate Agent with Code

You can easily integrate Sidekick adding below code block to top of your project.

JS example

constSidekickDebugger=require('@runsidekick/sidekick-agent-nodejs');SidekickDebugger.start({apiKey: '<Your_Api_Key>'});
...

TS example

import*asSidekickDebuggerfrom'@runsidekick/sidekick-agent-nodejs';SidekickDebugger.start({apiKey: '<Your_Api_Key>'});
...

Configs

ConfigRequirementEnvironment VariableDefault
apiKey RequiredSIDEKICK_APIKEYNone
logLevel OptionalSIDEKICK_AGENT_LOG_LEVELinfo
disable OptionalSIDEKICK_AGENT_DISABLEfalse
brokerHost OptionalSIDEKICK_AGENT_BROKER_HOSTSidekick broker address
brokerPort OptionalSIDEKICK_AGENT_BROKER_PORTSidekick broker port
brokerClient OptionalSIDEKICK_AGENT_BROKER_CLIENTLogged in user
applicationId OptionalSIDEKICK_AGENT_APPLICATION_IDGenerated by agent
applicationName OptionalSIDEKICK_AGENT_APPLICATION_NAMEEmpty string
applicationInstanceId OptionalSIDEKICK_AGENT_APPLICATION_INSTANCE_IDGenerated by agent
applicationVersion OptionalSIDEKICK_AGENT_APPLICATION_VERSIONEmpty string
applicationStage OptionalSIDEKICK_AGENT_APPLICATION_STAGEEmpty string
applicationTag OptionalSIDEKICK_AGENT_APPLICATION_TAGNone
maxFrames OptionalSIDEKICK_AGENT_MAX_FRAMES20
maxExpandFrames OptionalSIDEKICK_AGENT_MAX_EXPAND_FRAMES1
maxProperties OptionalSIDEKICK_AGENT_MAX_PROPERTIES10
maxParseDepth OptionalSIDEKICK_AGENT_MAX_PARSE_DEPTH3
propertyAccessClassification OptionalSIDEKICK_AGENT_PROPERTY_ACCESS_CLASSIFICATIONENUMERABLE-OWN
scriptPrefix OptionalSIDEKICK_AGENT_SCRIPT_PREFIXNone
rejectOnStartup OptionalSIDEKICK_AGENT_REJECT_ON_STARTUPfalse
captureFrameDataReductionCallback OptionalNone
logMessageDataReductionCallback OptionalNone
errorCollectionEnable OptionalSIDEKICK_AGENT_ERROR_COLLECTION_ENABLEfalse
errorCollectionEnableCaptureFrame OptionalSIDEKICK_AGENT_ERROR_COLLECTION_CAPTURE_FRAMEfalse

Valid Config Values

  • propertyAccessClassification (SIDEKICK_AGENT_PROPERTY_ACCESS_CLASSIFICATION) configuration can take one of following values:
    • ENUMERABLE-OWN (default value)
    • ENUMERABLE-OWN-AND-ENUMERABLE-PARENT
    • ENUMERABLE-OWN-AND-NON-ENUMERABLE-OWN
    • ENUMERABLE-OWN-AND-NON-ENUMERABLE-OWN-ENUMERABLE-PARENT

Build

  • npm run clean-build:all

Official Sidekick Agents

Resources:

Questions? Problems? Suggestions?

To report a bug or request a feature, create a GitHub Issue. Please ensure someone else has not created an issue for the same topic.

(back to top)

Contact

Reach out on the Discord. A fellow community member or Sidekick engineer will be happy to help you out.

(back to top)

About

Nodejs agent for Sidekick open-source live application debugger

Topics

Resources

Stars

12 stars

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages