Agent

Configuration

Every option the Rytena agent accepts, with defaults and examples.

Basic setup

javascript
const { Rytena } = require('rytena-agent')

Rytena.init({
  apiKey: process.env.RYTENA_API_KEY
})

All options

javascript
Rytena.init({
  apiKey:   'ryt_xxxx.yyyy',         // required
  name:     'production-api',         // optional
  endpoint: 'https://api.rytena.dev', // optional
  interval: 30,                       // optional (seconds)
  debug:    false                     // optional
})

apiKey required

Your project API key. Get one at dashboard/projects/new. Format: ryt_xxxx.yyyy.

Falls back to the RYTENA_API_KEY environment variable if not provided.

name optional

A human-readable name for this process. Shown in the dashboard.

Defaults to the name field from your package.json, or your hostname if not found.

endpoint optional

The Rytena backend URL. Only change this if you're self-hosting.

Defaults to http://localhost:5000 in development. Use the RYTENA_ENDPOINT environment variable in production.

interval optional

How often the agent captures a memory snapshot, in seconds.

Defaults to 30. Minimum recommended value is 10. Shorter intervals mean faster leak detection but slightly more overhead.

debug optional

Enable verbose logging. Useful during development to see memory metrics in your console.

Defaults to false. Set to true or use RYTENA_DEBUG=true.

Static methods

Rytena.stop()

Gracefully stops the agent. Snapshots stop, the interval clears, and event listeners are removed.

javascript
Rytena.stop()

Rytena.status()

Returns the current agent state.

javascript
const status = Rytena.status()

// {
//   running:   true,
//   processId: 42,
//   runtimeId: 'ryt_a1b2c3d4e5f6',
//   endpoint:  'https://api.rytena.dev',
//   interval:  30,
//   name:      'production-api'
// }

Overhead

The Rytena agent is designed to have negligible impact on your application:

  • Quick snapshots: less than 1ms
  • Memory footprint: less than 5 MB
  • Deep scans: run only when a leak is suspected, once per 5 minutes at most
  • Network: one HTTP request per interval

What's next