jomashop/module-new-relic-monitoring-for-gql
Composer 安装命令:
composer require jomashop/module-new-relic-monitoring-for-gql
包简介
Send GraphQL transactions to New Relic
README 文档
README
New Relic's PHP agent has support for automatic transaction naming for REST and SOAP, but not GraphQL. Thus, this Magento 2 module is developed to support sending a GraphQL transaction name to New Relic automatically.
Details
A transaction is named based on the service class and method that handled the request, /GraphQl/Controller/GraphQl\{operation name|(query|mutation)}\{name|Multiple}.
The logic is explained as follows:
- If the
operationNamefield is set, use the operation name. - If the
operationNamefield is not set, use the name of the query or mutation. - If a GraphQL query consists of multiple queries or mutations, the transaction would be indicated as 'Multiple'. Note that in any cases, the
operationNamefield takes the priority.
Installation
composer require jomashop/module-new-relic-monitoring-for-gql
Examples
- Operation name is set
mutation createCustomerTest{ createCustomer( input: { firstname: "Bob" lastname: "Loblaw" email: "test@example.com" password: "b0bl0bl@w" is_subscribed: true } ) { customer { firstname lastname email is_subscribed } } }
In New Relic, the transaction name would be: /GraphQl/Controller/GraphQl/Mutation/createCustomerTest
- Operation name is not set and only 1 query/mutation is requested
mutation { createCustomer( input: { firstname: "Bob" lastname: "Loblaw" email: "test@example.com" password: "b0bl0bl@w" is_subscribed: true } ) { customer { firstname lastname email is_subscribed } } }
In NR, the transaction name would be /GraphQl/Controller/GraphQl/Mutation/createCustomer
- Operation name is not set and multiple queries/mutations are requested
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 } }
In NR, the transaction name would be /GraphQl/Controller/GraphQl/Query/Multiple
Other features
This module also supports using newrelic_add_custom_parameter instead of newrelic_notice_error.
- See ErrorHandler and ReportErrorEvaluatorInterface
- This can be used to reduce the number of
GraphQlInputException/GraphQlAuthorizationException/GraphQlAuthenticationExceptionwhich are logged as errors - Data is set to ExceptionIsSkipReportError / ExceptionClass / ExceptionMessage
Error extraction:
- If the error is an
AggregateExceptionInterfacethe module tries to use the inner error. - If the error is a
LocalizedExceptionthen ExceptionRawMessage is set as a custom parameter
If the header x-client-version is set then ClientVersion is set as a custom parameter
- This can be used to track the Frontend Version sending the GQL request
Core Magento logging from 2.4.4 is disabled as running both is does not provide extra value
If Magento >= 2.4.7 is used the extracted data changes
- The AST is parsed to extract various data
- <2.4.7 parses the string
jomashop/module-new-relic-monitoring-for-gql 适用场景与选型建议
jomashop/module-new-relic-monitoring-for-gql 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 152.41k 次下载、GitHub Stars 达 15, 最近一次更新时间为 2021 年 01 月 19 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 jomashop/module-new-relic-monitoring-for-gql 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 jomashop/module-new-relic-monitoring-for-gql 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 152.41k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 16
- 点击次数: 28
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2021-01-19