【问题标题】:Azure WebJobs and Queue Related MetricsAzure WebJobs 和队列相关指标
【发布时间】:2016-03-23 06:10:36
【问题描述】:

我浏览了 Azure 门户并搜索了网络,但我一直找不到答案。有没有办法,也许通过 api 或 powershell,来获取 webjobs 的指标?例如每个工作的平均运行时间?我还想找出 webjob 触发的消息的平均排队时间(尽管这可能是存储指标而不是 webjob 指标)。任何指针将不胜感激。

【问题讨论】:

    标签: azure azure-webjobs azureportal


    【解决方案1】:

    正如 Igorek 所说,我认为这也不可能。有许多工具可以监控应用程序。其中两个具有 Azure 集成:

    我使用 Application Insights 从网络作业发送指标。您可以按照本教程在您的网络作业中设置应用洞察:

    如果你想计算处理来自队列的消息的时间,你可以这样做:

    public async Task ProcessAsync([ServiceBusTrigger("queueName")] BrokeredMessage incommingMessage)
    {
        var stopwatch = Stopwatch.StartNew();
    
        // Process your message
        ...
    
        stopwatch.Stop();
    
        // You should only instantiate the TelemetryClient once in your application.
        var telemetryClient = new TelemetryClient() { InstrumentationKey = "MyInstrumentationKey"};
    
        //Send your metric
        telemetryClient.TrackMetric("ProcessQueueMessageElapsedTime", stopwatch.ElapsedMilliseconds);
    }
    

    【讨论】:

    • 谢谢托马斯。我确实在我们的网站上使用 AI 来获取一般指标,但我总是忘记我可以跟踪自定义指标。
    • 是的,我有时也会遇到同样的问题,因为我每天早上到达办公室前都会重置大脑 ^^
    【解决方案2】:

    不要认为如果没有 3rd 方服务这是可能的。事实上,我所知道的唯一一个专门做这件事的人是 CloudMonix,我隶属于它。

    【讨论】:

      猜你喜欢
      • 2014-12-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-04-16
      • 2014-12-09
      • 1970-01-01
      • 2015-09-27
      • 2020-05-04
      相关资源
      最近更新 更多