Environments and releases

Tag every log with where it ran and which version of your code sent it.

Set them on the logger

Both are plain strings on the logger, attached to every entry it sends:

TypeScript
import { Apperio } from 'apperio';

const logger = new Apperio({
  apiKey: 'your-api-key',
  projectId: 'your-project-id',
  environment: 'production', // default: 'development'
  release: '2.4.1',          // default: none
});

What environment is used for

  • Notifications. The project owner is told about new errors only from the environments listed in Settings › Notifications. The default list is production. An empty list means every environment. An error with no environment always notifies.
  • Deploy verdicts. A deploy to production is judged on logs tagged production. If neither hour has logs with that name, Apperio falls back to all of the project’s logs. See Deploys and verdicts.
  • Issues. Each issue lists the environments it has been seen in. When an error first seen in staging reaches production, you get the notification you would have had if it had started there.
  • Filters and alert rules. You can filter logs by environment and limit an alert rule to one.

The default is development

If you don’t set environment, everything is tagged development, and with the default notification settings you won’t be told about new errors.

What release is used for

  • Issues. An issue shows the release it was first seen in, for example since 2.4.1 in the list and next to First seen in the detail view.
  • Deploys. When you record a deploy with the deployments API, pass the same release string so the deploy and the logs it produced line up.
  • Source maps (beta). A minified stack trace can only be read back with source maps uploaded for the same release. See Source maps.

Service name

serviceName (default unknown-service) tags each log with the part of your system that sent it, such as web or api. Logs can be filtered by service, and alert rules can be limited to one.

There is also a serviceVersion option. In apperio 1.5.2 it is accepted but never sent, so use release for versions.

Choosing values

  • Use a small, fixed set of environment names, spelled the same way everywhere: production, staging, development. Notification settings ignore case, but deploy verdicts match the name exactly, so keep names lowercase.
  • For the release, use whatever identifies a build: your package version, a git tag, or a commit SHA. Set it at build time from an environment variable, so each deploy reports its own value.
  • Releases can be up to 100 characters and environments up to 50.