Azure Api 管理:如何计算没有订阅的请求数量 Header

Azure Api Management: How to count amount of requests without Subscription Header

我的用户将 AAM API 端点用于需要 webhook 的 third-party 服务 - 我需要在用户报告中显示此端点的使用情况

Third-party API 不支持 header 并且我无法将 Ocp-Apim-Subscription-Key 用户订阅密钥传递给它,请求将被匿名调用。 据我了解,不允许在用户报告中计算该请求。

但我可以使用令牌 URI 参数手动获取 subscription-id 和它的密钥,使用 send-request 策略。 如果我这样做,是否有办法将 Ocp-Apim-Subscription-Key header 添加到 (运行?) 请求以代表用户订阅执行它?

到目前为止,我只能考虑将所需的请求包装在另一个 AAM 请求中,该请求将使用 send-requestset-header 这样的策略

> POST /endpoint/telegram/public/token123
>> <send-request>GET /token123/keys/primary</send-request>
> POST /endpoint/telegram/token123 +H 'Ocp-Apim-Subscription-Key:key123'

您可以尝试与 Application insight 集成以监控详细信息:How to integrate Azure API Management with Azure Application Insights

此外,您可以利用 metrices to analyze the request pattern

根据任何情况,您也可以创建警报来通知您:https://docs.microsoft.com/en-us/azure/api-management/api-management-howto-use-azure-monitor

隔了几天又回到这个问题,现在觉得很尴尬

要代表用户执行请求,我可以在查询中使用 API 键而不是 header,实际上有单独的设置

一切都解决了。