azure-webjobs-sdk: Continuous job not showing Functions in Dashboard
We have an Azure WebJob (3.x) running under an API App in Azure, all Core 2.1. It publishes fine, and runs, but doesn’t show any Functions or list the Function Invocations on the dashboard. Which is odd, because the console output for the job does show it detecting a function:
[10/17/2018 09:26:19 > fa7c81: SYS INFO] Run script 'run.cmd' with script host - 'WindowsScriptHost'
[10/17/2018 09:26:19 > fa7c81: SYS INFO] Status changed to Running
[10/17/2018 09:26:19 > fa7c81: INFO]
[10/17/2018 09:26:19 > fa7c81: INFO] D:\local\Temp\jobs\continuous\SubmissionJob\43ucb4rv.ipc>dotnet SubmissionJob.dll
[10/17/2018 09:26:21 > fa7c81: INFO] dbug: Microsoft.Extensions.Hosting.Internal.Host[1]
[10/17/2018 09:26:21 > fa7c81: INFO] Hosting starting
[10/17/2018 09:26:21 > fa7c81: INFO] info: Microsoft.Azure.WebJobs.Hosting.JobHostService[0]
[10/17/2018 09:26:21 > fa7c81: INFO] Starting JobHost
[10/17/2018 09:26:21 > fa7c81: INFO] info: Host.Startup[0]
[10/17/2018 09:26:21 > fa7c81: INFO] Found the following functions:
[10/17/2018 09:26:21 > fa7c81: INFO] SubmissionJob.Functions.ProcessQueueMessageAsync
[10/17/2018 09:26:21 > fa7c81: INFO]
[10/17/2018 09:26:21 > fa7c81: INFO] Application started. Press Ctrl+C to shut down.
[10/17/2018 09:26:21 > fa7c81: INFO] Hosting environment: QA
The Program.cs Program
class looks like this:
public static async Task Main(string[] args)
{
var builder = new HostBuilder()
.UseEnvironment(Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT"))
.ConfigureWebJobs(b =>
{
b.AddAzureStorageCoreServices()
.AddAzureStorage()
.AddServiceBus()
.AddEventHubs();
})
.ConfigureAppConfiguration(b =>
{
// Adding command line as a configuration source
b.AddCommandLine(args);
})
.ConfigureLogging((context, b) =>
{
b.SetMinimumLevel(LogLevel.Debug);
b.AddConsole();
// If this key exists in any config, use it to enable App Insights
var appInsightsKey = context.Configuration["APPINSIGHTS_INSTRUMENTATIONKEY"];
if (!string.IsNullOrEmpty(appInsightsKey))
{
b.AddApplicationInsights(o => o.InstrumentationKey = appInsightsKey);
}
})
.ConfigureServices((context, services) =>
{
services.AddAutoMapper();
services.AddMemoryCache();
services.AddDbContext<SubmissionsDbContext>(opts =>
opts.UseSqlServer(context.Configuration.GetConnectionString("DefaultConnection")));
// cloud services
services.AddTransient(s =>
CloudStorageAccount.Parse(
context.Configuration.GetConnectionString("AzureQueueConnectionString")));
services.AddTransient<IBlobReadService, AzureBlobReadService>();
services.AddSingleton<IBlobWriteService, AzureBlobWriteService>();
services.AddSingleton<IQueueWriteService, AzureQueueWriteService>();
// submission services
services.AddScoped<ISubmissionStatusService, SubmissionStatusService>();
services.AddSingleton<Functions, Functions>();
// job activator, required in webjobs sdk 3+
services.AddSingleton<IJobActivator>(new WebJobsActivator(services.BuildServiceProvider()));
})
.UseConsoleLifetime();;
var host = builder.Build();
using (host)
{
await host.RunAsync();
}
}
The Functions.cs has a method with the following signature:
public async Task ProcessQueueMessageAsync([QueueTrigger("operations")] CloudQueueMessage incomingMessage, TextWriter log)
…scm.azurewebsites.net/azurejobs/#/jobs/continuous/SubmissionJob shows
Continuous WebJob Details SubmissionJob Running Run command: run.cmd
But there’s no list of function invocations below it, and the job remains permanently in a Running state. If I go to the ‘Functions’ link in Kudu, it says there are no functions/function invocations to display.
Any thoughts?
The bulk of this worked fine in Framework 4.7, though the app builder was clearly different.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 7
- Comments: 18 (2 by maintainers)
@mathewc Since Azure Application Insights is the way this is supposed to be done in v3, how can I use Application Insights to see invocation by invocation results for a v3 WebJob like I used to in the Kudu dashboard?
Is there any news on whether this is gonna be addressed or not in a future release?
We’ve have some Webjobs configured to be manually triggered in the Dashboard but the new jobs no longer show up in the Kudu Dashboard.
We are experiencing the same problems with our webjob implementation. since upgrade to 3.0. Even if everything works the dashboard is very handy and miss it every second.
The dashboard also give you the message “Host is not running” which can cause some confusion.
The
AddDashboardLoggin()
depreciation suggests that it still works, but it doesn’t, it is quite misleading. And pointing to App Insights is not enough of an explanation.After some digging, I found that the doc for App Insights Integration was updated for WebJobs 3.x:
So I searched for a way to monitor functions through App Insights - check here for details - and ended up reproducing the history of executions with this request:
I hope this will help!
We rely on the dashboard for invoking failed jobs manually, anyway to do this now?