← Learning center

What are namespaces?

What are namespaces?

Namespaces help you divide your application into logical chunks and monitor those chunks collectively and individually.

In this guide, we'll walk you through the namespace basics to help you learn how to get more out of your app's metrics.

What are namespaces?

When it comes to resolving errors and performance issues, it's important to know where in your code they originated from, that's where the benefits of namespaces begin.

A simple example of namespacing would be an application with a front-end and a backend.

Your backend may be consist of two key parts, code that handles web requests and code that forms operates as a Content Management system (CMS). Errors and incidents in your CMS may be of much lower priority than those in your front-end or request handling code, so it might make sense to not have AppSignal notify you too often, or at all, for that part of your application.

AppSignal's default namespaces

By default AppSignal groups your requests into the following namespaces:

  • web for web requests
  • frontend for Front-end JavaScript
  • background for background jobs

But you can add as many namespaces as you like to your application.

Tracking metrics per namespace in AppSignal

With AppSignal, namespaces help you quickly gain contextual insights into the performance of your application.

For example, you can filter your metric data on a namespace, if you're only interested in performance incidents from the admin namespace or errors in web.

Image of error tracking with namespace filter highlighted

When monitoring your data via graphs, you can define which namespaces you want to view and hover over any point on the graph to see a breakdown of namespace performance.

Image of graph with namespace breakdown

Configuring namespaces

Thanks to our handy helper methods, it's easy to start configuring and using namespaces with AppSignal.

AppSignal supports namespaces in Ruby, Elixir, Node.js, Python and Front-end Javascript.

Ruby
Elixir
Node.js
Python
JavaScript
Ruby
Appsignal.set_namespace("admin")
Elixir
Appsignal.Span.set_namespace(Appsignal.Tracer.root_span(), "admin")
Node.js
import { setNamespace } from "@appsignal/nodejs"; setNamespace("custom-namespace");
Python
from appsignal import set_namespace set_namespace("custom-namespace")
JavaScript
const span = appsignal.createSpan(); span.setNamespace("admin"); // a custom namespace for this span (defaults to `frontend`)

For more in-depth configuration information, please read our namespaces documentation.

Ignoring namespaces

There may be parts of your application you simply don't want to monitor with AppSignal, for example your CMS. You can easily configure AppSignal to ignore namespaces, meaning AppSignal will ignore all transactional data and actions that occur within the namespace.

To ignore a namespace you'll need to update your AppSignal configuration:

Ruby
Elixir
Node.js
Python
Ruby
# config/appsignal.yml production: ignore_namespaces: - "http_request" # "admin" namespace on AppSignal - "background_job" # "background" namespace on AppSignal - "admin" - "private" # Other config
Elixir
# config/appsignal.exs import Config config :appsignal, :config, ignore_namespaces: [ "http_request", # "web" namespace on AppSignal "background_job", # "background" namespace on AppSignal "admin", "private" ]
Node.js
const { Appsignal } = require("@appsignal/nodejs"); new Appsignal({ // Other config ignoreNamespaces: ["web", "background", "admin", "private"], });
Python
# __appsignal__.py from appsignal import Appsignal appsignal = Appsignal( # Other config ignore_namespaces=["web", "background", "admin", "private"] )

For more detailed information please read our ignore namespaces guide.

Configure namespace notifications

To avoid a namespace creating alert fatigue by triggering too many notifications, you can configure your app's notification default settings per namespace, for example you can make it so your admin namespace has a notification setting of Never notify meaning you will never receive a notification for that namespace, but can still monitor it from AppSignal.

Image of namespace notifier defaults

You can also configure namespace notifications per integration (e.g. Slack):

Image of integration namespace notification settings

You can configure notifications from within your application's settings in AppSignal.

What next?

Namespaces are just one of many ways AppSignal makes it easy for you to monitor your application. To make sure you get the most out of AppSignal, we recommend:

You can reach out to us if you want to know more about Namespaces or have any other questions about monitoring your app with AppSignal.

Start your free trial

Don’t let the bad bugs bite. Try AppSignal for free.

AppSignal offers a 30-day free trial, no credit card is required. All features are available in all plans. Start monitoring your application in just a few clicks!