apollo-federation 3.6.4 → 3.6.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -0
- data/README.md +3 -1
- data/lib/apollo-federation/tracing/tracer.rb +13 -3
- data/lib/apollo-federation/tracing.rb +2 -1
- data/lib/apollo-federation/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f68278723526fb35e83d13b471c1fb75461ddf8e292910acf9d864c1a4b8a6e
|
4
|
+
data.tar.gz: e381e8472bfde3eedd714a66d1f10c546b871c7670c4519c692a0b59e5322e23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 148083333795ac56d528a90a6e508095af5261b5a63621f26b6446e7d8edfc8ac2f81ce779ab913e07977681a2125e145efd86fb4cedbb030dd779a692921bab
|
7
|
+
data.tar.gz: f25fd810613dd4042b39e314cf58fc1919f1065c2aacdde50a33057ba93a53f5f7ed950be800c94c2fb9e07a24ffa78399cd7951e777f6345aeb2b539a12a7cd
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
## [3.6.6](https://github.com/Gusto/apollo-federation-ruby/compare/v3.6.5...v3.6.6) (2023-04-26)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* ApolloFederation::Tracing.should_add_traces() looks for correct headers ([#240](https://github.com/Gusto/apollo-federation-ruby/issues/240)) ([d609977](https://github.com/Gusto/apollo-federation-ruby/commit/d609977869721c168b33e50e3823cd97a7f81ae5))
|
7
|
+
|
8
|
+
## [3.6.5](https://github.com/Gusto/apollo-federation-ruby/compare/v3.6.4...v3.6.5) (2023-04-25)
|
9
|
+
|
10
|
+
|
11
|
+
### Bug Fixes
|
12
|
+
|
13
|
+
* **tracer:** add support for multiplex ([#243](https://github.com/Gusto/apollo-federation-ruby/issues/243)) ([c4f2eae](https://github.com/Gusto/apollo-federation-ruby/commit/c4f2eaed0b283c188f2fb932d5308dd3240bb2ec))
|
14
|
+
|
1
15
|
## [3.6.4](https://github.com/Gusto/apollo-federation-ruby/compare/v3.6.3...v3.6.4) (2023-04-19)
|
2
16
|
|
3
17
|
|
data/README.md
CHANGED
@@ -333,7 +333,9 @@ To support [federated tracing](https://www.apollographql.com/docs/apollo-server/
|
|
333
333
|
def execute
|
334
334
|
# ...
|
335
335
|
context = {
|
336
|
-
|
336
|
+
# Pass in the headers from your web framework. For Rails this will be request.headers
|
337
|
+
# but for other frameworks you can pass the Rack env.
|
338
|
+
tracing_enabled: ApolloFederation::Tracing.should_add_traces(request.headers)
|
337
339
|
}
|
338
340
|
# ...
|
339
341
|
end
|
@@ -83,7 +83,19 @@ module ApolloFederation
|
|
83
83
|
result = block.call
|
84
84
|
|
85
85
|
query = data.fetch(:query)
|
86
|
-
|
86
|
+
multiplex = data.fetch(:multiplex)
|
87
|
+
|
88
|
+
if query
|
89
|
+
record_trace_end_time(query)
|
90
|
+
elsif multiplex
|
91
|
+
multiplex.queries.each { |q| record_trace_end_time(q) }
|
92
|
+
end
|
93
|
+
|
94
|
+
result
|
95
|
+
end
|
96
|
+
|
97
|
+
def self.record_trace_end_time(query)
|
98
|
+
return unless query.context && query.context[:tracing_enabled]
|
87
99
|
|
88
100
|
trace = query.context.namespace(ApolloFederation::Tracing::KEY)
|
89
101
|
|
@@ -91,8 +103,6 @@ module ApolloFederation
|
|
91
103
|
end_time: Time.now.utc,
|
92
104
|
end_time_nanos: Process.clock_gettime(Process::CLOCK_MONOTONIC, :nanosecond),
|
93
105
|
)
|
94
|
-
|
95
|
-
result
|
96
106
|
end
|
97
107
|
|
98
108
|
# Step 2:
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
module ApolloFederation
|
4
4
|
module Tracing
|
5
|
+
HEADER_NAME = 'HTTP_APOLLO_FEDERATION_INCLUDE_TRACE'
|
5
6
|
KEY = :ftv1
|
6
7
|
DEBUG_KEY = "#{KEY}_debug".to_sym
|
7
8
|
|
@@ -12,7 +13,7 @@ module ApolloFederation
|
|
12
13
|
end
|
13
14
|
|
14
15
|
def should_add_traces(headers)
|
15
|
-
headers && headers[
|
16
|
+
headers && headers[HEADER_NAME] == KEY.to_s
|
16
17
|
end
|
17
18
|
|
18
19
|
# @deprecated There is no need to call this method. Traces are added to the result automatically
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apollo-federation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.6.
|
4
|
+
version: 3.6.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Noa Elad
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-04-
|
12
|
+
date: 2023-04-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: graphql
|