Azure / Azure/azure-functions-host
Custom telemetry not being linked to request in Javascript functions
- Dominant language
- C#
- Stars
- 2k
- Forks
- 482
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 36
Description
I am using javascript functions version 2.0.12763.0
application insights node sdk v 1.5.0
If i follow the code example in
https://docs.microsoft.com/en-us/azure/azure-functions/functions-monitoring#log-custom-telemetry-in-javascript-functions
```
const appInsights = require("applicationinsights");
appInsights.setup();
const client = appInsights.defaultClient;
module.exports = function (context, req) {
context.log('JavaScript HTTP trigger function processed a request.');
client.trackEvent({name: "my custom event", tagOverrides:{"ai.operation.id": context.invocationId}, properties: {customProperty2: "custom property value"}});
client.trackException({exception: new Error("handled exceptions can be logged with this method"), tagOverrides:{"ai.operation.id": context.invocationId}});
client.trackMetric({name: "custom metric", value: 3, tagOverrides:{"ai.operation.id": context.invocationId}});
client.trackTrace({message: "trace message", tagOverrides:{"ai.operation.id": context.invocationId}});
client.trackDependency({target:"http://dbname", name:"select customers proc", data:"SELECT * FROM Customers", duration:231, resultCode:0, success: true, dependencyTypeName: "ZSQL", tagOverrides:{"ai.operation.id": context.invocationId}});
client.trackRequest({name:"GET /customers", url:"http://myserver/customers", duration:309, resultCode:200, success:true, tagOverrides:{"ai.operation.id": context.invocationId}});
context.done();
};
```
then the custom telemetry is linked together but nothing was linked to the original request. Removing the invocationid override doesn't solve the issue. We would like to see the custom telemetry linked to the original request as it was in functions v1
I thought this issue would have been fixed with
https://github.com/Azure/azure-functions-host/issues/3747 but perhaps I misunderstood
Has this issue been resolved? If so, is there some example code?

**Httptrigger request not linked to custom telemetry**

Contributor guide
Research direction
Start with the JavaScript Functions monitoring example in the issue and compare its telemetry correlation behavior with the linked azure-functions-host issue 3747. Reproduce the HTTP-trigger case using the shown applicationinsights calls and determine what must change so custom telemetry is linked to the original request; done means the resulting telemetry has the expected request correlation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, javascript, node.js
- Domain
- observability
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100