Skip to content

🎥 Make videos programmatically with React

add lambda insights link

Jonny Burgera775456d9f1b
diff --git a/packages/docs/docs/lambda/rendermediaonlambda.md b/packages/docs/docs/lambda/rendermediaonlambda.md
index f261a63f3d..797d949b93 100644
--- a/packages/docs/docs/lambda/rendermediaonlambda.md
+++ b/packages/docs/docs/lambda/rendermediaonlambda.md
@@ -366,15 +366,15 @@ A unique alphanumeric identifier for this render. Useful for obtaining status an
The S3 bucket name in which all files are being saved.
-### `cloudWatchLogs`
-
-_available from v3.2.10_
+### `cloudWatchLogs`<AvailableFrom v="3.2.10"/>
A link to CloudWatch (if you haven't disabled it) that you can visit to see the logs for the render.
-### `folderInS3Console`
+### `lambdaInsightsUrl`<AvailableFrom v="4.0.61"/>
+
+A link to the [Lambda insights](/docs/lambda/insights), if you enabled it.
-_available from v3.2.43_
+### `folderInS3Console`<AvailableFrom v="3.2.43"/>
A link to the folder in the AWS console where each chunk and render is located.
diff --git a/packages/docs/docs/lambda/renderstillonlambda.md b/packages/docs/docs/lambda/renderstillonlambda.md
index 146d5a7366..d25a958fa4 100644
--- a/packages/docs/docs/lambda/renderstillonlambda.md
+++ b/packages/docs/docs/lambda/renderstillonlambda.md
@@ -91,8 +91,9 @@ A callback function that gets called when the render starts, useful to obtain th
It receives an object with the following properties:
-- `cloudWatchLogs`: A link to the CloudWatch logs of the Lambda function, if you did not disable it.
- `renderId`: The ID of the render.
+- `cloudWatchLogs`: A link to the CloudWatch logs of the Lambda function, if you did not disable it.
+- `lambdaInsightsUrl`<AvailableFrom v="4.0.61" />: A link to the [Lambda insights](/docs/lambda/insights), if you enabled it.
Example usage:
@@ -120,9 +121,10 @@ const otherParameters: RenderStillOnLambdaInput = {
};
await renderStillOnLambda({
...otherParameters,
- onInit: ({ cloudWatchLogs, renderId }) => {
+ onInit: ({ cloudWatchLogs, renderId, lambdaInsightsUrl }) => {
console.log(console.log(`Render invoked with ID = ${renderId}`));
console.log(`CloudWatch logs (if enabled): ${cloudWatchLogs}`);
+ console.log(`Lambda Insights (if enabled): ${lambdaInsightsUrl}`);
},
});
```
diff --git a/packages/lambda/src/api/render-still-on-lambda.ts b/packages/lambda/src/api/render-still-on-lambda.ts
index 4f9e65d3f7..dbb842ca04 100644
--- a/packages/lambda/src/api/render-still-on-lambda.ts
+++ b/packages/lambda/src/api/render-still-on-lambda.ts
@@ -18,7 +18,10 @@ import {
import type {CostsInfo, OutNameInput, Privacy} from '../shared/constants';
import {DEFAULT_MAX_RETRIES, LambdaRoutines} from '../shared/constants';
import type {DownloadBehavior} from '../shared/content-disposition-header';
-import {getCloudwatchMethodUrl} from '../shared/get-aws-urls';
+import {
+ getCloudwatchMethodUrl,
+ getLambdaInsightsUrl,
+} from '../shared/get-aws-urls';
export type RenderStillOnLambdaInput = {
region: AwsRegion;
@@ -49,7 +52,11 @@ export type RenderStillOnLambdaInput = {
* @deprecated Renamed to `dumpBrowserLogs`
*/
dumpBrowserLogs?: boolean;
- onInit?: (data: {renderId: string; cloudWatchLogs: string}) => void;
+ onInit?: (data: {
+ renderId: string;
+ cloudWatchLogs: string;
+ lambdaInsightsUrl: string;
+ }) => void;
deleteAfter?: DeleteAfter | null;
} & Partial<ToOptions<typeof BrowserSafeApis.optionsMap.renderMediaOnLambda>>;
@@ -145,6 +152,10 @@ const renderStillOnLambdaRaw = async ({
rendererFunctionName: null,
renderId: payload.renderId,
}),
+ lambdaInsightsUrl: getLambdaInsightsUrl({
+ functionName,
+ region,
+ }),
});
}
},
diff --git a/packages/lambda/src/cli/commands/render/render.ts b/packages/lambda/src/cli/commands/render/render.ts
index fe63b38bbd..523e7c2767 100644
--- a/packages/lambda/src/cli/commands/render/render.ts
+++ b/packages/lambda/src/cli/commands/render/render.ts
@@ -241,6 +241,10 @@ export const renderCommand = async (
{indent: false, logLevel},
`CloudWatch logs (if enabled): ${res.cloudWatchLogs}`,
);
+ Log.verbose(
+ {indent: false, logLevel},
+ `Lambda insights (if enabled): ${res.lambdaInsightsLogs}`,
+ );
Log.verbose(
{indent: false, logLevel},
`Render folder: ${res.folderInS3Console}`,
diff --git a/packages/lambda/src/cli/commands/still.ts b/packages/lambda/src/cli/commands/still.ts
index 5e1e8d18e8..22a49e626f 100644
--- a/packages/lambda/src/cli/commands/still.ts
+++ b/packages/lambda/src/cli/commands/still.ts
@@ -160,12 +160,16 @@ export const stillCommand = async (
scale,
forceHeight: height,
forceWidth: width,
- onInit: ({cloudWatchLogs, renderId}) => {
+ onInit: ({cloudWatchLogs, renderId, lambdaInsightsUrl}) => {
Log.info(CliInternals.chalk.gray(`Render invoked with ID = ${renderId}`));
Log.verbose(
{indent: false, logLevel},
`CloudWatch logs (if enabled): ${cloudWatchLogs}`,
);
+ Log.verbose(
+ {indent: false, logLevel},
+ `Lambda Insights (if enabled): ${lambdaInsightsUrl}`,
+ );
},
deleteAfter,
});
diff --git a/packages/lambda/src/shared/get-aws-urls.ts b/packages/lambda/src/shared/get-aws-urls.ts
index 57bd63abb0..e9dd1b9648 100644
--- a/packages/lambda/src/shared/get-aws-urls.ts
+++ b/packages/lambda/src/shared/get-aws-urls.ts
@@ -35,6 +35,16 @@ export const getCloudwatchMethodUrl = ({
return cloudWatchUrlWithQuery({region, functionNameToUse, query});
};
+export const getLambdaInsightsUrl = ({
+ region,
+ functionName,
+}: {
+ region: AwsRegion;
+ functionName: string;
+}) => {
+ return `https://${region}.console.aws.amazon.com/cloudwatch/home?region=${region}#lambda-insights:functions/${functionName}`;
+};
+
export const getCloudwatchRendererUrl = ({
region,
functionName,