Getting Started

For an overview of what Sentry does, take a look at the Sentry workflow.

Sentry is designed to be very simple to get off the ground, yet powerful to grow into. If you have never used Sentry before, this tutorial will help you getting started.

Getting started with Sentry is a three step process:

  1. Sign up for an account
  2. Install your SDK
  3. Configure it

Install an SDK

Sentry captures data by using an SDK within your application’s runtime. These are platform specific and allow Sentry to have a deep understanding of both how your application works. In case your environment is very specific, you can also roll your own SDK using our document SDK API.

Install our Python SDK using pip:

$ pip install --upgrade sentry-sdk==0.6.2

The quickest way to get started is to use the CDN hosted version of the JavaScript browser SDK:

<script src="https://browser.sentry-cdn.com/4.4.1/bundle.min.js" crossorigin="anonymous"></script>

If you are using yarn you can add our package as a dependency easily:

$ yarn add @sentry/node@4.4.1

Or alternatively you can npm install it:

$ npm install @sentry/node@4.4.1

Install our SDK using the cordova command:

$ cordova plugin add sentry-cordova@0.12.3

Install the NuGet package:

Package Manager:

Install-Package Sentry -Version 1.1.0

.NET Core CLI:

dotnet add package Sentry -v 1.1.0

If you are using yarn you can add our package as a dependency easily:

$ yarn add @sentry/browser@4.4.1

Or alternatively you can npm install it:

$ npm install @sentry/browser@4.4.1

If you are using yarn you can add our package as a dependency easily:

$ yarn add @sentry/electron@0.14.0

Or alternatively you can npm install it:

$ npm install @sentry/electron@0.14.0

To add Sentry to your Rust project you just need to add a new dependency to your Cargo.toml:

[dependencies]
sentry = "0.12.0"

Install the NuGet package:

Package Manager:

Install-Package Sentry.AspNetCore -Version 1.1.0

.NET Core CLI:

dotnet add package Sentry.AspNetCore -v 1.1.0

Configure the SDK

After you completed setting up a project in Sentry, you’ll be given a value which we call a DSN, or Data Source Name. It looks a lot like a standard URL, but it’s actually just a representation of the configuration required by the Sentry SDKs. It consists of a few pieces, including the protocol, public key, the server address, and the project identifier.

import sentry_sdk
sentry_sdk.init("___PUBLIC_DSN___")

You should init the Sentry Browser SDK as soon as possible during your page load:

Sentry.init({ dsn: '___PUBLIC_DSN___' });

You need to inform the Sentry Node SDK about your DSN:

const Sentry = require('@sentry/node');
Sentry.init({ dsn: '___PUBLIC_DSN___' });

You should init the SDK in the deviceReady function, to make sure the native integrations runs. For more details about Cordova click here

onDeviceReady: function() {
  var Sentry = cordova.require("sentry-cordova.Sentry");
  Sentry.init({ dsn: '___PUBLIC_DSN___' });
}

You should initialize the SDK as early as possible, like in the Main method in Program.cs:

using (SentrySdk.Init("___PUBLIC_DSN___"))
{
    // App code
}

You should init the Sentry browser SDK as soon as possible during your application load up:

import * as Sentry from '@sentry/browser';

Sentry.init({ dsn: '___PUBLIC_DSN___' });

You need to call init in your main and every renderer process you spawn. For more details about Electron click here

import * as Sentry from '@sentry/electron';

Sentry.init({dsn: '___PUBLIC_DSN___'});
extern crate sentry;
let _guard = sentry::init("___PUBLIC_DSN___");

Add Sentry to Program.cs through the WebHostBuilder:

public static IWebHost BuildWebHost(string[] args) =>
    WebHost.CreateDefaultBuilder(args)
        .UseStartup<Startup>()
        // Add this:
        .UseSentry("___PUBLIC_DSN___")
        .Build();

Most SDKs will now automatically collect data if available, some require some extra configuration as automatic error collecting is not available due to platform limitations.

Next Steps

Now that you’ve got basic reporting setup, you’ll want to explore adding additional context to your data.