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

Fix azure functions consumption initialization #3244

Merged
merged 2 commits into from
Aug 23, 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
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,20 @@ private DiagnosticsHelper() {}
}

public static void initRpIntegration(Path agentPath) {
if (!Strings.isNullOrEmpty(System.getenv("WEBSITE_SITE_NAME"))) {
// important to check FUNCTIONS_WORKER_RUNTIME before WEBSITE_SITE_NAME
// TODO (heya) how should we report functions windows users who are using app services
// windows attach by manually setting the env vars (which was the old documented way)
if ("java".equals(System.getenv("FUNCTIONS_WORKER_RUNTIME"))) {
rpIntegrationChar = 'f';
functionsRpIntegration = true;
setRpAttachType(agentPath, "functions.codeless");
} else if (!Strings.isNullOrEmpty(System.getenv("WEBSITE_SITE_NAME"))) {
rpIntegrationChar = 'a';
appSvcRpIntegration = true;
setRpAttachType(agentPath, "appsvc.codeless");
} else if (!Strings.isNullOrEmpty(System.getenv("KUBERNETES_SERVICE_HOST"))) {
rpIntegrationChar = 'k';
setRpAttachType(agentPath, "aks.codeless");
} else if ("java".equals(System.getenv("FUNCTIONS_WORKER_RUNTIME"))) {
rpIntegrationChar = 'f';
functionsRpIntegration = true;
setRpAttachType(agentPath, "functions.codeless");
} else if (!Strings.isNullOrEmpty(
System.getenv("APPLICATIONINSIGHTS_SPRINGCLOUD_SERVICE_ID"))) {
rpIntegrationChar = 's';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ public void transform(TypeTransformer transformer) {
public static class ExecuteAdvice {
@Advice.OnMethodExit(suppress = Throwable.class)
public static void methodExit() {

if (System.getenv("AzureWebJobsStorage") == null) {
// specialization hasn't occurred yet, and this is just a fake warmup request
return;
}

AzureFunctions.configureOnce();
}
}
Expand Down