Skip to content

Commit 70b86ab

Browse files
committed
Adding InvocationId to FunctionStartedEvent to allow for start/end correlation
1 parent b316665 commit 70b86ab

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

src/WebJobs.Script/Description/CSharp/CSharpFunctionInvoker.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ public override async Task Invoke(object[] parameters)
192192
ExecutionContext functionExecutionContext = (ExecutionContext)systemParameters[0];
193193
invocationId = functionExecutionContext.InvocationId.ToString();
194194

195-
startedEvent = new FunctionStartedEvent(Metadata);
195+
startedEvent = new FunctionStartedEvent(functionExecutionContext.InvocationId, Metadata);
196196
_metrics.BeginEvent(startedEvent);
197197

198198
TraceWriter.Verbose(string.Format("Function started (Id={0})", invocationId));

src/WebJobs.Script/Description/Node/NodeFunctionInvoker.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public override async Task Invoke(object[] parameters)
114114
ExecutionContext functionExecutionContext = (ExecutionContext)parameters[3];
115115
string invocationId = functionExecutionContext.InvocationId.ToString();
116116

117-
FunctionStartedEvent startedEvent = new FunctionStartedEvent(Metadata);
117+
FunctionStartedEvent startedEvent = new FunctionStartedEvent(functionExecutionContext.InvocationId, Metadata);
118118
_metrics.BeginEvent(startedEvent);
119119

120120
try

src/WebJobs.Script/Description/Script/ScriptFunctionInvoker.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ internal async Task ExecuteScriptAsync(string path, string arguments, object[] i
8686
ExecutionContext functionExecutionContext = (ExecutionContext)invocationParameters[3];
8787
string invocationId = functionExecutionContext.InvocationId.ToString();
8888

89-
FunctionStartedEvent startedEvent = new FunctionStartedEvent(Metadata);
89+
FunctionStartedEvent startedEvent = new FunctionStartedEvent(functionExecutionContext.InvocationId, Metadata);
9090
_metrics.BeginEvent(startedEvent);
9191

9292
// perform any required input conversions
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
11
// Copyright (c) .NET Foundation. All rights reserved.
22
// Licensed under the MIT License. See License.txt in the project root for license information.
33

4+
using System;
45
using Microsoft.Azure.WebJobs.Script.Description;
56

67
namespace Microsoft.Azure.WebJobs.Script.Diagnostics
78
{
89
public class FunctionStartedEvent : MetricEvent
910
{
10-
public FunctionStartedEvent(FunctionMetadata functionMetadata)
11+
public FunctionStartedEvent(Guid invocationId, FunctionMetadata functionMetadata)
1112
{
13+
InvocationId = invocationId;
1214
FunctionMetadata = functionMetadata;
1315
Success = true;
1416
}
1517

1618
public FunctionMetadata FunctionMetadata { get; private set; }
1719

20+
public Guid InvocationId { get; private set; }
21+
1822
public bool Success { get; set; }
1923
}
2024
}

0 commit comments

Comments
 (0)