Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates to Artemis service & telemetry endpoints for gov clouds #906

Merged
merged 5 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/client/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ export async function activate(
const orgID = orgDetails.OrgId;
const artemisResponse = await fetchArtemisResponse(orgID, _telemetry);
if (artemisResponse) {
const { geoName } = artemisResponse[0];
oneDSLoggerWrapper.instantiate(geoName);
const { geoName, geoLongName } = artemisResponse[0];
oneDSLoggerWrapper.instantiate(geoName, geoLongName);
oneDSLoggerWrapper.getLogger().traceInfo(telemetryEventNames.DESKTOP_EXTENSION_INIT_CONTEXT, orgDetails);
}
})
Expand Down
14 changes: 11 additions & 3 deletions src/common/ArtemisService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ export async function getIntelligenceEndpoint(orgId: string, telemetry: ITelemet

// Function to fetch Artemis response
export async function fetchArtemisResponse(orgId: string, telemetry: ITelemetry, sessionID = '') {
const { tstUrl, preprodUrl, prodUrl } = convertGuidToUrls(orgId);
const endpoints = [tstUrl, preprodUrl, prodUrl];
const { tstUrl, preprodUrl, prodUrl, gccUrl, highUrl, mooncakeUrl, dodUrl } = convertGuidToUrls(orgId);
const endpoints = [tstUrl, preprodUrl, prodUrl, gccUrl, highUrl, mooncakeUrl, dodUrl];

const artemisResponse = await fetchIslandInfo(endpoints, telemetry, sessionID);

Expand Down Expand Up @@ -87,10 +87,18 @@ export function convertGuidToUrls(orgId: string) {
const tstUrl = `https://${domain}.${nonProdSegment}.organization.api.test.powerplatform.com/gateway/cluster?api-version=1`;
const preprodUrl = `https://${domain}.${nonProdSegment}.organization.api.preprod.powerplatform.com/gateway/cluster?api-version=1`;
const prodUrl = `https://${domainProd}.${prodSegment}.organization.api.powerplatform.com/gateway/cluster?api-version=1`;
const gccUrl = `https://${domain}.${nonProdSegment}.organization.api.gov.powerplatform.microsoft.us/gateway/cluster?api-version=1`;
const highUrl = `https://${domain}.${nonProdSegment}.organization.api.high.powerplatform.microsoft.us/gateway/cluster?api-version=1`;
const mooncakeUrl = `https://${domain}.${nonProdSegment}.organization.api.powerplatform.partner.microsoftonline.cn/gateway/cluster?app-version=1`;
const dodUrl = `https://${domain}.${nonProdSegment}.organization.api.appsplatform.us/gateway/cluster?app-version=1`;

return {
tstUrl,
preprodUrl,
prodUrl
prodUrl,
gccUrl,
highUrl,
mooncakeUrl,
dodUrl
};
}
33 changes: 28 additions & 5 deletions src/common/OneDSLoggerTelemetry/oneDSLogger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export class OneDSLogger implements ITelemetryLogger{
},
};

public constructor(geo?:string ) {
public constructor(geo?:string, geoLongName?:string ) {

this.appInsightsCore = new AppInsightsCore();
this.postChannel = new PostChannel();
Expand All @@ -93,7 +93,7 @@ export class OneDSLogger implements ITelemetryLogger{
httpXHROverride: this.fetchHttpXHROverride,
};

const instrumentationSetting : IInstrumentationSettings= OneDSLogger.getInstrumentationSettings(geo); // Need to replace with actual data
const instrumentationSetting : IInstrumentationSettings= OneDSLogger.getInstrumentationSettings(geo, geoLongName); // Need to replace with actual data

// Configure App insights core to send to collector
const coreConfig: IExtendedConfiguration = {
Expand Down Expand Up @@ -135,12 +135,26 @@ export class OneDSLogger implements ITelemetryLogger{
}
}

private static getInstrumentationSettings(geo?:string): IInstrumentationSettings {
private static getInstrumentationSettings(geo?:string, geoLongName?: string): IInstrumentationSettings {
const buildRegion:string = region;
const instrumentationSettings:IInstrumentationSettings = {
endpointURL: 'https://self.pipe.aria.int.microsoft.com/OneCollector/1.0/',
instrumentationKey: 'ffdb4c99ca3a4ad5b8e9ffb08bf7da0d-65357ff3-efcd-47fc-b2fd-ad95a52373f4-7402'
};
switch(geoLongName){
case 'usgov':
geo = 'gov';
break;
case 'usgovhigh':
geo = 'high';
break;
case 'usdod':
geo = 'dod';
break;
case 'china':
geo = 'mooncake';
break;
}
switch (buildRegion) {
case 'tie':
case 'test':
Expand Down Expand Up @@ -178,11 +192,20 @@ export class OneDSLogger implements ITelemetryLogger{
}
break;
case 'gov':
instrumentationSettings.endpointURL = 'https://tb.events.data.microsoft.com/OneCollector/1.0/',
instrumentationSettings.instrumentationKey = '2f217cb8f40440eeb8b0aa80a2be2f7e-e0ec7b51-d1bb-4d8c-83b1-cc77aaba9009-7472'
break;
case 'high':
instrumentationSettings.endpointURL = 'https://tb.events.data.microsoft.com/OneCollector/1.0/',
instrumentationSettings.instrumentationKey = '4a07e143372c46aabf3841dc4f0ef795-a753031e-2005-4282-9451-a086fea4234a-6942'
break;
case 'dod':
instrumentationSettings.endpointURL = 'https://pf.events.data.microsoft.com/OneCollector/1.0/',
instrumentationSettings.instrumentationKey = 'af47f3d608774379a53fa07cf36362ea-69701588-1aad-43ee-8b52-f71125849774-6656'
break;
case 'mooncake':
instrumentationSettings.endpointURL = '',
instrumentationSettings.instrumentationKey = '' //prod key;
instrumentationSettings.endpointURL = 'https://collector.azure.cn/OneCollector/1.0/',
instrumentationSettings.instrumentationKey = 'f9b6e63b5e394453ba8f58f7a7b9aea7-f38fcfa2-eb34-48bc-9ae2-61fba4abbd39-7390' //prod key;
break;
case 'ex':
case 'rx':
Expand Down
8 changes: 4 additions & 4 deletions src/common/OneDSLoggerTelemetry/oneDSLoggerWrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ export class oneDSLoggerWrapper {
private static instance: oneDSLoggerWrapper;
private static oneDSLoggerIntance : OneDSLogger;

private constructor(geo?: string) {
oneDSLoggerWrapper.oneDSLoggerIntance = new OneDSLogger(geo);
private constructor(geo?: string, geoLongName?: string) {
oneDSLoggerWrapper.oneDSLoggerIntance = new OneDSLogger(geo, geoLongName);
}


static getLogger(){
return this.instance;
}

static instantiate(geo?:string){
oneDSLoggerWrapper.instance = new oneDSLoggerWrapper(geo);
static instantiate(geo?:string, geoLongName?: string){
oneDSLoggerWrapper.instance = new oneDSLoggerWrapper(geo, geoLongName);
}

/// Trace info log
Expand Down