0

Is there a way to enable developer mode in Application Insights for a react project. Looking at these docs and this previously asked question I've setup my config to look like this

if(process.env.NODE_ENV === 'development')
{
    config = {
        instrumentationKey: process.env.REACT_APP_AI_INSTRUMENTATION_KEY,
        extensions: [reactPlugin, clickPlugin],
        extensionConfig: {
            [clickPlugin.identifier]: clickPluginConfig,
            reactPlugin: {history: browserHistory}
        },
        // send telemetry immediately
        maxBatchInterval: 0,
        maxBatchSizeInBytes: 0,
        loggingLevelConsole: 2 // log internal app insights errors to console
    }
}

I expect that while running my project locally, telemetry will be sent to the portal much faster but there's still at least 10 minute delay between when I perform an action and when it appears in the Application Insights portal.

The developer mode docs specify Node.js runtime for javascript implementation. To be honest, I'm not sure what runtime a Create-React-App application uses, although I do believe it is Node.js.

Abeyance
  • 133
  • 1
  • 2
  • 7
Jordyn
  • 93
  • 10

1 Answers1

0

Yes! JavaScript code can be run outside of a browser using the (server-side) runtime environment offered by Node.js. The packages for either React or Angular are managed and shared using NPM, the Node package manager.


DeveloperMode merely indicates that no telemetry data is stored in memory by the SDK channel. Telemetry is typically cached in memory and pushed to the backend once every 30 seconds or when the buffer reaches 500 items. Simply put, every item is provided in developer mode without any buffering.

Based on backend/indexing/etc. delays, telemetry is often visible in the Azure portal in 3–10 minutes.

(Direct local data presentation is the goal of developer mode. that is, when debugging, Visual Studio itself shows telemetry. It is not necessary to explicitly activate this developer. Developer mode will automatically activate when a debugger is added.)


If your application uses aggregated data, it will take between 5 and 10 minutes to load. Additionally, we show a message on the Overview page of Application Insights on the portal when there is a processing delay. hkdeploy1 Also like, hkaggregateddatanodedeploy2

If the application is delayed more than 10 minutes, it might be issue with the processing pipeline or a detection problem on our side due to some glitch in configuration.

Update:

To get more control regarding MaxBatchSize and delay, you should initialize a new TelemetryConfiguration object and use it to create a client:

import "time"
import "github.com/microsoft/ApplicationInsights-Go/appinsights"

func main() {
    telemetryConfig := appinsights.NewTelemetryConfiguration("<instrumentation key>")
    
// Configure how many items can be sent in one call to the data collector:
telemetryConfig.MaxBatchSize = 8192

// Configure the maximum delay before sending queued telemetry:
telemetryConfig.MaxBatchInterval = 2 * time.Second

client := appinsights.NewTelemetryClientFromConfig(telemetryConfig)
}

For more information, refer here

  • So to clarify, the configurations (maxBatchSizeInBytes and maxBatchInterval) does not affect the latency and I need to be debugging in order to view the telemetry immediately locally in VSCode? – Jordyn Oct 11 '21 at 15:04
  • @Jordyn, You can manually configure how many items can be sent in one call to the data collector and the maximum delay before sending queued telemetry. It will not affect much the latency. Check the update in the answer. –  Oct 12 '21 at 08:21