We created a Azure function app and enabled AppInsight with default setup. We have a client SDK that will send request to this function app, which also uses AppInsight. In order to correlate the client side events with the server side events, we set 'Request-Id' header in the client request. However, on server side, AppInsight seems to ignore it and generates a new operationId on each request event.
To simplify the repo, we create a brand new function App with its default sample codes.
#r "Newtonsoft.Json"
using System.Net;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Primitives;
using Newtonsoft.Json;
public static async Task<IActionResult> Run(HttpRequest req, ILogger log)
{
log.LogInformation("C# HTTP trigger function processed a request.");
string name = req.Query["name"];
string requestBody = await new StreamReader(req.Body).ReadToEndAsync();
dynamic data = JsonConvert.DeserializeObject(requestBody);
name = name ?? data?.name;
return name != null
? (ActionResult)new OkObjectResult($"Hello, {name}")
: new BadRequestObjectResult("Please pass a name on the query string or in the request body");
}
Then in the Test panel, we run a test with the following headers
Then we check the request event, and the operationId is a random one, instead of the root id from the test reuqest.
Repro Steps
create a new Azure Func app and enable AppInsight
Add a new function with Http trigger, and use ,
In the Test panel of the function, run a test request with the headers
Request-Id:|9e74f0e5-efc4-41b5-86d1-3524a43bd891.bcec871c_1.
x-ms-request-id:|9e74f0e5-efc4-41b5-86d1-3524a43bd891.bcec871c_1.
Actual Behavior
When I checked the requests and traces events, they don't carry the root operaiton Id which is '9e74f0e5-efc4-41b5-86d1-3524a43bd891'. Instead, a random operation Id is used.
Expected Behavior
The requests/traces events should have operation_id='9e74f0e5-efc4-41b5-86d1-3524a43bd891'
Version Info
SDK Version : 2.7.2
.NET Version : default install by azure Function app
How Application was onboarded with SDK(VisualStudio/StatusMonitor/Azure Extension) : Azure Function App
OS :
Hosting Info (IIS/Azure WebApps/ etc) : Azure Function App
We created a Azure function app and enabled AppInsight with default setup. We have a client SDK that will send request to this function app, which also uses AppInsight. In order to correlate the client side events with the server side events, we set 'Request-Id' header in the client request. However, on server side, AppInsight seems to ignore it and generates a new operationId on each request event.
To simplify the repo, we create a brand new function App with its default sample codes.
Then in the Test panel, we run a test with the following headers
Then we check the request event, and the operationId is a random one, instead of the root id from the test reuqest.
Repro Steps
Actual Behavior
When I checked the requests and traces events, they don't carry the root operaiton Id which is '9e74f0e5-efc4-41b5-86d1-3524a43bd891'. Instead, a random operation Id is used.
Expected Behavior
The requests/traces events should have operation_id='9e74f0e5-efc4-41b5-86d1-3524a43bd891'
Version Info
SDK Version : 2.7.2 .NET Version : default install by azure Function app
How Application was onboarded with SDK(VisualStudio/StatusMonitor/Azure Extension) : Azure Function App OS : Hosting Info (IIS/Azure WebApps/ etc) : Azure Function App