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

ARC-2316: start sending analytic events to SQS #2343

Merged
merged 2 commits into from
Aug 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions src/config/feature-flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export enum BooleanFlags {
ENABLE_GITHUB_SECURITY_IN_JIRA = "enable-github-security-in-jira",
DELETE_MESSAGE_ON_BACKFILL_WHEN_OTHERS_WORKING_ON_IT = "delete-message-on-backfill-when-others-working-on-it",
USE_NEW_5KU_SPA_EXPERIENCE = "enable-5ku-experience--cloud-connect",
SEND_ANALYTICS_TO_SQS = "send-analytics-to-sqs"
}

export enum StringFlags {
Expand Down
2 changes: 1 addition & 1 deletion src/github/push.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const pushWebhookHandler = async (context: WebhookContext, jiraClient, _u
const jiraHost = jiraClient.baseURL;
const gitHubAppId = context.gitHubAppConfig?.gitHubAppId;
const gitHubProduct = getCloudOrServerFromGitHubAppId(context.gitHubAppConfig?.gitHubAppId);
sendAnalytics(jiraHost, AnalyticsEventTypes.TrackEvent, {
await sendAnalytics(jiraHost, AnalyticsEventTypes.TrackEvent, {
action: AnalyticsTrackEventsEnum.CommitsPushedTrackEventName,
actionSubject: AnalyticsTrackEventsEnum.CommitsPushedTrackEventName,
source: !gitHubAppId ? AnalyticsTrackSource.Cloud : AnalyticsTrackSource.GitHubEnterprise
Expand Down
23 changes: 0 additions & 23 deletions src/routes/api/api-router.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import AWS from "aws-sdk";
import { NextFunction, Request, Response, Router } from "express";
import { body, param } from "express-validator";
import rateLimit from "express-rate-limit";
Expand All @@ -25,8 +24,6 @@ import { ApiResetSubscriptionFailedTasks } from "./api-reset-subscription-failed
import { RecoverCommitsFromDatePost } from "./commits-from-date/recover-commits-from-dates";
import { ResetFailedAndPendingDeploymentCursorPost } from "./commits-from-date/reset-failed-and-pending-deployment-cursors";
import { ApiRecryptPost } from "./api-recrypt-post";
import { envVars } from "config/env";
import { SendMessageRequest } from "aws-sdk/clients/sqs";
export const ApiRouter = Router();

// TODO: remove this duplication because of the horrible way to do logs through requests
Expand Down Expand Up @@ -146,26 +143,6 @@ const cryptorDebugEndpoint = async (_req: Request, resp: Response) => {
};
ApiRouter.use("/cryptor", cryptorDebugEndpoint);

// Temp code, TODO: :killwithfire:
const analyticsQueueConnectivityTest = async (req: Request, resp: Response) => {
req.log.info("starting connectivity test");
const sqs = new AWS.SQS({ apiVersion: "2012-11-05", region: envVars.SQS_INCOMINGANALYTICEVENTS_QUEUE_REGION });
const params: SendMessageRequest = {
MessageBody: JSON.stringify({ hello: "world" }),
QueueUrl: envVars.SQS_INCOMINGANALYTICEVENTS_QUEUE_URL,
DelaySeconds: 0
};
try {
const sendMessageResult = await sqs.sendMessage(params)
.promise();
req.log.info({ sendMessageResult }, "connectivity test succeeded!");
resp.sendStatus(200);
} catch (err) {
req.log.error({ err }, "connectivity test failed!");
}
};
ApiRouter.use("/analytics-queue-connectivity-test", analyticsQueueConnectivityTest);

ApiRouter.use("/db-migration", DBMigrationsRouter);
ApiRouter.post("/recover-client-key", RecoverClientKeyPost);
ApiRouter.post("/re-encrypt-ghes-app", ReEncryptGitHubServerAppKeysPost);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ export const GithubConfigurationGet = async (req: Request, res: Response, next:

req.log.info({ method: req.method, requestUrl: req.originalUrl }, `Request for type ${gitHubProduct}`);

sendAnalytics(jiraHost, AnalyticsEventTypes.ScreenEvent, {
await sendAnalytics(jiraHost, AnalyticsEventTypes.ScreenEvent, {
name: AnalyticsScreenEventsEnum.ConnectAnOrgScreenEventName
},
{
Expand Down
4 changes: 2 additions & 2 deletions src/routes/github/create-branch/github-create-branch-get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const GithubCreateBranchGet = async (req: Request, res: Response, next: N
configurationUrl: `${jiraHost}/plugins/servlet/ac/${envVars.APP_KEY}/github-select-product-page`
});

sendAnalytics(jiraHost, AnalyticsEventTypes.ScreenEvent, {
await sendAnalytics(jiraHost, AnalyticsEventTypes.ScreenEvent, {
name: AnalyticsScreenEventsEnum.NotConfiguredScreenEventName
}, {
jiraHost
Expand All @@ -74,7 +74,7 @@ export const GithubCreateBranchGet = async (req: Request, res: Response, next: N

req.log.debug(`Github Create Branch Page rendered page`);

sendAnalytics(jiraHost, AnalyticsEventTypes.ScreenEvent, {
await sendAnalytics(jiraHost, AnalyticsEventTypes.ScreenEvent, {
name: AnalyticsScreenEventsEnum.CreateBranchScreenEventName
}, {
jiraHost
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const GithubCreateBranchOptionsGet = async (req: Request, res: Response,
configurationUrl: `${jiraHost}/plugins/servlet/ac/${envVars.APP_KEY}/github-select-product-page`
});

sendAnalytics(jiraHost, AnalyticsEventTypes.ScreenEvent, {
await sendAnalytics(jiraHost, AnalyticsEventTypes.ScreenEvent, {
name: AnalyticsScreenEventsEnum.NotConfiguredScreenEventName
}, {
jiraHost
Expand Down Expand Up @@ -62,7 +62,7 @@ export const GithubCreateBranchOptionsGet = async (req: Request, res: Response,
servers
});

sendAnalytics(jiraHost, AnalyticsEventTypes.ScreenEvent, {
await sendAnalytics(jiraHost, AnalyticsEventTypes.ScreenEvent, {
name: AnalyticsScreenEventsEnum.CreateBranchOptionsScreenEventName
}, {
jiraHost
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export const GithubCreateBranchPost = async (req: Request, res: Response): Promi
res.sendStatus(200);

logger.info("Branch create successful.");
sendTrackEventAnalytics(AnalyticsTrackEventsEnum.CreateBranchSuccessTrackEventName, jiraHost);
await sendTrackEventAnalytics(AnalyticsTrackEventsEnum.CreateBranchSuccessTrackEventName, jiraHost);
const tags = {
name: newBranchName,
gitHubProduct: getCloudOrServerFromGitHubAppId(gitHubAppConfig.githubAppId)
Expand All @@ -74,15 +74,15 @@ export const GithubCreateBranchPost = async (req: Request, res: Response): Promi
} catch (err) {
logger.error({ err }, getErrorMessages(err.status));
res.status(err.status).json({ error: getErrorMessages(err.status) });
sendTrackEventAnalytics(AnalyticsTrackEventsEnum.CreateBranchErrorTrackEventName, jiraHost);
await sendTrackEventAnalytics(AnalyticsTrackEventsEnum.CreateBranchErrorTrackEventName, jiraHost);
statsd.increment(metricCreateBranch.failed, {
name: newBranchName
}, { jiraHost });
}
};

const sendTrackEventAnalytics = (name: string, jiraHost: string) => {
sendAnalytics(jiraHost, AnalyticsEventTypes.TrackEvent, {
const sendTrackEventAnalytics = async (name: string, jiraHost: string) => {
await sendAnalytics(jiraHost, AnalyticsEventTypes.TrackEvent, {
action: name,
actionSubject: name,
source: AnalyticsTrackSource.CreateBranch
Expand Down
4 changes: 2 additions & 2 deletions src/routes/github/manifest/github-manifest-complete-get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export const GithubManifestCompleteGet = async (req: Request, res: Response) =>

await tempStorage.delete(uuid, res.locals.installation.id);

sendAnalytics(res.locals.jiraHost, AnalyticsEventTypes.TrackEvent, {
await sendAnalytics(res.locals.jiraHost, AnalyticsEventTypes.TrackEvent, {
action: AnalyticsTrackEventsEnum.AutoCreateGitHubServerAppTrackEventName,
actionSubject: AnalyticsTrackEventsEnum.AutoCreateGitHubServerAppTrackEventName,
source: AnalyticsTrackSource.GitHubEnterprise
Expand All @@ -79,7 +79,7 @@ export const GithubManifestCompleteGet = async (req: Request, res: Response) =>
* And the rest of the queryParameters are simply forwarded to the new `retryUrl`
*/

sendAnalytics(res.locals.jiraHost, AnalyticsEventTypes.TrackEvent, {
await sendAnalytics(res.locals.jiraHost, AnalyticsEventTypes.TrackEvent, {
action: AnalyticsTrackEventsEnum.AutoCreateGitHubServerAppTrackEventName,
actionSubject: AnalyticsTrackEventsEnum.AutoCreateGitHubServerAppTrackEventName,
source: AnalyticsTrackSource.GitHubEnterprise
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export const JiraConnectEnterpriseAppCreateOrEditGet = async (
};
}

sendAnalytics(jiraHost, AnalyticsEventTypes.ScreenEvent, {
await sendAnalytics(jiraHost, AnalyticsEventTypes.ScreenEvent, {
name: AnalyticsScreenEventsEnum.CreateOrEditGitHubServerAppScreenEventName
}, {
isNew
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const JiraConnectEnterpriseAppDelete = async (

await GitHubServerApp.uninstallApp(gitHubAppConfig.uuid);

sendAnalytics(res.locals.jiraHost, AnalyticsEventTypes.TrackEvent, {
await sendAnalytics(res.locals.jiraHost, AnalyticsEventTypes.TrackEvent, {
action: AnalyticsTrackEventsEnum.DeleteGitHubServerAppTrackEventName,
actionSubject: AnalyticsTrackEventsEnum.DeleteGitHubServerAppTrackEventName,
source: AnalyticsTrackSource.GitHubEnterprise
Expand All @@ -31,7 +31,7 @@ export const JiraConnectEnterpriseAppDelete = async (
req.log.debug("Jira Connect Enterprise App deleted successfully.");
} catch (error) {

sendAnalytics(res.locals.jiraHost, AnalyticsEventTypes.TrackEvent, {
await sendAnalytics(res.locals.jiraHost, AnalyticsEventTypes.TrackEvent, {
action: AnalyticsTrackEventsEnum.DeleteGitHubServerAppTrackEventName,
actionSubject: AnalyticsTrackEventsEnum.DeleteGitHubServerAppTrackEventName,
source: AnalyticsTrackSource.GitHubEnterprise
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export const JiraConnectEnterpriseAppPost = async (

await new GheConnectConfigTempStorage().delete(uuid, installation.id);

sendAnalytics(jiraHost, AnalyticsEventTypes.TrackEvent, {
await sendAnalytics(jiraHost, AnalyticsEventTypes.TrackEvent, {
action: AnalyticsTrackEventsEnum.CreateGitHubServerAppTrackEventName,
actionSubject: AnalyticsTrackEventsEnum.CreateGitHubServerAppTrackEventName,
source: AnalyticsTrackSource.GitHubEnterprise
Expand All @@ -73,7 +73,7 @@ export const JiraConnectEnterpriseAppPost = async (
req.log.debug("Jira Connect Enterprise App added successfully.");
} catch (err) {

sendAnalytics(jiraHost, AnalyticsEventTypes.TrackEvent, {
await sendAnalytics(jiraHost, AnalyticsEventTypes.TrackEvent, {
action: AnalyticsTrackEventsEnum.CreateGitHubServerAppTrackEventName,
actionSubject: AnalyticsTrackEventsEnum.CreateGitHubServerAppTrackEventName,
source: AnalyticsTrackSource.GitHubEnterprise
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const JiraConnectEnterpriseAppPut = async (
: null
}, jiraHost);

sendAnalytics(res.locals.jiraHost, AnalyticsEventTypes.TrackEvent, {
await sendAnalytics(res.locals.jiraHost, AnalyticsEventTypes.TrackEvent, {
action: AnalyticsTrackEventsEnum.UpdateGitHubServerAppTrackEventName,
actionSubject: AnalyticsTrackEventsEnum.UpdateGitHubServerAppTrackEventName,
source: AnalyticsTrackSource.GitHubEnterprise
Expand All @@ -49,7 +49,7 @@ export const JiraConnectEnterpriseAppPut = async (
req.log.debug("Jira Connect Enterprise App updated successfully.");
} catch (error) {

sendAnalytics(res.locals.jiraHost, AnalyticsEventTypes.TrackEvent, {
await sendAnalytics(res.locals.jiraHost, AnalyticsEventTypes.TrackEvent, {
action: AnalyticsTrackEventsEnum.UpdateGitHubServerAppTrackEventName,
actionSubject: AnalyticsTrackEventsEnum.UpdateGitHubServerAppTrackEventName,
source: AnalyticsTrackSource.GitHubEnterprise
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const JiraConnectEnterpriseAppsGet = async (
// `identifier` is the githubAppName for the GH server app
const serverApps = gheServers.map(server => ({ identifier: server.gitHubAppName, uuid: server.uuid }));

sendScreenAnalytics({ jiraHost: res.locals.jiraHost, isNew, gheServers, name: AnalyticsScreenEventsEnum.SelectGitHubAppsListScreenEventName });
await sendScreenAnalytics({ jiraHost: res.locals.jiraHost, isNew, gheServers, name: AnalyticsScreenEventsEnum.SelectGitHubAppsListScreenEventName });
res.render("jira-select-server-app.hbs", {
list: serverApps,
pathNameForAddNew: "github-app-creation-page", // lol, this actually references the same endpoint, but with new flag :mindpop:
Expand All @@ -44,7 +44,7 @@ export const JiraConnectEnterpriseAppsGet = async (
serverUrl: baseUrl
});
} else {
sendScreenAnalytics({ jiraHost: res.locals.jiraHost, isNew, gheServers, name: AnalyticsScreenEventsEnum.SelectGitHubAppsCreationScreenEventName });
await sendScreenAnalytics({ jiraHost: res.locals.jiraHost, isNew, gheServers, name: AnalyticsScreenEventsEnum.SelectGitHubAppsCreationScreenEventName });
res.render("jira-select-app-creation.hbs", {
connectConfigUuid: tempConnectConfigUuidOrServerUuid
});
Expand All @@ -56,8 +56,8 @@ export const JiraConnectEnterpriseAppsGet = async (
}
};

const sendScreenAnalytics = ({ jiraHost, isNew, gheServers, name }) => {
sendAnalytics(jiraHost, AnalyticsEventTypes.ScreenEvent, {
const sendScreenAnalytics = async ({ jiraHost, isNew, gheServers, name }) => {
await sendAnalytics(jiraHost, AnalyticsEventTypes.ScreenEvent, {
name
}, {
createNew: isNew,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const JiraConnectEnterpriseDelete = async (

await GitHubServerApp.uninstallServer(req.body.serverUrl, installation.id);

sendAnalytics(res.locals.jiraHost, AnalyticsEventTypes.TrackEvent, {
await sendAnalytics(res.locals.jiraHost, AnalyticsEventTypes.TrackEvent, {
action: AnalyticsTrackEventsEnum.RemoveGitHubServerTrackEventName,
actionSubject: AnalyticsTrackEventsEnum.RemoveGitHubServerTrackEventName,
source: AnalyticsTrackSource.GitHubEnterprise
Expand All @@ -27,7 +27,7 @@ export const JiraConnectEnterpriseDelete = async (
req.log.debug("Jira Connect Enterprise Server successfully deleted.");
} catch (error) {

sendAnalytics(res.locals.jiraHost, AnalyticsEventTypes.TrackEvent, {
await sendAnalytics(res.locals.jiraHost, AnalyticsEventTypes.TrackEvent, {
action: AnalyticsTrackEventsEnum.RemoveGitHubServerTrackEventName,
actionSubject: AnalyticsTrackEventsEnum.RemoveGitHubServerTrackEventName,
source: AnalyticsTrackSource.GitHubEnterprise
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ export const JiraConnectEnterpriseGet = async (
uuid: servers[0].uuid
})).value();

sendScreenAnalytics({ jiraHost: res.locals.jiraHost, isNew, gheServers, name: AnalyticsScreenEventsEnum.SelectGitHubServerListScreenEventName });
await sendScreenAnalytics({ jiraHost: res.locals.jiraHost, isNew, gheServers, name: AnalyticsScreenEventsEnum.SelectGitHubServerListScreenEventName });
res.render("jira-select-server.hbs", {
list: servers,
// Passing these query parameters for the route when clicking `Connect a new server`
pathNameForAddNew: "github-server-url-page",
queryStringForPathNew: JSON.stringify({ new: 1 })
});
} else {
sendScreenAnalytics({ jiraHost: res.locals.jiraHost, isNew, gheServers, name: AnalyticsScreenEventsEnum.SelectGitHubServerUrlScreenEventName });
await sendScreenAnalytics({ jiraHost: res.locals.jiraHost, isNew, gheServers, name: AnalyticsScreenEventsEnum.SelectGitHubServerUrlScreenEventName });
res.render("jira-server-url.hbs", {
csrfToken: req.csrfToken(),
installationId: res.locals.installation.id,
Expand All @@ -45,8 +45,8 @@ export const JiraConnectEnterpriseGet = async (
}
};

const sendScreenAnalytics = ({ jiraHost, isNew, gheServers, name }) => {
sendAnalytics(jiraHost, AnalyticsEventTypes.ScreenEvent, {
const sendScreenAnalytics = async ({ jiraHost, isNew, gheServers, name }) => {
await sendAnalytics(jiraHost, AnalyticsEventTypes.ScreenEvent, {
name
}, {
createNew: isNew,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export const JiraConnectEnterprisePost = async (

await saveTempConfigAndRespond200(res, gitHubConnectConfig, installationId);

sendAnalytics(jiraHost, AnalyticsEventTypes.TrackEvent, {
await sendAnalytics(jiraHost, AnalyticsEventTypes.TrackEvent, {
action: AnalyticsTrackEventsEnum.GitHubServerUrlTrackEventName,
actionSubject: AnalyticsTrackEventsEnum.GitHubServerUrlTrackEventName,
source: AnalyticsTrackSource.GitHubEnterprise
Expand All @@ -166,7 +166,7 @@ export const JiraConnectEnterprisePost = async (
if (isResponseFromGhe(req.log, axiosError.response)) {
req.log.info({ err }, "Server is reachable, but responded with a status different from 200/202");
await saveTempConfigAndRespond200(res, gitHubConnectConfig, installationId);
sendAnalytics(jiraHost, AnalyticsEventTypes.TrackEvent, {
await sendAnalytics(jiraHost, AnalyticsEventTypes.TrackEvent, {
action: AnalyticsTrackEventsEnum.GitHubServerUrlTrackEventName,
actionSubject: AnalyticsTrackEventsEnum.GitHubServerUrlTrackEventName,
source: AnalyticsTrackSource.GitHubEnterprise
Expand Down
2 changes: 1 addition & 1 deletion src/routes/jira/connect/jira-connect-get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const JiraConnectGet = async (
try {
req.log.info("Received Jira Connect page request");

sendAnalytics(res.locals.jiraHost, AnalyticsEventTypes.ScreenEvent, {
await sendAnalytics(res.locals.jiraHost, AnalyticsEventTypes.ScreenEvent, {
name: AnalyticsScreenEventsEnum.SelectGitHubProductEventName
}, {
jiraHost: res.locals.jiraHost
Expand Down
2 changes: 1 addition & 1 deletion src/routes/jira/jira-delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export const JiraDelete = async (req: Request, res: Response): Promise<void> =>
}
await subscription.destroy();

sendAnalytics(jiraHost, AnalyticsEventTypes.TrackEvent, {
await sendAnalytics(jiraHost, AnalyticsEventTypes.TrackEvent, {
action: AnalyticsTrackEventsEnum.DisconnectToOrgTrackEventName,
actionSubject: AnalyticsTrackEventsEnum.DisconnectToOrgTrackEventName,
source: !gitHubAppId ? AnalyticsTrackSource.Cloud : AnalyticsTrackSource.GitHubEnterprise
Expand Down
2 changes: 1 addition & 1 deletion src/routes/jira/jira-get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ const renderJiraCloudAndEnterpriseServer = async (res: Response, req: Request):
const allSuccessfulConnections = [...successfulCloudConnections, ...gheServersWithConnections];
const completeConnections = allSuccessfulConnections.filter(connection => connection.syncStatus === "FINISHED");

sendAnalytics(jiraHost, AnalyticsEventTypes.ScreenEvent, {
await sendAnalytics(jiraHost, AnalyticsEventTypes.ScreenEvent, {
name: AnalyticsScreenEventsEnum.GitHubConfigScreenEventName
}, {
jiraHost,
Expand Down
4 changes: 2 additions & 2 deletions src/routes/jira/sync/jira-sync-post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const JiraSyncPost = async (req: Request, res: Response, next: NextFuncti
const { syncType, targetTasks } = await determineSyncTypeAndTargetTasks(syncTypeFromReq, subscription);
await findOrStartSync(subscription, req.log, syncType, commitsFromDate || subscription.backfillSince, targetTasks, { source });

sendAnalytics(res.locals.jiraHost, AnalyticsEventTypes.TrackEvent, {
await sendAnalytics(res.locals.jiraHost, AnalyticsEventTypes.TrackEvent, {
action: AnalyticsTrackEventsEnum.ManualRestartBackfillTrackEventName,
actionSubject: AnalyticsTrackEventsEnum.ManualRestartBackfillTrackEventName,
source: !gitHubAppId ? AnalyticsTrackSource.Cloud : AnalyticsTrackSource.GitHubEnterprise
Expand All @@ -51,7 +51,7 @@ export const JiraSyncPost = async (req: Request, res: Response, next: NextFuncti
res.sendStatus(202);
} catch (error) {

sendAnalytics(res.locals.jiraHost, AnalyticsEventTypes.TrackEvent, {
await sendAnalytics(res.locals.jiraHost, AnalyticsEventTypes.TrackEvent, {
action: AnalyticsTrackEventsEnum.ManualRestartBackfillTrackEventName,
actionSubject: AnalyticsTrackEventsEnum.ManualRestartBackfillTrackEventName,
source: !gitHubAppId ? AnalyticsTrackSource.Cloud : AnalyticsTrackSource.GitHubEnterprise
Expand Down
4 changes: 2 additions & 2 deletions src/services/subscription-installation-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export const verifyAdminPermsAndFinishInstallation =
]
);

sendAnalytics(installation.jiraHost, AnalyticsEventTypes.TrackEvent, {
await sendAnalytics(installation.jiraHost, AnalyticsEventTypes.TrackEvent, {
action: AnalyticsTrackEventsEnum.ConnectToOrgTrackEventName,
actionSubject: AnalyticsTrackEventsEnum.ConnectToOrgTrackEventName,
source: !gitHubServerAppIdPk ? AnalyticsTrackSource.Cloud : AnalyticsTrackSource.GitHubEnterprise
Expand All @@ -138,7 +138,7 @@ export const verifyAdminPermsAndFinishInstallation =
return {};
} catch (err) {

sendAnalytics(installation.jiraHost, AnalyticsEventTypes.TrackEvent, {
await sendAnalytics(installation.jiraHost, AnalyticsEventTypes.TrackEvent, {
action: AnalyticsTrackEventsEnum.ConnectToOrgTrackEventName,
actionSubject: AnalyticsTrackEventsEnum.ConnectToOrgTrackEventName,
source: !gitHubServerAppIdPk ? AnalyticsTrackSource.Cloud : AnalyticsTrackSource.GitHubEnterprise
Expand Down
2 changes: 1 addition & 1 deletion src/sync/installation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ const markSyncAsCompleteAndStop = async (data: BackfillMessagePayload, subscript
gitHubProduct,
repos: repoCountToBucket(subscription.totalNumberOfRepos)
}, { jiraHost: subscription.jiraHost });
sendAnalytics(subscription.jiraHost, AnalyticsEventTypes.TrackEvent, {
await sendAnalytics(subscription.jiraHost, AnalyticsEventTypes.TrackEvent, {
actionSubject: AnalyticsTrackEventsEnum.BackfullSyncOperationEventName,
action: "complete",
source: data.metricTags?.source || "worker"
Expand Down
Loading