AtlasGo to Atlas↗️

No results

Help CenterIntegrationsSentry Integration

Sentry Integration

Last updated March 8, 2024

Identifying bugs (or, equally importantly, determining that bugs aren't a part of a customer's problems) is an important part of resolving many support tickets.

Traditionally, information about new bugs is locked away in error logs that are visible only to the engineering team. Atlas opens up access to these logs to support agents to help in diagnosing root problems so that faster short-term resolutions can be achieved for customers (ie, workarounds) and so that the engineering team can get directly to the core of issues where bugs are the root cause.

Below, we'll outline the steps for sending errors logged in Sentry to Atlas.

Connecting to Sentry

To connect Atlas to Sentry, login to your Sentry account and go to Settings > Integrations. Search for Atlas. Select the Atlas icon and then click "Accept and Install."

Sending errors to Atlas

Without any changes to your code, Atlas will automatically attempt to match Sentry errors to specific customer timelines based off of the user_id and email for the customer. If that user is only in a single session, it will also show up in that session replay.

You can improve your experience further by linking Sentry issues to Atlas sessions (instructions below). Doing this will:

  1. assign Sentry errors to the correct session for customers with multiple simultaneous sessions
  2. show the Atlas session in Sentry
  3. assign Sentry errors to the correct customer if their data hasn't been shared with Sentry

Frontend implementation

Pass the Atlas session id to Sentry as the atlasSupport.sessionId tag. Make sure to get the session id right before your Sentry request since it can be changed over time. For example:

Sentry.init({
   dsn: "",
   release: "my-project-name@2.3.12",
})

Sentry.addGlobalEventProcessor((event) => {
	const sessionId = window.Atlas?.recording?.getSessionId();
	event.tags = {
		...(event.tags || {}),
		["atlasSupport.sessionId"]: sessionId,
		["atlasSupport.sessionUrl"]: sessionId
			? "https://app.getatlas.io/sessions/" + sessionId : "",
	};
	return event;
});

Backend implementation

This depends on the frameworks and tools used.

Our general recommendations are:

  1. Send the Atlas session id to the backend with every request via cookie or header
  2. Add atlasSupport.sessionId tag containing atlas session id in your Sentry setup code.

Here is how you could do this in Python

# Setting up Sentry 
import sentry_sdk
sentry_sdk.init(SENTRY_URL)

# On each request pass the user details and atlas session id to sentry as a tag
atlas_session_id = request.headers.get("X-Atlas-Session-Id")
sentry_sdk.set_tag("atlasSupport.sessionId", atlas_session_id)
sentry_sdk.set_user({"email": user.email, "id": str(user.id)})

If a Sentry error does not contain session id, Atlas will try to guess it (this will only works for logged in users with single active session).

For help with your specific setup, reach out to us at  help@getatlas.io .

Was this article helpful?