From 0dbeb6622c71a7fb6c6dcb78b09f6e1c44a7804e Mon Sep 17 00:00:00 2001 From: Bastien Caudan Date: Fri, 7 Aug 2020 10:55:07 +0200 Subject: [PATCH 1/5] =?UTF-8?q?=E2=9C=A8=20add=20gov=20DC=20configuration?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/core/src/configuration.ts | 5 ++--- packages/core/src/init.ts | 10 ++++++++++ packages/logs/README.md | 2 +- packages/rum/README.md | 2 +- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/packages/core/src/configuration.ts b/packages/core/src/configuration.ts index 2bcc5fa3d6..bcac54d37b 100644 --- a/packages/core/src/configuration.ts +++ b/packages/core/src/configuration.ts @@ -1,4 +1,4 @@ -import { BuildEnv, BuildMode, Datacenter, SdkEnv } from './init' +import { BuildEnv, BuildMode, Datacenter, INTAKE_DOMAINS, SdkEnv } from './init' import { includes, ONE_KILO_BYTE, ONE_SECOND } from './utils' export const DEFAULT_CONFIGURATION = { @@ -187,8 +187,7 @@ export function buildConfiguration(userConfiguration: UserConfiguration, buildEn } function getEndpoint(type: string, conf: TransportConfiguration, source?: string) { - const tld = conf.datacenter === Datacenter.US ? 'com' : 'eu' - const domain = conf.sdkEnv === SdkEnv.PRODUCTION ? `datadoghq.${tld}` : `datad0g.${tld}` + const domain = conf.sdkEnv === SdkEnv.STAGING ? INTAKE_DOMAINS[SdkEnv.STAGING] : INTAKE_DOMAINS[conf.datacenter] const tags = `sdk_version:${conf.sdkVersion}` + `${conf.env ? `,env:${conf.env}` : ''}` + diff --git a/packages/core/src/init.ts b/packages/core/src/init.ts index 0cd227aad3..caae0449ca 100644 --- a/packages/core/src/init.ts +++ b/packages/core/src/init.ts @@ -25,11 +25,21 @@ export function makeGlobal(stub: T): T { export enum Datacenter { US = 'us', EU = 'eu', + GOV = 'gov', } + export enum SdkEnv { PRODUCTION = 'production', STAGING = 'staging', } + +export const INTAKE_DOMAINS = { + [Datacenter.EU]: 'datadoghq.eu', + [Datacenter.US]: 'datadoghq.com', + [Datacenter.GOV]: 'ddog-gov.com', + [SdkEnv.STAGING]: 'datad0g.com', +} + export enum BuildMode { RELEASE = 'release', STAGING = 'staging', diff --git a/packages/logs/README.md b/packages/logs/README.md index 49f7096c91..6b70e130be 100644 --- a/packages/logs/README.md +++ b/packages/logs/README.md @@ -40,7 +40,7 @@ What we call `Context` is a map `{key: value}` that will be added to the message - `isCollectingError`: when truthy, we'll automatically forward `console.error` logs, uncaught exceptions and network errors. - `sampleRate`: percentage of sessions to track. Only tracked sessions send logs. - - `datacenter`: defined to which datacenter we'll send collected data ('us' | 'eu') + - `datacenter`: defined to which datacenter we'll send collected data ('us' | 'eu' | 'gov') - `silentMultipleInit`: prevent logging errors while having multiple Init - `service`: name of the corresponding service - `env`: environment of the service diff --git a/packages/rum/README.md b/packages/rum/README.md index e32f42a197..82d94c2f17 100644 --- a/packages/rum/README.md +++ b/packages/rum/README.md @@ -38,7 +38,7 @@ datadogRum.init({ - `sampleRate`: percentage of sessions to track. Only tracked sessions send rum events. - `resourceSampleRate`: percentage of tracked sessions with resources collection. - - `datacenter`: defined to which datacenter we'll send collected data ('us' | 'eu') + - `datacenter`: defined to which datacenter we'll send collected data ('us' | 'eu' | 'gov') - `silentMultipleInit`: prevent logging errors while having multiple Init - `trackInteractions`: collect actions initiated by user interactions - `service`: name of the corresponding service From c4c29032a52924a33dc3c13fa3f0f14d77acf265 Mon Sep 17 00:00:00 2001 From: Bastien Caudan Date: Fri, 7 Aug 2020 11:29:16 +0200 Subject: [PATCH 2/5] =?UTF-8?q?=E2=9C=A8=20build=20and=20deploy=20file=20w?= =?UTF-8?q?ithout=20DC=20suffix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitlab-ci.yml | 12 ++++++++---- README.md | 16 +++++++--------- packages/logs/README.md | 4 ++-- packages/logs/webpack.config.js | 5 ++++- packages/rum/README.md | 4 ++-- packages/rum/webpack.config.js | 5 ++++- scripts/deploy.sh | 8 ++++++-- test/static/async-e2e-page.html | 4 ++-- test/static/bundle-e2e-page.html | 4 ++-- 9 files changed, 37 insertions(+), 25 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fdb0982487..d49c823f6e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -168,10 +168,12 @@ deploy-staging: image: $CI_IMAGE script: - yarn - - TARGET_DATACENTER=eu TARGET_ENV=staging BUILD_MODE=staging yarn build:bundle + - WITH_SUFFIX=true TARGET_DATACENTER=eu TARGET_ENV=staging BUILD_MODE=staging yarn build:bundle - ./scripts/deploy.sh staging eu - - TARGET_DATACENTER=us TARGET_ENV=staging BUILD_MODE=staging yarn build:bundle + - WITH_SUFFIX=true TARGET_DATACENTER=us TARGET_ENV=staging BUILD_MODE=staging yarn build:bundle - ./scripts/deploy.sh staging us + - TARGET_DATACENTER=us TARGET_ENV=staging BUILD_MODE=staging yarn build:bundle + - ./scripts/deploy.sh staging deploy-release: only: @@ -184,10 +186,12 @@ deploy-release: image: $CI_IMAGE script: - yarn - - TARGET_DATACENTER=us TARGET_ENV=production BUILD_MODE=release yarn build:bundle + - WITH_SUFFIX=true TARGET_DATACENTER=us TARGET_ENV=production BUILD_MODE=release yarn build:bundle - ./scripts/deploy.sh prod us - - TARGET_DATACENTER=eu TARGET_ENV=production BUILD_MODE=release yarn build:bundle + - WITH_SUFFIX=true TARGET_DATACENTER=eu TARGET_ENV=production BUILD_MODE=release yarn build:bundle - ./scripts/deploy.sh prod eu + - TARGET_DATACENTER=us TARGET_ENV=production BUILD_MODE=release yarn build:bundle + - ./scripts/deploy.sh prod ######################################################################################################################## # Notify diff --git a/README.md b/README.md index 688103e99d..f2e2ee7fa7 100644 --- a/README.md +++ b/README.md @@ -6,11 +6,11 @@ The browser SDK is used to collect logs and RUM data from the browser. This repository contains several packages: -| Package | npm | size | cdn | doc | -| ------------ | ------------------------ | ------------------------ | ----------------- | ----------------------------------- | -| browser-logs | [![npm version][01]][02] | [![bundle size][03]][04] | [us][05] [eu][06] | [![API][1]][07] [![product][2]][08] | -| browser-rum | [![npm version][11]][12] | [![bundle size][13]][14] | [us][15] [eu][16] | [![API][1]][17] [![product][2]][18] | -| browser-core | [![npm version][21]][22] | [![bundle size][23]][24] | | +| Package | npm | size | cdn | doc | +| ------------ | ------------------------ | ------------------------ | ------------------ | ----------------------------------- | +| browser-logs | [![npm version][01]][02] | [![bundle size][03]][04] | [datadog-logs][05] | [![API][1]][07] [![product][2]][08] | +| browser-rum | [![npm version][11]][12] | [![bundle size][13]][14] | [datadog-rum][15] | [![API][1]][17] [![product][2]][18] | +| browser-core | [![npm version][21]][22] | [![bundle size][23]][24] | | [1]: https://github.githubassets.com/favicons/favicon.png [2]: https://imgix.datadoghq.com/img/favicons/favicon-32x32.png @@ -18,16 +18,14 @@ This repository contains several packages: [02]: https://badge.fury.io/js/%40datadog%2Fbrowser-logs [03]: https://badgen.net/bundlephobia/minzip/@datadog/browser-logs [04]: https://bundlephobia.com/result?p=@datadog/browser-logs -[05]: https://www.datadoghq-browser-agent.com/datadog-logs-us.js -[06]: https://www.datadoghq-browser-agent.com/datadog-logs-eu.js +[05]: https://www.datadoghq-browser-agent.com/datadog-logs.js [07]: ./packages/logs/README.md [08]: https://docs.datadoghq.com/logs/log_collection/javascript/?tab=npm [11]: https://badge.fury.io/js/%40datadog%2Fbrowser-rum.svg [12]: https://badge.fury.io/js/%40datadog%2Fbrowser-rum [13]: https://badgen.net/bundlephobia/minzip/@datadog/browser-rum [14]: https://bundlephobia.com/result?p=@datadog/browser-rum -[15]: https://www.datadoghq-browser-agent.com/datadog-rum-us.js -[16]: https://www.datadoghq-browser-agent.com/datadog-rum-eu.js +[15]: https://www.datadoghq-browser-agent.com/datadog-rum.js [17]: ./packages/rum/README.md [18]: https://docs.datadoghq.com/real_user_monitoring/ [21]: https://badge.fury.io/js/%40datadog%2Fbrowser-core.svg diff --git a/packages/logs/README.md b/packages/logs/README.md index 6b70e130be..526c9321ef 100644 --- a/packages/logs/README.md +++ b/packages/logs/README.md @@ -21,7 +21,7 @@ datadogLogs.init({ ### Bundle ``` - + - +