Changed javascipt exception tracker method..

This commit is contained in:
Cüneyt Şentürk
2022-11-21 16:26:13 +03:00
parent 8602a1f478
commit 1c93c7a11e
14 changed files with 263 additions and 79 deletions

View File

@ -0,0 +1 @@
// Will added as soon as possible

View File

@ -0,0 +1,34 @@
import * as Sentry from "@sentry/vue";
import { BrowserTracing } from "@sentry/tracing";
export default {
install(Vue) {
alert(exception_tracker.params.traces_sample_rate);
Sentry.init({
Vue,
dsn: exception_tracker.action,
logErrors: true,
integrations: [
new BrowserTracing({
tracingOrigins: [],
}),
],
// Set tracesSampleRate to 1.0 to capture 100%
// of transactions for performance monitoring.
// We recommend adjusting this value in production
tracesSampleRate: exception_tracker.params.traces_sample_rate,
});
Sentry.setUser({
id: exception_tracker.user.id,
username: exception_tracker.user.name,
email: exception_tracker.user.email,
ip_address: exception_tracker.ip,
});
for (const [key, value] of Object.entries(exception_tracker.tags)) {
Sentry.setTag(key, value);
}
}
}

View File

@ -38,30 +38,20 @@ import GLightbox from 'glightbox';
Swiper.use([Navigation, Pagination]);
//sentry integration
import * as Sentry from "@sentry/vue";
import { BrowserTracing } from "@sentry/tracing";
import Bugsnag from './../exceptions/trackers/bugsnag';
import Sentry from './../exceptions/trackers/sentry';
if (sentry_dsn && sentry_dsn != '' && sentry_dsn != undefined) {
Sentry.init({
Vue,
dsn: sentry_dsn,
logErrors: true,
integrations: [
new BrowserTracing({
tracingOrigins: [],
}),
],
// Set tracesSampleRate to 1.0 to capture 100%
// of transactions for performance monitoring.
// We recommend adjusting this value in production
tracesSampleRate: 1.0,
});
Sentry.setUser(sentry_user[0]);
Sentry.setTag("sentry_tag", "here");
// Exception Tracket start here!!s
if (typeof exception_tracker != 'undefined') {
switch (exception_tracker.channel) {
case 'bugsnag':
Vue.use(Bugsnag);
break;
case 'sentry':
Vue.use(Sentry);
break;
}
}
//sentry integration
export default {
components: {

View File

@ -41,17 +41,10 @@
var url = '{{ url("/" . company_id()) }}';
var app_url = '{{ config("app.url") }}';
var aka_currency = {!! !empty($currency) ? $currency : 'false' !!};
var sentry_dsn = "https://9ffc5a5f104d4087911f60714e8bdbe9@o4503982427078656.ingest.sentry.io/4503999793594368";
var sentry_user = [
{
id: 34,
email: "burak@akaunting.com",
username: "brkcvn",
ip_address: "http://akaunting_v5.test/1"
}
]
//--></script>
<x-script.exceptions.trackers />
@stack('js')
<script type="text/javascript"><!--

View File

@ -61,9 +61,10 @@
var app_home = '{{ route("apps.home.index") }}';
var app_url = '{{ config("app.url") }}';
var aka_currency = {!! !empty($currency) ? $currency : 'false' !!};
var sentry_dsn = "https://9ffc5a5f104d4087911f60714e8bdbe9@o4503982427078656.ingest.sentry.io/4503999793594368";
//--></script>
<x-script.exceptions.trackers />
@stack('js')
<script type="text/javascript"><!--

View File

@ -40,9 +40,10 @@
var url = '{{ url("/" . company_id()) }}';
var app_url = '{{ config("app.url") }}';
var aka_currency = {!! !empty($currency) ? $currency : 'false' !!};
var sentry_dsn = "https://9ffc5a5f104d4087911f60714e8bdbe9@o4503982427078656.ingest.sentry.io/4503999793594368";
//--></script>
<x-script.exceptions.trackers />
@stack('js')
<script type="text/javascript"><!--

View File

@ -40,9 +40,10 @@
var url = '{{ url("/" . company_id()) }}';
var app_url = '{{ config("app.url") }}';
var aka_currency = {!! !empty($currency) ? $currency : 'false' !!};
var sentry_dsn = "https://9ffc5a5f104d4087911f60714e8bdbe9@o4503982427078656.ingest.sentry.io/4503999793594368";
//--></script>
<x-script.exceptions.trackers />
@stack('js')
<script type="text/javascript"><!--

View File

@ -40,9 +40,10 @@
var url = '{{ url("/" . company_id()) }}';
var app_url = '{{ config("app.url") }}';
var aka_currency = {!! !empty($currency) ? $currency : 'false' !!};
var sentry_dsn = "https://9ffc5a5f104d4087911f60714e8bdbe9@o4503982427078656.ingest.sentry.io/4503999793594368";
//--></script>
<x-script.exceptions.trackers />
@stack('js')
<script type="text/javascript"><!--

View File

@ -37,9 +37,10 @@
var url = '{{ url("/" . company_id()) }}';
var app_url = '{{ config("app.url") }}';
var aka_currency = {!! !empty($currency) ? $currency : 'false' !!};
var sentry_dsn = "https://9ffc5a5f104d4087911f60714e8bdbe9@o4503982427078656.ingest.sentry.io/4503999793594368";
//--></script>
<x-script.exceptions.trackers />
@stack('js')
<script type="text/javascript"><!--

View File

@ -0,0 +1,16 @@
@if (in_array($channel, ['bugsnag', 'sentry']))
<script type="text/javascript"><!--
var exception_tracker = {
channel: '{{ $channel }}',
action: '{{ $action }}',
user: {
id: '{{ user_id() }}',
name: '{{ user()?->name }}',
email: '{{ user()?->email }}',
},
ip: '{{ $ip }}',
tags: {!! json_encode($tags) !!},
params: {!! json_encode($params) !!},
};
//--></script>
@endif