监控插件 - Amazon Personalize
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

监控插件

如果您使用 OpenSearch 服务,则可以通过 Amazon 中的指标监控插件 CloudWatch。有关更多信息,请参阅监控 Amazon OpenSearch 服务域

当你将 Amazon Personalize 搜索排名插件应用于 OpenSearch 查询时,你可以通过获取搜索渠道的指标来监控该插件。管道指标包括诸如 personalized_search_ranking 响应处理器的失败请求数量之类的统计信息。

使用 Amazon OpenSearch 服务监控插件

您可以使用以下 Python 代码获取所有管道的指标。有关管道指标的示例,请参阅管道指标示例

import requests from requests_auth_aws_sigv4 import AWSSigV4 domain_endpoint = 'domain endpoint' url = f'{domain_endpoint}/_nodes/stats/search_pipeline' auth = AWSSigV4('es') headers = {'Content-Type': 'application/json'} try: response = requests.get(url, auth=auth, headers=headers, verify=False) print(response.text) except Exception as e: print(f"Error: {e}")

使用开源监控插件 OpenSearch

您可以使用以下代码获取所有管道的指标。响应包含所有搜索管道的统计信息。有关管道指标的示例,请参阅管道指标示例

curl -XGET "https://localhost:9200/_nodes/stats/search_pipeline?pretty" -ku 'admin:admin'

管道指标示例

以下代码显示了从 OpenSearch中返回的管道指标的摘录。它仅显示包含两个不同管道统计信息的 pipelines 对象。对于每个管道,您可以在 personalized_search_ranking 响应处理器列表中找到 Amazon Personalize 搜索排名插件指标。有关所有指标的完整示例,请参阅搜索管道指标

{ .... .... "pipelines": { "pipelineA": { "request": { "count": 0, "time_in_millis": 0, "current": 0, "failed": 0 }, "response": { "count": 6, "time_in_millis": 2246, "current": 0, "failed": 0 }, "request_processors": [], "response_processors": [ { personalized_search_ranking": { "type": "personalized_search_ranking", "stats": { "count": <number of requests>, "time_in_millis": <time>, "current": 0, "failed": <number of failed requests> } } } ] }, "pipelineB": { "request": { "count": 0, "time_in_millis": 0, "current": 0, "failed": 0 }, "response": { "count": 8, "time_in_millis": 2248, "current": 0, "failed": 0 }, "request_processors": [], "response_processors": [ { "personalized_search_ranking": { "type": "personalized_search_ranking", "stats": { "count": <number of requests>, "time_in_millis": <time>, "current": 0, "failed": <number of failed requests> } } } ] } } .... .... }