Environments
As of Sentry 9, you can easily filter issues, releases, and user feedback by environment. On the top right of your screen, you’ll see a dropdown of different environments. Toggling between environments will allow you to see issue data, release data, and user feedback data filtered by environment.
Inside the Environment Filter
Issues
Sentry defines an issue as a grouping of similar events. If one or more events within an issue are tagged with a certain environment, that issue will appear in your view when filtered by that environment. For example, if an issue is composed of one event tagged with Production
and one event tagged with Staging
, the issue will appear in your view when filtering by Production
as well as by Staging
.
In addition, the environment filter affects all issue-related metrics like count of users affected, times series graphs, and event count.
Releases
You can filter releases by which environment they’ve been deployed to (to learn more about configuring releases and deploys, click here). For example, a release linked to a QA
deploy and a Prod
deploy will appear in your view when filtering by QA
as well as Prod
. All issue-related metrics within a given release will be affected by the environment filter.
Hiding environments
If a certain environment is not a useful filter for your team, you can hide the environment from your environments dropdown by navigating to your project settings > Environments, and selecting ‘Hide’. Data sent from that environment will still be visible under All Environments, and will still count against your quota.
If you want to change the name of a given environment, you will have to modify your SDK configuration. This will not change environment names for past data.
How to send environment data
Environment data is sent to Sentry by tagging issues via your SDK:
Options are passed to the init()
as object:
import * as Sentry from '@sentry/browser';
Sentry.init({
environment: 'staging',
})
onDeviceReady: function() {
var Sentry = cordova.require("sentry-cordova.Sentry");
Sentry.init({
environment: 'staging',
});
}
using Sentry;
SentrySdk.Init(o => o.Environment = "staging");
import * as Sentry from '@sentry/electron';
Sentry.init({
environment: 'staging',
})
sentry.Init(sentry.ClientOptions{
Environment: "staging",
})
sentry_options_t *options = sentry_options_new();
sentry_options_set_environment(options, "staging");
sentry_init(options);
const Sentry = require('@sentry/node');
Sentry.init({
environment: 'staging',
})
Sentry\init([
'environment' => 'production',
]);
import sentry_sdk
sentry_sdk.init(environment="staging")
sentry::init(sentry::ClientOptions {
environment: Some("staging".into()),
..Default::default()
});