File tree Expand file tree Collapse file tree 3 files changed +48
-1
lines changed Expand file tree Collapse file tree 3 files changed +48
-1
lines changed Original file line number Diff line number Diff line change @@ -45,7 +45,20 @@ Optional settings
4545 release: ' 721e41770371db95eee98ca2707686226b993eda'
4646 }
4747
48- Can also be defined with ``Raven.setReleaseContext('721e41770371db95eee98ca2707686226b993eda') ``.
48+ Can also be defined with ``Raven.setRelease('721e41770371db95eee98ca2707686226b993eda') ``.
49+
50+ .. describe :: serverName
51+
52+ Typically this would be the server name, but that doesn’t exist on
53+ all platforms. Instead you may use something like the device ID, as it
54+ indicates the host which the client is running on.
55+
56+ .. code-block :: javascript
57+
58+ {
59+ serverName: device .uuid
60+ }
61+
4962
5063 .. describe :: tags
5164
Original file line number Diff line number Diff line change @@ -787,6 +787,8 @@ function send(data) {
787787
788788 // Include the release if it's defined in globalOptions
789789 if ( globalOptions . release ) data . release = globalOptions . release ;
790+ // Include server_name if it's defined in globalOptions
791+ if ( globalOptions . serverName ) data . server_name = globalOptions . serverName ;
790792
791793 if ( isFunction ( globalOptions . dataCallback ) ) {
792794 data = globalOptions . dataCallback ( data ) || data ;
Original file line number Diff line number Diff line change @@ -1176,6 +1176,38 @@ describe('globals', function() {
11761176 } ) ;
11771177 } ) ;
11781178
1179+ it ( 'should attach server_name if available' , function ( ) {
1180+ this . sinon . stub ( window , 'isSetup' ) . returns ( true ) ;
1181+ this . sinon . stub ( window , 'makeRequest' ) ;
1182+ this . sinon . stub ( window , 'getHttpData' ) . returns ( {
1183+ url : 'http://localhost/?a=b' ,
1184+ headers : { 'User-Agent' : 'lolbrowser' }
1185+ } ) ;
1186+
1187+ globalOptions = {
1188+ projectId : 2 ,
1189+ logger : 'javascript' ,
1190+ serverName : 'abc123' ,
1191+ } ;
1192+
1193+ send ( { foo : 'bar' } ) ;
1194+ assert . deepEqual ( window . makeRequest . lastCall . args [ 0 ] . data , {
1195+ project : '2' ,
1196+ server_name : 'abc123' ,
1197+ logger : 'javascript' ,
1198+ platform : 'javascript' ,
1199+ request : {
1200+ url : 'http://localhost/?a=b' ,
1201+ headers : {
1202+ 'User-Agent' : 'lolbrowser'
1203+ }
1204+ } ,
1205+ event_id : 'abc123' ,
1206+ foo : 'bar' ,
1207+ extra : { 'session:duration' : 100 }
1208+ } ) ;
1209+ } ) ;
1210+
11791211 it ( 'should pass correct opts to makeRequest' , function ( ) {
11801212 this . sinon . stub ( window , 'isSetup' ) . returns ( true ) ;
11811213 this . sinon . stub ( window , 'makeRequest' ) ;
You can’t perform that action at this time.
0 commit comments