jomashop / module-new-relic-monitoring-for-gql
此包的最新版本(1.1.1)没有可用的许可证信息。
将 GraphQL 事务发送到 New Relic
1.1.1
2021-08-04 18:02 UTC
Requires
- magento/framework: *
This package is not auto-updated.
Last update: 2024-09-19 07:54:40 UTC
README
New Relic 的 PHP 代理支持自动为 REST 和 SOAP 事务命名,但不支持 GraphQL。因此,这个 Magento 2 模块是为了支持自动将 GraphQL 事务名称发送到 New Relic 而开发的。
详细信息
事务名称基于处理请求的服务类和方法,格式为 /GraphQl/Controller/GraphQl\{operation name|(query|mutation)}\{name|Multiple}
。
逻辑如下所述
- 如果设置了
operationName
字段,则使用操作名称。 - 如果没有设置
operationName
字段,则使用查询或变异的名称。 - 如果 GraphQL 查询包含多个查询或变异,则事务将表示为 'Multiple'。请注意,在任何情况下,
operationName
字段都具有优先级。
安装
composer require jomashop/module-new-relic-monitoring-for-gql
示例
- 设置了操作名称
mutation createCustomerTest{ createCustomer( input: { firstname: "Bob" lastname: "Loblaw" email: "test@example.com" password: "b0bl0bl@w" is_subscribed: true } ) { customer { firstname lastname email is_subscribed } } }
在 New Relic 中,事务名称将是:/GraphQl/Controller/GraphQl/Mutation/createCustomerTest
- 未设置操作名称且只请求了一个查询/变异
mutation { createCustomer( input: { firstname: "Bob" lastname: "Loblaw" email: "test@example.com" password: "b0bl0bl@w" is_subscribed: true } ) { customer { firstname lastname email is_subscribed } } }
在 NR 中,事务名称将是 /GraphQl/Controller/GraphQl/Mutation/createCustomer
- 未设置操作名称且请求了多个查询/变异
query { cmsBlocks(identifiers: "footer_links_block") { items { identifier title content } }, storeConfig { id code website_id locale base_currency_code default_display_currency_code timezone weight_unit base_url base_link_url base_static_url base_media_url secure_base_url secure_base_link_url secure_base_static_url secure_base_media_url store_name } }
在 NR 中,事务名称将是 /GraphQl/Controller/GraphQl(Query/Multiple)
变更日志
- v1.1.1:将请求的字段作为自定义参数发送到 NR
- v1.1.0:能够记录 GraphQl 错误