async-graphql/docs/zh-CN/src/apollo_tracing.md

21 lines
592 B
Markdown
Raw Normal View History

2020-04-15 03:15:30 +00:00
# Apollo Tracing支持
2020-04-17 03:06:33 +00:00
`Apollo Tracing`提供了查询每个步骤的性能分析结果,它是一个`Schema`扩展,性能分析结果保存在`QueryResponse`中。
启用`Apollo Tracing`扩展需要在创建`Schema`的时候添加该扩展。
```rust
# extern crate async_graphql;
2020-04-17 03:06:33 +00:00
use async_graphql::*;
use async_graphql::extensions::ApolloTracing;
# struct Query;
# #[Object]
# impl Query { async fn version(&self) -> &str { "1.0" } }
2020-04-17 03:06:33 +00:00
let schema = Schema::build(Query, EmptyMutation, EmptySubscription)
2021-03-06 13:22:28 +00:00
.extension(ApolloTracing) // 启用ApolloTracing扩展
2020-04-17 03:06:33 +00:00
.finish();
2021-03-06 13:22:28 +00:00
```