Skip to content

Commit 2457265

Browse files
committed
feat: add session sampling support to Grafana Faro
- Add QUICKPIZZA_CONF_FARO_SESSION_SAMPLE_RATE configuration option - Configure Faro sessionTracking with samplingRate parameter
1 parent 285d054 commit 2457265

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

pkg/web/src/hooks.client.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ function setupFaro() {
1414
const faroAppEnvironment = config.faro_app_environment || 'production';
1515
const faroInstrumentationEnableReplay =
1616
config.faro_instrumentation_enable_replay === 'true';
17+
const faroSessionSampleRate = config.faro_session_sample_rate
18+
? parseFloat(config.faro_session_sample_rate)
19+
: 1.0;
1720

1821
if (!url) {
1922
console.warn('Grafana Faro is not configured.');
@@ -39,7 +42,9 @@ function setupFaro() {
3942
);
4043
}
4144

42-
console.log(`Initializing Grafana Faro to '${url}'`);
45+
console.log(
46+
`Initializing Grafana Faro to '${url}' with session sample rate ${faroSessionSampleRate}`,
47+
);
4348
initializeFaro({
4449
url,
4550
app: {
@@ -49,6 +54,10 @@ function setupFaro() {
4954
environment: faroAppEnvironment,
5055
},
5156
instrumentations,
57+
sessionTracking: {
58+
enabled: true,
59+
samplingRate: faroSessionSampleRate,
60+
},
5261
});
5362
})
5463
.catch((e) => {

0 commit comments

Comments
 (0)