Bryan Lewis
Bryan Lewis

Reputation: 5977

Azure WebJobs and Queue Related Metrics

I have looked around the Azure portal and searched the net, but I have been unable to find an answer. Is there a way, perhaps via the api or powershell, to get metrics on webjobs? Such as average runtime per individual job? I would also like to find out the average queued time of a message that a webjob triggers from (though that is probably a storage metric not a webjob metric). Any pointers would be appreciated.

Upvotes: 1

Views: 390

Answers (2)

Thomas
Thomas

Reputation: 29736

As Igorek said, I don't think it is possible either. There are many tools to monitor application. Two of them have Azure integration:

I have used Application Insights to send metric from a webjob. You can follow this tutorial to setup Application insights n your webjob:

If you want to calculate the time to process a message from a queue, you can do something like that:

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);
}

Upvotes: 2

Igorek
Igorek

Reputation: 15860

Don't think this is possible without 3rd party services.. in fact, the only one I know that does this stuff specifically is CloudMonix, which I'm affiliated with.

Upvotes: 2

Related Questions