diff --git a/docs/add-extension/add-extension-layer-widget.asciidoc b/docs/add-extension/add-extension-layer-widget.asciidoc index 0e819d79..d7d4e555 100644 --- a/docs/add-extension/add-extension-layer-widget.asciidoc +++ b/docs/add-extension/add-extension-layer-widget.asciidoc @@ -35,6 +35,13 @@ tabindex="-1"> Terraform +
+
diff --git a/docs/add-extension/add-extension-layer.asciidoc b/docs/add-extension/add-extension-layer.asciidoc index 9b51baaf..c1c231c6 100644 --- a/docs/add-extension/add-extension-layer.asciidoc +++ b/docs/add-extension/add-extension-layer.asciidoc @@ -157,3 +157,35 @@ resource "aws_lambda_function" "your_lambda_function" { ---- // end::terraform-with-agent[] + +// tag::container-extension-only[] +To add the APM Extension to your container-based function extend the Dockerfile of your function image as follows: + +[source,Dockerfile] +---- +FROM docker.elastic.co/observability/apm-lambda-extension-IMAGE_ARCH:latest AS lambda-extension + +# FROM ... <-- this is the base image of your Lambda function + +COPY --from=lambda-extension /opt/elastic-apm-extension /opt/extensions/elastic-apm-extension + +# ... +---- +// end::container-extension-only[] + +// tag::container-with-agent[] +To add the APM Extension and the APM Agent to your container-based function extend the Dockerfile of your function image as follows: + +[source,Dockerfile] +---- +FROM docker.elastic.co/observability/apm-lambda-extension-IMAGE_ARCH:latest AS lambda-extension +AGENT_IMPORT + +# FROM ... <-- this is the base image of your Lambda function + +COPY --from=lambda-extension /opt/elastic-apm-extension /opt/extensions/elastic-apm-extension +AGENT_COPY + +# ... +---- +// end::container-with-agent[] diff --git a/docs/lambda-selector/lambda-attributes-selector.asciidoc b/docs/lambda-selector/lambda-attributes-selector.asciidoc index 8cbd5656..cab788bb 100644 --- a/docs/lambda-selector/lambda-attributes-selector.asciidoc +++ b/docs/lambda-selector/lambda-attributes-selector.asciidoc @@ -62,11 +62,24 @@ const updateLambdaAttributes = () => { lambdaAttributesUpdateListeners.forEach(listener => listener(region, arch)); }; +const replaceAgentDockerImageParams = async (importStatement, copyStatement) => { + const containerTab = document.getElementById("container-tab-layer"); + containerTab.innerHTML = containerTab.innerHTML.replace(/AGENT_IMPORT/, importStatement); + containerTab.innerHTML = containerTab.innerHTML.replace(/AGENT_COPY/, copyStatement); +} + +const updateExtensionDockerImageArch = (region, arch) => { + document.querySelectorAll(`[role="replaceLambdaArch"]`).forEach(span => { + span.innerHTML = arch; + }); +}; + const addArnGenerator = async (type, ghRepo, arnPattern) => { const tabs = document.getElementsByName("lambda-tabpanel"); const rgx = type === 'agent' ? /AGENT_ARN/ : /EXTENSION_ARN/; tabs.forEach(tab => { - tab.innerHTML = tab.innerHTML.replace(rgx, ``); + tab.innerHTML = tab.innerHTML.replace(rgx, ``) + .replace(/IMAGE_ARCH/, ``); }); var version = undefined; @@ -76,7 +89,7 @@ const addArnGenerator = async (type, ghRepo, arnPattern) => { const releases = await fetch(`https://api.github.com/repos/elastic/${ghRepo}/releases`).then(data => { return data.status >= 400 ? undefined : data.json(); }); - + if(releases){ var latestRelease = releases[0]; @@ -124,6 +137,9 @@ window.addEventListener("DOMContentLoaded", async () => { arnInputs.forEach(input => { input.addEventListener("change", e => updateLambdaAttributes()); }); + + lambdaAttributesUpdateListeners.push(updateExtensionDockerImageArch); + updateLambdaAttributes(); });