Skip to content

Commit

Permalink
feat: log endpoint path (#1160)
Browse files Browse the repository at this point in the history
  • Loading branch information
yogurtandjam authored Oct 16, 2024
1 parent 32586d8 commit ef79848
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/lib/analytics/datadog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@ import { datadogLogs } from '@datadog/browser-logs';
import { CURRENT_MODE } from '@/constants/networks';

const CLIENT_TOKEN = import.meta.env.VITE_DATADOG_CLIENT_TOKEN;
const PROXY_URL = import.meta.env.VITE_DATADOG_PROXY_URL;
const SERVICE_NAME = 'v4-web';
const LOGGER_NAME = 'v4-web';
const SITE_NAME = 'datadoghq.com';

const LOG_ENDPOINT_PATH = (PROXY_URL ?? '').endsWith('/') ? 'api/v2/logs' : '/api/v2/logs';

if (CLIENT_TOKEN) {
datadogLogs.init({
clientToken: CLIENT_TOKEN,
Expand All @@ -15,7 +18,7 @@ if (CLIENT_TOKEN) {
forwardErrorsToLogs: true,
sessionSampleRate: 100,
env: CURRENT_MODE,
proxy: import.meta.env.VITE_DATADOG_PROXY_URL,
proxy: PROXY_URL ? `${PROXY_URL}${LOG_ENDPOINT_PATH}` : undefined,
});
}

Expand Down

0 comments on commit ef79848

Please sign in to comment.