Azure API 管理中的可观测性Observability in Azure API Management

可观测性是指通过系统产生的数据了解系统内部状态的能力,以及探索这些数据以回答有关发生了什么事件及其原因的问题的能力。Observability is the ability to understand the internal state of a system from the data it produces and the ability to explore that data to answer questions about what happened and why.

Azure API 管理可以帮助组织集中管理所有 API。Azure API Management helps organizations centralize the management of all APIs. 由于它充当所有 API 流量的单一入口点,因此它是观测 API 的理想位置。Since it serves as a single point of entry of all API traffic, it is an ideal place to observe the APIs.

可观测性工具Observability Tools

下表总结了 API 管理支持的用于观测 API 的所有工具,每种工具适用于一个或多个场景:The table below summarizes all the tools supported by API Management to observe APIs, each is useful for one or more scenarios:

工具Tool 有助于Useful for 数据滞后时间Data lag 保留Retention 采样Sampling 数据类型Data kind 已启用Enabled
API 检查器API Inspector 测试和调试Testing and debugging 即时Instant 最后 100 个跟踪Last 100 traces 已按请求启用Turned on per request 请求跟踪Request traces 始终Always
内置分析Built-in Analytics 报告和监视Reporting and monitoring 分钟数Minutes 生存期Lifetime 100%100% 报表和日志Reports and logs 始终Always
Azure Monitor 指标Azure Monitor Metrics 报告和监视Reporting and monitoring 分钟数Minutes 93 天(升级后可延期)93 days (upgrade to extend) 100%100% 指标Metrics 始终Always
Azure Monitor 日志Azure Monitor Logs 报告、监视和调试Reporting, monitoring, and debugging 分钟数Minutes 31 天/5GB(升级后可延期)31 days/5GB (upgrade to extend) 100%(可调整)100% (adjustable) 日志Logs 可选Optional
Azure Application InsightsAzure Application Insights 报告、监视和调试Reporting, monitoring, and debugging Seconds 90 天/5GB(升级后可延期)90 days/5GB (upgrade to extend) 自定义Custom 日志、指标Logs, metrics 可选Optional
通过 Azure 事件中心记录Logging through Azure Event Hub 自定义场景Custom scenarios Seconds 用户管理User managed 自定义Custom 自定义Custom 可选Optional

自承载网关Self-hosted gateway

云中的托管网关支持上述所有工具。All the tools mentioned above are supported by the managed gateway in the cloud. 自承载网关当前不向 Azure Monitor 发送诊断日志。The self-hosted gateway currently does not send diagnostic logs to Azure Monitor. 但是,可以在部署自承载网关本地配置和保存日志。However, it is possible to configure and persist logs locally where the self-hosted gateway is deployed. 有关详细信息,请参阅为自承载网关配置云指标和日志为自承载网关配置本地指标和日志For more information, please see configuring cloud metrics and logs for self-hosted gateway and configuring local metrics and logs for self-hosted gateway.

后续步骤Next Steps