async-graphql/docs/zh-CN/src/apollo_tracing.md
Edward Rudd 3b7ed74d11 correct doc examples so they compile
- examples to fix still
  - error_extensions.md ResultExt example does not compile!
     - trait ErrorExtensions is not implemented for ParseIntError
  - dataloader
     - requires sqlx to work. So we either "stub" it OR we rewrite them simpler to use a  simple "faux" db library
2022-06-02 17:32:12 -04:00

592 B

Apollo Tracing支持

Apollo Tracing提供了查询每个步骤的性能分析结果,它是一个Schema扩展,性能分析结果保存在QueryResponse中。

启用Apollo Tracing扩展需要在创建Schema的时候添加该扩展。

# extern crate async_graphql;
use async_graphql::*;
use async_graphql::extensions::ApolloTracing;

# struct Query;
# #[Object]
# impl Query { async fn version(&self) -> &str { "1.0" } }

let schema = Schema::build(Query, EmptyMutation, EmptySubscription)
    .extension(ApolloTracing) // 启用ApolloTracing扩展
    .finish();