• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

lifeomic/graphql-resolvers-xray-tracing: A GraphQL middleware to enable X-Ray tr ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

lifeomic/graphql-resolvers-xray-tracing

开源软件地址(OpenSource Url):

https://github.com/lifeomic/graphql-resolvers-xray-tracing

开源编程语言(OpenSource Language):

TypeScript 96.1%

开源软件介绍(OpenSource Introduction):

GraphQL Middleware to add X-Ray tracing for resolvers

npm Build Status Coverage Status Dependabot Badge

To enable X-Ray subsegment creation for GraphQL resolvers, add this package as a dependency of your project and use code like this:

const traceResolvers = require('@lifeomic/graphql-resolvers-xray-tracing');
const schema = makeExecutableSchema( ... );
traceResolvers(schema);

After enabling X-Ray tracing, you should see new subsegments in your X-Ray traces like this:

Image of X-Ray trace

Local Development

If you would like to run your GraphQL server without tracing the resolvers (such as during local development), you can use environment variables to conditionally wrap them. For example, the AWS Lambda runtime injects the AWS_LAMBDA_FUNCTION_NAME which you can use so that the resolvers are only traced when running on Lambda:

const traceResolvers = require('@lifeomic/graphql-resolvers-xray-tracing');
const schema = makeExecutableSchema( ... );
if (process.env.AWS_LAMBDA_FUNCTION_NAME) {
  traceResolvers(schema);
}

AWS Segment Size Limitation

AWS has a 64K upload limit when submitting segments to AWS see AWSXRay concepts segments.

If you try and submit more than this limit you will see the following aws error message
" [ERROR] Segment too large to send: {<traceinformation...}"

One approach to remove this error, is to reduce the size of the batch upload (eg.. setStreamingThreshold(0) which will send each subsegment on close). See SDK - nodejs - setStreamingThreshold.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap