Azure / Azure/azure-functions-host

Worker logs missing "HostInstanceId" in telemetry

Open
#9,611 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
2k
Forks
482
Avg merge
2d 10h
Merged PRs (30d)
36

Description

I find that "HostInstanceId" is a useful property to investigate various incidents (either filtering by it or using it in a summarize). Unfortunately the "Worker." logs don't have that property, which are the main logs I normally care about for Node.js. This might be related to https://github.com/Azure/azure-functions-host/issues/9360, specifically I wonder if the "WebHost" vs "JobHost" problem which Brett mentioned to me offline could be the root cause of both.

Here's a query showing which categories set the HostInstanceId and which don't. There's quite a few that don't, although "Worker." ones are the ones I care about most.

Execute in [Web] [Desktop] [cluster('wawseus.kusto.windows.net').database('wawsprod')]

let st = datetime(2023-10-12T22:21:19.3921437Z);
let et = st + 1m;
let sn = "emjjs2";
FunctionsLogs
| where PreciseTimeStamp between (st .. et)
| where AppName =~ sn
| summarize count() by Source, HostInstanceId
| sort by count_ desc

Table0

Source | HostInstanceId | count_
-- | -- | --
Host.Startup | 914ddea7-4f62-4f2c-9032-d65ea8625e19 | 19
Worker.LanguageWorkerChannel.node.1aff96b3-0ab7-42ec-9be3-36e033feffb0 |   | 12
Host.LanguageWorkerConfig | 914ddea7-4f62-4f2c-9032-d65ea8625e19 | 11
Microsoft.Azure.WebJobs.Script.WebHost.Middleware.SystemTraceMiddleware |   | 10
Microsoft.Azure.WebJobs.Hosting.OptionsLoggingService | 914ddea7-4f62-4f2c-9032-d65ea8625e19 | 8
Host.General |   | 7
Microsoft.Azure.WebJobs.Script.WebHost.SecretManager |   | 6
Microsoft.Azure.WebJobs.Script.WebHost.Security.Authentication.ArmAuthenticationHandler |   | 5
Microsoft.Azure.WebJobs.Script.WebHost.Authentication.AuthenticationLevelHandler |   | 5
Microsoft.Azure.WebJobs.Script.WebHost.Management.FunctionsSyncManager |   | 5
Microsoft.Azure.WebJobs.Script.WorkerFunctionMetadataProvider |   | 3
Microsoft.Azure.WebJobs.Script.Workers.Rpc.RpcFunctionInvocationDispatcher | 914ddea7-4f62-4f2c-9032-d65ea8625e19 | 3
Microsoft.Azure.WebJobs.Script.WebHost.StartupContextProvider |   | 3
Host.Controllers.Host | 914ddea7-4f62-4f2c-9032-d65ea8625e19 | 3
Microsoft.Azure.WebJobs.Script.Workers.WorkerProfileManager |   | 2
Microsoft.Azure.WebJobs.Script.WebHost.FunctionMetadataProvider |   | 2
Microsoft.Azure.WebJobs.Script.HostFunctionMetadataProvider |   | 2
Microsoft.Azure.WebJobs.Script.WebHost.DefaultSecretManagerProvider |   | 2
Host.General | 914ddea7-4f62-4f2c-9032-d65ea8625e19 | 2
Microsoft.Azure.WebJobs.Host.IDistributedLockManager | 914ddea7-4f62-4f2c-9032-d65ea8625e19 | 1
Host.Triggers.Warmup | 914ddea7-4f62-4f2c-9032-d65ea8625e19 | 1
Microsoft.Azure.WebJobs.Hosting.JobHostService | 914ddea7-4f62-4f2c-9032-d65ea8625e19 | 1
Microsoft.Azure.WebJobs.Script.WebHost.WebScriptHostHttpRoutesManager | 914ddea7-4f62-4f2c-9032-d65ea8625e19 | 1
Microsoft.Azure.WebJobs.Script.WebHost.Middleware.ClrOptimizationMiddleware |   | 1
Microsoft.Azure.WebJobs.Script.WebHost.BlobStorageSecretsRepository |   | 1
Microsoft.Azure.WebJobs.Script.WebHost.Diagnostics.DiagnosticListenerService |   | 1

Contributor guide

Open the contributing guide

Research direction

Run the supplied FunctionsLogs query and compare Worker.LanguageWorkerChannel.node entries with categories that already contain HostInstanceId. Trace how WebHost and JobHost logging contexts are established, especially around the referenced WebHost/JobHost distinction. Done means the relevant Worker logs consistently include HostInstanceId without losing existing telemetry.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, csharp
Domain
observability
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.