Skip to content

Commit

Permalink
added region using build time (#825)
Browse files Browse the repository at this point in the history
  • Loading branch information
BidishaMS authored Feb 6, 2024
1 parent 22302b4 commit 6f71ca3
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 4 deletions.
12 changes: 12 additions & 0 deletions gulpfile.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,17 @@ function setTelemetryTarget() {
.pipe(gulp.dest(path.join('src', 'common', 'telemetry-generated')));
}

function setCollectorEndpoint() {
const collectorEndpointSource = isOfficialBuild
? 'src/common/telemetry/collectorEndpointProd.ts'
: 'src/common/telemetry/collectorEndpointTip.ts';

return gulp
.src(collectorEndpointSource)
.pipe(rename('collectorEndpointConfiguration.ts'))
.pipe(gulp.dest(path.join('src', 'common', 'telemetry-generated')));
}


function compile() {
return gulp
Expand Down Expand Up @@ -345,6 +356,7 @@ const recompile = gulp.series(
translationsExport,
translationsImport,
setTelemetryTarget,
setCollectorEndpoint,
compile,
compileWeb,
compileWorker,
Expand Down
9 changes: 5 additions & 4 deletions src/common/OneDSLoggerTelemetry/oneDSLogger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {getExtensionType, getExtensionVersion} from "../../common/Utils";
import { EXTENSION_ID } from "../../client/constants";
import {OneDSCollectorEventName} from "./EventContants";
import { telemetryEventNames } from "../../web/client/telemetry/constants";
import { collectorEndpointUrl } from "../telemetry-generated/collectorEndpointConfiguration";

interface IInstrumentationSettings {
endpointURL: string;
Expand Down Expand Up @@ -133,7 +134,7 @@ export class OneDSLogger implements ITelemetryLogger{
private static getInstrumentationSettings(geo?:string): IInstrumentationSettings {
const region:string = "test"; // TODO: Remove it from here and replace it with value getting from build. Check gulp.mjs (setTelemetryTarget)
const instrumentationSettings:IInstrumentationSettings = {
endpointURL: 'https://self.pipe.aria.int.microsoft.com/OneCollector/1.0/',
endpointURL: collectorEndpointUrl,
instrumentationKey: 'bd47fc8d971f4283a6686ec46fd48782-bdef6c1c-75ab-417c-a1f7-8bbe21e12da6-7708'
};
switch (region) {
Expand All @@ -145,19 +146,19 @@ export class OneDSLogger implements ITelemetryLogger{
case 'preview':
switch (geo) {
case 'eu':
instrumentationSettings.endpointURL = '' //prod endpoint;
instrumentationSettings.endpointURL =collectorEndpointUrl,
instrumentationSettings.instrumentationKey = '' //prod key;
break;
default:
instrumentationSettings.endpointURL = '' //prod endpoint;
instrumentationSettings.endpointURL = collectorEndpointUrl,
instrumentationSettings.instrumentationKey = '' //prod key;
}
break;
case 'gov':
case 'high':
case 'dod':
case 'mooncake':
instrumentationSettings.endpointURL = '' //prod endpoint;
instrumentationSettings.endpointURL = collectorEndpointUrl,
instrumentationSettings.instrumentationKey = '' //prod key;
break;
case 'ex':
Expand Down
6 changes: 6 additions & 0 deletions src/common/telemetry/collectorEndpointProd.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*/

export const collectorEndpointUrl = 'https://mobile.events.data.microsoft.com/OneCollector/1.0/';
6 changes: 6 additions & 0 deletions src/common/telemetry/collectorEndpointTip.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*/

export const collectorEndpointUrl = 'https://self.pipe.aria.int.microsoft.com/OneCollector/1.0/';

0 comments on commit 6f71ca3

Please sign in to comment.