microsoft / ApplicationInsights-node.js

Microsoft Application Insights SDK for Node.js
MIT License
321 stars 138 forks source link

"applicationinsights 3.1.0" is not compatible with the "@azure/functions 4.5.0" #1332

Open balasphilip opened 1 month ago

balasphilip commented 1 month ago

Hello team,

I receive typescript compilation errors when trying to start my function locally. Please see the screenshots with the examples:

Screenshot at May 22 16-51-14 Screenshot at May 22 16-51-23 Screenshot at May 22 16-55-42
JacksonWeber commented 1 month ago

This package is not currently compatible with Azure Functions version 4.5.0. We have upstream support in progress in OpenTelemetry, and will update the thread here #1299.

balasphilip commented 3 weeks ago

Thank you for your answer.

This might be out of scope for this conversation, however, can you maybe point me out where to start if I want distributed tracing for my system? I use Azure Function Apps (HTTP, serviceBusTopic, and serviceBusQueue triggers), and Service Bus with both topics and queues respectively. I use Node.js runtime for Function Apps. One of the flows can be described as having my 1st function to send a message to Service Bus topic, and then 2nd function which works as serviceBusTopic trigger handles that message. I use @azure/monitor-opentelemetry package, and seems like both functions, producer and consumer, don't share/inherit a trace-id, resulting in 2 different uncorrelated transactions. Until I manually set a correlation_id and message_id for Service Bus message inside producer function. But it cannot be attached to every log/transaction automatically, so I can see only those log entries where I put that correlation_id explicitly.

Documentation seems quite vague to me. There is a lot of information about monitoring, application insights, opentelemetry, etc., however, it is hard to say where to start.

So first I tried adding applicationinsights npm package (basically the initial topic of this issue).

Then I tried @azure/monitor-opentelemetry (from the Docs: "The Distro enables automatic telemetry by including OpenTelemetry instrumentation libraries for collecting traces, metrics, logs, and exceptions, and allows collecting custom telemetry."), but I found that basic metrics and logs are being streamed by Function App even without that package. Moreover, I'm not quite sure this distro is suitable for Function Apps.

Then I found this post on StackOverflow which looks like a semi-answered.

I see there is also a @azure/opentelemetry-instrumentation-azure-sdk, and also I see that @azure/monitor-opentelemetry uses @azure/opentelemetry-instrumentation-azure-sdk under the hood.

So hoping for some helping hand here.

Thanks!