segment-integrations / analytics.js-integration-sentry

The Sentry analytics.js integration.
https://segment.com/docs/integrations/sentry/
MIT License
3 stars 7 forks source link

Add environment Optional Setting #28

Closed diegoprd closed 6 years ago

diegoprd commented 6 years ago

Sentry supports a custom option to set your environment but segment integration doesnt: https://docs.sentry.io/clients/javascript/config/#optional-settings

This particular custom option allows you to handle different environments without the need of creating different projects for each of them in Sentry.

Add another option called environment to the Sentry destination setup modal under the Optional Settings (string value - defaulting to null) to be sent to Sentry as follows:

environment
Track the environment name inside Sentry.

{
  environment: 'production'
}
maggieychu commented 6 years ago

Hey @diegoprd, thanks for creating this issue! I've added this in a report to our engineers as it's a better workflow to track user requests for integration changes. That being said I'll close out this issue and update you when our team has investigated the new Sentry library.

Please submit all future requests to us here: https://segment.com/contact

Thank you!

GerjoGreenwaldMM commented 5 years ago

I was looking for the same option but eventually I created a small workaround. Load this after segment initialization:

window.analytics.ready(() => { if (window.Raven) window.Raven.setTagsContext({ environment: 'production' }); });