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

Better Azure Functions consumption plan behavior #2397

Merged
merged 11 commits into from
Jul 20, 2022
Merged

Better Azure Functions consumption plan behavior #2397

merged 11 commits into from
Jul 20, 2022

Conversation

trask
Copy link
Member

@trask trask commented Jul 14, 2022

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
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
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
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
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
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
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
Copy link

lgtm-com bot commented Jul 19, 2022

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
Copy link

lgtm-com bot commented Jul 20, 2022

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