Skip to content

Commit 5150d28

Browse files
committed
Add debugid to Grafana log, and user information
1 parent c0d7e33 commit 5150d28

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

src/assets/Markdown Files/TODO-central-loader.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,10 @@
6868
- Load Yaml
6969

7070
For details and dates, please see the [GitHub log](https://github.com/vbakke/DevSecOps-MaturityModel/commits/experiment/).
71+
72+
## User tracking
73+
The Experimental edition, and the Experimental edition only, uses Grafana Frontend to log the console log to catch bugs, especially from mobile devices.
74+
75+
Geolocation is not enabled, so no user identifiable data is stored.
76+
77+
You may block this debug logging by using an ad-blocker.

src/main.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
33

44
import { AppModule } from './app/app.module';
55
import { environment } from './environments/environment';
6-
import { getWebInstrumentations, initializeFaro, LogLevel } from '@grafana/faro-web-sdk';
6+
import { faro, getWebInstrumentations, initializeFaro, LogLevel } from '@grafana/faro-web-sdk';
77
import { TracingInstrumentation } from '@grafana/faro-web-tracing';
88

99
const localDevelopment:boolean = (window.location.hostname == 'localhost');
@@ -37,6 +37,12 @@ if (environment?.experimental && !localDevelopment) {
3737
},
3838
});
3939

40+
// Identify specific sessions
41+
let debugid: string = (new URLSearchParams(location.search)).get('debugid') || '';
42+
if (debugid) localStorage.setItem('debugid', debugid);
43+
else debugid = localStorage.getItem('debugid') || '';
44+
faro.api.setUser({ attributes: {debugid}, });
45+
4046
}
4147

4248

0 commit comments

Comments
 (0)