@@ -22,9 +22,11 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2222SOFTWARE.
2323*/
2424
25+ using System . Runtime . InteropServices ;
2526using System . Text . RegularExpressions ;
2627using Castle . MicroKernel . Registration ;
2728using Castle . Windsor ;
29+ using Sentry ;
2830
2931namespace OuterInnerResource . Pn
3032{
@@ -103,6 +105,49 @@ public void ConfigureOptionsServices(
103105
104106 public void ConfigureDbContext ( IServiceCollection services , string connectionString )
105107 {
108+ SentrySdk . Init ( options =>
109+ {
110+ // A Sentry Data Source Name (DSN) is required.
111+ // See https://docs.sentry.io/product/sentry-basics/dsn-explainer/
112+ // You can set it in the SENTRY_DSN environment variable, or you can set it in code here.
113+ options . Dsn = "https://9bf9ba91ddb235518478803b2b202fc8@o4506241219428352.ingest.us.sentry.io/4508266875781120" ;
114+
115+ // When debug is enabled, the Sentry client will emit detailed debugging information to the console.
116+ // This might be helpful, or might interfere with the normal operation of your application.
117+ // We enable it here for demonstration purposes when first trying Sentry.
118+ // You shouldn't do this in your applications unless you're troubleshooting issues with Sentry.
119+ options . Debug = false ;
120+
121+ // This option is recommended. It enables Sentry's "Release Health" feature.
122+ options . AutoSessionTracking = true ;
123+
124+ // This option is recommended for client applications only. It ensures all threads use the same global scope.
125+ // If you're writing a background service of any kind, you should remove this.
126+ options . IsGlobalModeEnabled = true ;
127+
128+ // This option will enable Sentry's tracing features. You still need to start transactions and spans.
129+ options . EnableTracing = true ;
130+ } ) ;
131+
132+ string pattern = @"Database=(\d+)_eform-angular-outer-inner-resource-plugin;" ;
133+ Match match = Regex . Match ( connectionString ! , pattern ) ;
134+
135+ if ( match . Success )
136+ {
137+ string numberString = match . Groups [ 1 ] . Value ;
138+ int number = int . Parse ( numberString ) ;
139+ SentrySdk . ConfigureScope ( scope =>
140+ {
141+ scope . SetTag ( "customerNo" , number . ToString ( ) ) ;
142+ Console . WriteLine ( "customerNo: " + number ) ;
143+ scope . SetTag ( "osVersion" , Environment . OSVersion . ToString ( ) ) ;
144+ Console . WriteLine ( "osVersion: " + Environment . OSVersion ) ;
145+ scope . SetTag ( "osArchitecture" , RuntimeInformation . OSArchitecture . ToString ( ) ) ;
146+ Console . WriteLine ( "osArchitecture: " + RuntimeInformation . OSArchitecture ) ;
147+ scope . SetTag ( "osName" , RuntimeInformation . OSDescription ) ;
148+ Console . WriteLine ( "osName: " + RuntimeInformation . OSDescription ) ;
149+ } ) ;
150+ }
106151 _connectionString = connectionString ;
107152 services . AddDbContext < OuterInnerResourcePnDbContext > ( o =>
108153 o . UseMySql ( connectionString , new MariaDbServerVersion (
0 commit comments