ApplicationInsights-node.js icon indicating copy to clipboard operation
ApplicationInsights-node.js copied to clipboard

"Test" mode for telemetry (i.e. write telemetry to console)?

Open philliphoff opened this issue 4 years ago • 5 comments

Is there a "test" mode for the gathering of telemetry that doesn't require setting a AI key for an existing Azure resource? That is, is there a way to see what AI would log (perhaps in the [debugging] console) without having to deploy anything to Azure?

The .NET SDK for Application Insights operates that way, where if a AI key is omitted then telemetry is logged to the console instead. This is useful for "inner loop" testing of applications as features and telemetry are added.

philliphoff avatar Mar 24 '21 23:03 philliphoff

@philliphoff there is a plan for this SDK to fully support Open Telemetry next semester, as part of that console OpenTelemetry exporter would be available more info here

hectorhdzg avatar Apr 23 '21 23:04 hectorhdzg

Is this something that is still on the roadmap? I ask as this issue has been open for a while and I was looking for this functionality.

PaulWild avatar Jan 14 '22 12:01 PaulWild

@philliphoff Following code will achieve what you are looking for with current version of the SDK

appInsights.setup("123").start();

appInsights.defaultClient.addTelemetryProcessor((envelope) => {
    console.log(envelope);
    return false; // Data will not be sent
});

hectorhdzg avatar Jan 20 '22 23:01 hectorhdzg

"123" as AI key Is valid ? @hectorhdzg or perhaps applications insights will be disabled as is an invalid key ?

jpolvora avatar Mar 17 '22 00:03 jpolvora

@jpolvora regex validating the iKey is available [here](https://github.com/microsoft/ApplicationInsights-node.js/blob/develop/Library/Config.ts#L198, "123" is not valid but you can use dummy ones like "00000000-0000-0000-0000-000000000000", the important part here would be the telemetry processors preventing all telemetry to be sent.

hectorhdzg avatar Mar 17 '22 17:03 hectorhdzg