File tree Expand file tree Collapse file tree 4 files changed +30
-4
lines changed
Expand file tree Collapse file tree 4 files changed +30
-4
lines changed Original file line number Diff line number Diff line change @@ -63,6 +63,7 @@ pub mod query_journal;
6363pub mod retriable_stream;
6464pub mod runtime;
6565pub mod schemas;
66+ pub mod sentry;
6667pub mod sha256;
6768pub mod shapes;
6869pub mod shutdown;
Original file line number Diff line number Diff line change 1+ use sentry:: Scope ;
2+
3+ pub fn set_sentry_tags ( scope : & mut Scope ) {
4+ if let Ok ( alloc_id) = std:: env:: var ( "NOMAD_ALLOC_ID" ) {
5+ scope. set_tag ( "nomad_alloc_id" , alloc_id) ;
6+ }
7+ if let Ok ( job_name) = std:: env:: var ( "NOMAD_JOB_NAME" ) {
8+ scope. set_tag ( "nomad_job_name" , job_name) ;
9+ }
10+ if let Ok ( group_name) = std:: env:: var ( "NOMAD_GROUP_NAME" ) {
11+ scope. set_tag ( "nomad_group_name" , group_name) ;
12+ }
13+ if let Ok ( task_name) = std:: env:: var ( "NOMAD_TASK_NAME" ) {
14+ scope. set_tag ( "nomad_task_name" , task_name) ;
15+ }
16+ if let Ok ( dc) = std:: env:: var ( "NOMAD_DC" ) {
17+ scope. set_tag ( "nomad_dc" , dc) ;
18+ }
19+ }
Original file line number Diff line number Diff line change @@ -51,6 +51,7 @@ use common::{
5151 HttpResponseError ,
5252 NoopRouteMapper ,
5353 } ,
54+ sentry:: set_sentry_tags,
5455} ;
5556use event_receiver:: Event ;
5657use futures:: {
@@ -440,6 +441,9 @@ fn main() -> Result<(), MainError> {
440441 } ) ;
441442 if sentry. is_enabled ( ) {
442443 tracing:: info!( "Sentry is enabled! Check the load-generator project for errors: https://sentry.io/organizations/convex-dev/projects/load-generator/?project=6505624" ) ;
444+ sentry:: configure_scope ( |scope| {
445+ set_sentry_tags ( scope) ;
446+ } ) ;
443447 } else {
444448 tracing:: info!( "Sentry is not enabled." )
445449 }
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ use common::{
66 errors:: MainError ,
77 http:: ConvexHttpService ,
88 runtime:: Runtime ,
9+ sentry:: set_sentry_tags,
910 shutdown:: ShutdownSignal ,
1011 version:: SERVER_VERSION_STR ,
1112} ;
@@ -60,14 +61,15 @@ fn main() -> Result<(), MainError> {
6061 . map( |dsn| dsn. project_id( ) . to_string( ) )
6162 . unwrap_or( "unknown" . to_string( ) )
6263 ) ;
63- if let Some ( sentry_identifier ) = config . sentry_identifier . clone ( ) {
64- sentry :: configure_scope ( |scope| {
64+ sentry :: configure_scope ( |scope| {
65+ if let Some ( sentry_identifier ) = config . sentry_identifier . clone ( ) {
6566 scope. set_user ( Some ( sentry:: User {
6667 id : Some ( sentry_identifier) ,
6768 ..Default :: default ( )
6869 } ) ) ;
69- } ) ;
70- }
70+ }
71+ set_sentry_tags ( scope) ;
72+ } ) ;
7173 } else {
7274 tracing:: info!( "Sentry is not enabled." )
7375 }
You can’t perform that action at this time.
0 commit comments