您现在的位置是:首页 >学无止境 >为Azure Cognitive Services创建一个metric指标监控网站首页学无止境

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

jack@london 2024-10-22 12:01:04
简介为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 <yourEndpoint> and <yourKey> 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 "<yourEndpoint>/text/analytics/v3.1/languages?" -H "Content-Type: application/json" -H "Ocp-Apim-Subscription-Key: <yourKey>" --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.

风语者!平时喜欢研究各种技术,目前在从事后端开发工作,热爱生活、热爱工作。