I have an issue where I'm trying to add a new metric, but it's not showing up in my Application Insights metrics in the Azure Portal.
The example below describes issue where I'm trying to track a new metric called "Number of times asked" inside a bot dialog and increment it by 1 whenever a user reaches the dialog. For this example, timesAsked
is reset to 0
whenever the server restarts:
var appInsights = require('applicationinsights');
var telemetryModule = require('./telemetry-module.js');
appInsights.setup(process.env.APPINSIGHTS_INSTRUMENTATION_KEY).start();
var appInsightsClient = new appInsights.TelemetryClient();
var timesAsked = 0;
bot.dialog('Greeting', session => {
session.endDialog('Hi there!');
appInsightsClient.trackEvent({ name: 'Greeting', properties: session.message.text });
appInsightsClient.trackMetric({name: 'Number of times asked', properties: timesAsked++});
}).triggerAction({
matches: /^hi/i
});
Shouldn't this show up under Custom
inside my Applications Insights resource?
The only thing showing up here is duration
.
I've seen people having the similar issue a few years ago where their metrics did not show up in the Metrics Explorer before 5 days had passed. Is this still the case?