为Azure Cognitive Services创建一个metric指标监控

监控指标

  1. In the Azure portal, in the page for your cognitive services resource, select Metrics (in the Monitoring section).
  2. If there is no existing chart, select + New chart. Then in the Metric list, review the possible metrics you can visualize and select Total Calls.
  3. In the Aggregation list, select Count. This will enable you to monitor the total calls to you Cognitive Service resource; which is useful in determining how much the service is being used over a period of time.
  4. To generate some requests to your cognitive service, you will use curl - a command line tool for HTTP requests. In Visual Studio Code, in the 03-monitor folder, open rest-test.cmd and edit the curl command it contains (shown below), replacing  and  with your endpoint URI and Key1 key to use the Text Analytics API in your cognitive services resource.
  5. Save your changes, and then in the integrated terminal for the 03-monitor folder, run the following command: rest-test 

测试方式为结果为:

使用curl 命令调用 endpoint 和 key

 curl -X POST "/text/analytics/v3.1/languages?" -H "Content-Type: application/json" -H "Ocp-Apim-Subscription-Key: " --data-ascii "{'documents':           [{'id':1,'text':'hello'}]}"

The command returns a JSON document containing information about the language detected in the input data (which should be English).

  1. Re-run the rest-test command multiple times to generate some call activity (you can use the ^ key to cycle through previous commands).
  2. Return to the Metrics page in the Azure portal and refresh the Total Calls count chart. It may take a few minutes for the calls you made using curl to be reflected in the chart - keep refreshing the chart until it updates to include them.

你可能感兴趣的:(azure,microsoft)