Skip to content

Commit

Permalink
Tidy export page, make export lambda alarm on failure
Browse files Browse the repository at this point in the history
  • Loading branch information
philmcmahon committed Jan 10, 2025
1 parent c75c457 commit 6a5806f
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
23 changes: 23 additions & 0 deletions packages/cdk/lib/transcription-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ import { Topic } from 'aws-cdk-lib/aws-sns';
import { Queue } from 'aws-cdk-lib/aws-sqs';
import { JsonPath } from 'aws-cdk-lib/aws-stepfunctions';

const topicArnToName = (topicArn: string) => {
const split = topicArn.split(':');
return split[split.length - 1] ?? '';
};

export class TranscriptionService extends GuStack {
constructor(scope: App, id: string, props: GuStackProps) {
super(scope, id, props);
Expand Down Expand Up @@ -531,6 +536,8 @@ export class TranscriptionService extends GuStack {
},
).valueAsString;

const alarmTopicName = topicArnToName(alarmTopicArn);

const mediaDownloadTask = new GuEcsTask(this, 'media-download-task', {
app: mediaDownloadApp,
vpc,
Expand Down Expand Up @@ -693,6 +700,14 @@ export class TranscriptionService extends GuStack {
handler: 'index.outputHandler',
runtime: Runtime.NODEJS_20_X,
app: `${APP_NAME}-output-handler`,
errorPercentageMonitoring:
this.stage === 'PROD'
? {
toleratedErrorPercentage: 0,
noMonitoring: false,
snsTopicName: alarmTopicName,
}
: undefined,
},
);

Expand Down Expand Up @@ -737,6 +752,14 @@ export class TranscriptionService extends GuStack {
ephemeralStorageSize: Size.mebibytes(10240),
memorySize: 2048,
timeout: Duration.seconds(900),
errorPercentageMonitoring:
this.stage === 'PROD'
? {
toleratedErrorPercentage: 0,
noMonitoring: false,
snsTopicName: alarmTopicName,
}
: undefined,
},
);

Expand Down
8 changes: 4 additions & 4 deletions packages/client/src/components/ExportForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ const statusToMessage = (status: RequestStatus): string => {
case RequestStatus.CreatingFolder:
return "Export in progress... If nothing happens, make sure that your browser isn't blocking pop-ups.";
case RequestStatus.TranscriptExportInProgress:
return 'Transcript export in progress. Links to your files will soon appear below.';
return 'Export in progress. Links to your files will soon appear below.';
case RequestStatus.InProgress:
return `Export in progress. See below for links to your transcript files. Source media will take a little
longer - you can stay on this page or click the button to open the google drive folder and wait
for it to appear there.`;
return `Export in progress. See below for links to your transcript files. Source media may take several
minutes - you can stay on this page or click the button to open the google drive folder and wait
for it to appear there.`;
case RequestStatus.Ready:
default:
return '';
Expand Down

0 comments on commit 6a5806f

Please sign in to comment.