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.
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.
By default AppSignal groups your requests into the following namespaces:
web
for web requestsfrontend
for Front-end JavaScriptbackground
for background jobsBut you can add as many namespaces as you like to your application.
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
.
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.
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.
Appsignal.set_namespace("admin")
Appsignal.Span.set_namespace(Appsignal.Tracer.root_span(), "admin")
import { setNamespace } from "@appsignal/nodejs"; setNamespace("custom-namespace");
from appsignal import set_namespace set_namespace("custom-namespace")
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.
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:
# config/appsignal.yml production: ignore_namespaces: - "http_request" # "admin" namespace on AppSignal - "background_job" # "background" namespace on AppSignal - "admin" - "private" # Other config
# config/appsignal.exs import Config config :appsignal, :config, ignore_namespaces: [ "http_request", # "web" namespace on AppSignal "background_job", # "background" namespace on AppSignal "admin", "private" ]
const { Appsignal } = require("@appsignal/nodejs"); new Appsignal({ // Other config ignoreNamespaces: ["web", "background", "admin", "private"], });
# __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.
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.
You can also configure namespace notifications per integration (e.g. Slack):
You can configure notifications from within your application's settings in AppSignal.
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.
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!