Skip to content

Better Azure Functions consumption plan behavior#2397

Merged
trask merged 11 commits into
mainfrom
azure-functions
Jul 20, 2022
Merged

Better Azure Functions consumption plan behavior#2397
trask merged 11 commits into
mainfrom
azure-functions

Conversation

@trask

@trask trask commented Jul 14, 2022

Copy link
Copy Markdown
Member

No description provided.

@trask trask force-pushed the azure-functions branch 2 times, most recently from 6662e35 to 8f2a8f9 Compare July 14, 2022 20:20
@trask trask marked this pull request as ready for review July 14, 2022 20:21
@trask trask requested review from heyams and jeanbisutti as code owners July 14, 2022 20:21
public static class ExecuteAdvice {
@Advice.OnMethodExit(suppress = Throwable.class)
public static void methodExit() {
AzureFunctions.configureOnce();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to check any env vars before configure if i recalled correctly from the meeting with function team?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe those are the env vars that are checked inside of configureOnce()?

return;
}
if (instrumentation.removeTransformer(transformer)) {
ClassFileTransformerHolder.setClassFileTransformer(null);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this does the magic of shutting down bytecode instrumentation?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ya, I initially thought removeTransformer was enough, but otel javaagent also uses ClassFileTransformerHolder.getClassFileTransformer() to transform lambda classes (which don't go through normal bytecode instrumentation process), so that's why also need to set that to null

@trask trask force-pushed the azure-functions branch from c407677 to 3fad266 Compare July 19, 2022 01:20
void lazyLoad();
public static void configureOnce() {
if (configure != null) {
if (!hasConnectionString.get()) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might just reuse the method: !hasConnectionString()

if (DiagnosticsHelper.useFunctionsRpIntegrationLogging()) {
if (DiagnosticsHelper.isOsWindows()) {
// TODO (trask) is there a preference where this should go?
return DEFAULT_NAME;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

String tempDirectory = System.getProperty("java.io.tmpdir"),
tempDirectory + "/applicationinsights/applicationinsights.log"?

@lgtm-com

lgtm-com Bot commented Jul 19, 2022

Copy link
Copy Markdown

This pull request introduces 1 alert when merging ab9d25a into f0d550e - view on LGTM.com

new alerts:

  • 1 for Dereferenced variable may be null

@lgtm-com

lgtm-com Bot commented Jul 20, 2022

Copy link
Copy Markdown

This pull request introduces 1 alert when merging f26c2a1 into 18be244 - view on LGTM.com

new alerts:

  • 1 for Dereferenced variable may be null

@trask trask merged commit 694e21d into main Jul 20, 2022
@trask trask deleted the azure-functions branch July 20, 2022 23:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants