Node Configuration
Configuration Options
The Node agent can be configured via two methods:
- Code Based
- Environment Variables
Code Based
Pass configuration options to init() in your scout.js (or scout.ts) file:
const { init } = require("@scout_apm/scout-apm");
init({
name: "my-app",
key: process.env.SCOUT_KEY,
monitor: true,
});
Environment Variables
You can also configure Scout APM via environment variables. To configure Scout via enviroment variables, uppercase the config key and prefix it with SCOUT_. For example, to set the key configuration via environment variables use: export SCOUT_KEY=YOURKEY
Common Configurations
| Setting Name | Description | Default | Required |
|---|---|---|---|
| key | The organization API key. | Yes | |
| name | Name of the application (ex: ‘Photos App’). | Yes | |
| monitor | Whether monitoring data should be reported. | false |
Yes |
| log_level | Override the SCOUT log level. Can only be used to quiet the agent, will not override the underlying logger’s level | 'info' |
No |
Additional Configurations
| Setting Name | Description | Default | Required |
|---|---|---|---|
| revision_sha | The Git SHA associated with this release. | See docs | No |
| scm_subdirectory | The relative path from the base of your Git repo to the directory which contains your application code. | No | |
| ignore | A string containing a JSON array of endpoints that Scout should ignore. | [] |
No |
| disabled_instruments | A string containing a JSON array of instruments that Scout should not install. | [] |
No |
| hostname | The hostname the metrics should be aggregrated under. | hostname |
No |
Core Agent Configurations
| Setting Name | Description | Default | Required |
|---|---|---|---|
| core_agent_dir | Path to create the directory which will store the Core Agent. | /tmp/scout_apm_core |
No |
| core_agent_download | Whether to download the Core Agent automatically, if needed. | True |
No |
| core_agent_launch | Whether to start the Core Agent automatically, if needed. | True |
No |
| core_agent_permissions | The permission bits to set when creating the directory of the Core Agent. | 700 |
No |
| core_agent_full_name | The release/url we look for when downloading the core-agent. | Auto-detected | No |
| core_agent_triple | If you are running a MUSL based Linux (such as ArchLinux), you may need to explicitly specify the platform triple. E.g. x86_64-unknown-linux-musl |
Auto detected | No |
| core_agent_log_level | The log level of the core agent process. This should be one of: "trace", "debug", "info", "warn", "error". This does not affect the log level of the NodeJS library. To change that, directly configure logging as per the documentation. |
"info" |
No |
| core_agent_log_file | The log file for the core agent process | "/path/to/your/log/file" |
No |
Error Monitoring Configurations
| Setting Name | Description | Default | Required |
|---|---|---|---|
| errors_enabled | Enable or disable error capture. Set to false to turn off error monitoring. |
true |
No |
| errors_host | The endpoint where errors are reported. Override for on-premise or testing against a local Scout instance. | https://errors.scoutapm.com |
No |
| errors_ignored_exceptions | A comma-separated list (env var) or array (config) of exception class names to suppress. Subclasses are also ignored. | [] |
No |
These can also be set via environment variables:
export SCOUT_ERRORS_ENABLED=true
export SCOUT_ERRORS_HOST=https://errors.scoutapm.com
export SCOUT_ERRORS_IGNORED_EXCEPTIONS=RangeError,MyCustomError
Logging / Diagnostic Configurations
| Setting Name | Description | Default | Required |
|---|---|---|---|
| log_payload_content | When true, logs the full JSON payload sent to the Scout APM ingestor to stdout. Useful for debugging instrumentation locally. |
false |
No |
Set via environment variable:
export SCOUT_LOG_PAYLOAD_CONTENT=true
Environments
It typically makes sense to treat each environment (production, staging, etc) as a separate application within Scout and ignore the development and test environments.
Configure a unique app name for each environment as Scout aggregates data by the app name. For example, app-staging might be used to represent a Staging environment where as app-production would represent a Production environment.