Search code examples
azureazure-application-insightsnode-red

How to integrate Azure App Insight into Node-Red?


I want to collect some metrics from my Node-Red application using Azure App insight. I have already configured App functions and insight in Azure Resource Groups. I installed this library into my Node-Red application but I don't know how to use it and also I cannot find any guideline for that? Please let me know how can I properly integrate App insight into my Node-Red application? Thank you!


Solution

    • You need to add the code which includes Instrumentation key of Application Insights.

    • You can directly add the key in the settings.js file, which is available in the C:\Users\v****\.node-red Installed node-red path.

    • Define the function of ApplicationInsights under Node Settings => functionGlobalContext

    functionGlobalContext: {
        //Configure AppInsights
    },
    

    I have taken references from NodeJS SDK

    • But configuring in settings.js will effect all the applications.

    • If you want to configure it for your specific node-red app, check the below workaround.

    • Create a basic flow with Inject and Debug nodes, connect Inject with Debug Node.

    • And add a message by double clicking the Inject node => Deploy and check the output.

    enter image description here

    • Now add a new function node and include to configure Application Insights.

    • Connect Function node with Inject and Debug.

    enter image description here enter image description here