Skip to content

Commit

Permalink
feat: useApolloInlineTrace plugin for federated tracing (v3) (#1621)
Browse files Browse the repository at this point in the history
* WIP

* designated plugin

* WIP

* implement using apollo's trace tree builder

* tests and adjustments

* precision with add seconds and nanos

* tests adjustments and error cases

* micro reorg

* use optional chaining, tests will fail

* even more tests

* expect no errors

* error expectations

* create yoga for each test

* test rewrite error

* test array

* adjust test naming

* should not trace subscriptions

* own tracing

* fix import

* changeset

* adjust docs

* should not handle subscriptions

* useInlineTrace -> useApolloInlineTrace

* adjust changeset

* avoid using buffer

* make sure the server closes

* federated tracing example

* Use yoga.fetch and fix ESM support

* Fix tests and use btoa from ponyfill for Node 14

* Fix package name

Co-authored-by: Arda TANRIKULU <ardatanrikulu@gmail.com>
  • Loading branch information
enisdenjo and ardatan committed Aug 22, 2022
1 parent 310b066 commit 66b87b0
Show file tree
Hide file tree
Showing 8 changed files with 901 additions and 10 deletions.
5 changes: 5 additions & 0 deletions .changeset/silent-ants-vanish.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@graphql-yoga/plugin-apollo-inline-trace': major
---

Implementation of Apollo's federated inline tracing
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
"weak-napi": ""
},
"resolutions": {
"@whatwg-node/fetch": "0.2.9",
"@whatwg-node/fetch": "0.3.2",
"@changesets/apply-release-plan": "6.0.0",
"graphql": "16.6.0",
"@types/react": "17.0.39",
Expand Down
3 changes: 2 additions & 1 deletion packages/graphql-yoga/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,8 @@ export class YogaServer<
})
}
return response
} catch (e) {
} catch (e: any) {
this.logger.error(e)
return new this.fetchAPI.Response('Internal Server Error', {
status: 500,
})
Expand Down
Loading

0 comments on commit 66b87b0

Please sign in to comment.