Skip to content

Commit

Permalink
fix: no faro in dev (#1412)
Browse files Browse the repository at this point in the history
  • Loading branch information
derschnee68 committed Jan 31, 2024
1 parent c2db7bf commit 22ce0eb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
4 changes: 4 additions & 0 deletions libs/vre/shared/app-analytics/src/lib/grafana-faro.service.ts
Expand Up @@ -9,6 +9,10 @@ export class GrafanaFaroService {
constructor(private readonly _appConfig: AppConfigService) {}

setup() {
if (this._appConfig.dspInstrumentationConfig.environment === 'local-dev') {
return;
}

this.faro = initializeFaro({
url: 'https://faro-collector-prod-eu-west-2.grafana.net/collect/66166d1b81448a1cca47cde470d9ec98',
app: {
Expand Down
4 changes: 3 additions & 1 deletion libs/vre/shared/app-config/src/lib/app-config/app-config.ts
Expand Up @@ -14,10 +14,12 @@ export const Rollbar = z.discriminatedUnion('enabled', [
export type Rollbar = z.infer<typeof Rollbar>;

export const Instrumentation = z.object({
environment: z.string().nonempty("required 'environment' value missing in config"),
environment: z.enum(['local-dev', 'dev-server', 'test-server', 'ls-test-server', 'staging-server', 'prod']),
rollbar: Rollbar,
});

export type InstrumentationType = z.infer<typeof Instrumentation>;

/**
* Our codebase requires number | null. The config will contain either a number
* or an empty string. We need to transform the empty string case into a null.
Expand Down
Expand Up @@ -3,6 +3,8 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { InstrumentationType } from './app-config';

export class DspRollbarConfig {
constructor(
public enabled: boolean,
Expand All @@ -12,7 +14,7 @@ export class DspRollbarConfig {

export class DspInstrumentationConfig {
constructor(
public environment: string,
public environment: InstrumentationType['environment'],
public rollbar: DspRollbarConfig
) {}
}

0 comments on commit 22ce0eb

Please sign in to comment.