【发布时间】:2018-03-20 10:05:31
【问题描述】:
我在尝试添加新指标时遇到问题,但它没有显示在 Azure 门户的 Application Insights 指标中。
下面的示例描述了我试图在机器人对话框中跟踪名为“询问次数”的新指标并在用户到达对话框时将其递增 1 的问题。对于此示例,每当服务器重新启动时,timesAsked 都会重置为 0:
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
});
这不应该显示在我的 Applications Insights 资源中的Custom 下吗?
这里唯一出现的是duration。
几年前我看到人们遇到过类似的问题,他们的指标在 5 天过去之前没有出现在 Metrics Explorer 中。还是这样吗?
【问题讨论】:
标签: node.js azure-application-insights