Support & Documentation
Follow

Azure WebJobs: Overview & Installation

Retrace now supports Azure WebJobs.  Azure WebJobs provide an easy way to run scripts or programs as background processes in the context of an App Service web app, API app, or mobile app. Retrace will provide all of the same great insights to application performance as it does for web applications and windows services.

Within Retrace, WebJobs will be monitored in 'Other Apps' and will be listed as 'Azure WebJob".

 

RetraceOtherApps.jpg

 

 

Installation

Step 1: Add Site Extension in the Azure Portal

This is done just like it is for normal App Services with Retrace. For WebJobs, select your app and then go to Platform Features -> Extensions -> Add -> Select the Stackify APM or Retrace extension.

 

Step 2: Add  App Settings in the Azure Portal

Within your Function App, go to Platform Features -> Application Settings

Under "App settings" add these 3 settings:

  • Stackify.ApiKey= [client key]
  • COR_ENABLE_PROFILING=1
  • COR_PROFILER={de70e25c-02b5-4556-a837-8aa6fe502668}

Add one of the following, depending on if you are running the app in 32 or 64 bit mode:

  • COR_PROFILER_PATH=D:\home\Stackify\Profiler\v4.0.6.5\x86\StackifyProfiler_x86.dll

OR

  • COR_PROFILER_PATH=D:\home\Stackify\Profiler\v4.0.6.5\x64\StackifyProfiler_x64.dll

 

AzureAppSettings.jpg

 

Step 3: Create a "ProfileProcess.txt" file

This is a JSON formatted file that can define one or many EXEs to profile

[{
"exe": "WebJobContinuous.exe"
}]

You may save this file either:

  • In the same folder as the .exe that is being profiled. This would allow you to easily “bin deploy” the file with your app.

For continuous web jobs:
D:\home\site\wwwroot\app_data\jobs\continuous\[MyWebJob]\ProfileClientConfig.txt

For triggered web jobs:
D:\home\site\wwwroot\app_data\jobs\triggered\[MyWebJob]\ProfileClientConfig.txt

  • Into [Install Drive]:\Program Files (x86)\Stackify

 

Step 4: Define Operations to be Tracked

Tracking custom transactions is done by using the ProfilerTracer object within StackifyLib. This creates a defined operation from start to finish that can be named and tracked as a single operation.

 

Here is a simple code example:

  //Create a new ID for the operation for correlation
  Trace.CorrelationManager.ActivityId = Guid.NewGuid();
  //name the operation whatever you want
  var tracer = StackifyLib.ProfileTracer.CreateAsOperation("Operation Name", Trace.CorrelationManager.ActivityId.ToString());

  tracer.Exec(() =>   //FYI, async code is also supported via tracer.ExecAsync()
  {
      //Do some stuff here
  });

 

As always, if you are having problems getting profiling of an Azure WebJob to work correctly, feel free to reach out to our support team (support@stackify.com).

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Powered by Zendesk