apollo-studio-tracing 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0ff2d17a9b33169e238f8c70b88916e38fcc16b527903b3392419c2cc73353b5
4
- data.tar.gz: 70adab1f671440bd2c697b879471b60e42e9e279ead91b0a62180df6b5c8be2d
3
+ metadata.gz: 676b93f9a1b7fdae4fa0d954064cdff300812e5f1d1673cbb2c179ad3e8fd777
4
+ data.tar.gz: f24bfa49269991787e26320e3f5eb089acfaffb994348b55dcb13e83fbb9e5e6
5
5
  SHA512:
6
- metadata.gz: 25a9934e528dd156ce401103df016ec5592b16a99bb29900dd7b6a9daa0ca9cbbb7549bffcf1aec4aa6d092de73421c8285c3bb8c503b8cec05dc27aa6c5be86
7
- data.tar.gz: a36ef4094400263b728d215a88849bd371ab5d06090edbac939fc9a8b3e2120390929a812107d1cd9456c800c10e9835eb7fc5328a2aa3aad039e18719820853
6
+ metadata.gz: f41489cdf1f1540e50c4dfcfafbaa1cc14d0746761a33aa2775c056804c95a3729430f7776a95509051de8374d27c702bcc106a029b65a897f9c57a492250377
7
+ data.tar.gz: 2e40c8f8c03aecf4b182eb0b0a9ba4d816656127d0337e5c34d338a02de0ac5aab0039024a251f8b9402b58a560fd697cf861e8d17325a94c484fc76929182ba
@@ -1,3 +1,10 @@
1
+ ## [1.0.1](https://github.com/EnjoyTech/apollo-studio-tracing-ruby/compare/v1.0.0...v1.0.1) (2020-11-02)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **tracing:** avoid trapping SIGINT, just use `at_exit` ([de7c85e](https://github.com/EnjoyTech/apollo-studio-tracing-ruby/commit/de7c85e63b455a98474694a972daf001f8b12719))
7
+
1
8
  # [1.0.0](https://github.com/EnjoyTech/apollo-studio-tracing-ruby/compare/v0.1.0...v1.0.0) (2020-10-26)
2
9
 
3
10
 
@@ -3,6 +3,7 @@
3
3
  require 'apollo-studio-tracing/proto'
4
4
  require 'apollo-studio-tracing/node_map'
5
5
  require 'apollo-studio-tracing/tracer'
6
+ require 'apollo-studio-tracing/logger'
6
7
 
7
8
  module ApolloStudioTracing
8
9
  extend self
@@ -13,7 +14,7 @@ module ApolloStudioTracing
13
14
  attr_accessor :logger
14
15
 
15
16
  # TODO: Initialize this to Rails.logger in a Railtie
16
- self.logger = Logger.new(STDOUT)
17
+ self.logger = ApolloLogger.new(STDOUT)
17
18
 
18
19
  def use(schema, **options)
19
20
  tracer = ApolloStudioTracing::Tracer.new(**options)
@@ -32,9 +33,7 @@ module ApolloStudioTracing
32
33
  tracers.each(&:shutdown_trace_channel)
33
34
  end
34
35
 
35
- trap('SIGINT') do
36
- Thread.new { shutdown }
37
- end
36
+ at_exit { shutdown }
38
37
 
39
38
  private
40
39
 
@@ -22,13 +22,13 @@ module ApolloStudioTracing
22
22
  if e.is_a?(RetryableUploadAttemptError) && attempt < max_attempts
23
23
  retry_delay = min_retry_delay_secs * 2**attempt
24
24
  ApolloStudioTracing.logger.warn(
25
- "Attempt to send Apollo trace report failed and will be retried in #{retry_delay} " \
25
+ "Attempt to send trace report failed and will be retried in #{retry_delay} " \
26
26
  "secs: #{e.message}",
27
27
  )
28
28
  sleep(retry_delay)
29
29
  retry
30
30
  else
31
- ApolloStudioTracing.logger.warn("Failed to send Apollo trace report: #{e.message}")
31
+ ApolloStudioTracing.logger.warn("Failed to send trace report: #{e.message}")
32
32
  end
33
33
  end
34
34
 
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ApolloStudioTracing
4
+ class ApolloLogger < Logger
5
+ def format_message(severity, timestamp, progname, msg)
6
+ "[#{timestamp}] #{severity} #{progname}: [Apollo Studio Tracing] #{msg}\n"
7
+ end
8
+ end
9
+ end
@@ -104,6 +104,7 @@ module ApolloStudioTracing
104
104
  def shutdown
105
105
  return unless @uploader_thread
106
106
 
107
+ ApolloStudioTracing.logger.info('Shutting down Apollo trace channel...')
107
108
  @shutdown_barrier.shutdown
108
109
  @uploader_thread.join
109
110
  end
@@ -115,15 +116,15 @@ module ApolloStudioTracing
115
116
  end
116
117
 
117
118
  def run_uploader
118
- ApolloStudioTracing.logger.info('Apollo trace uploader starting')
119
+ ApolloStudioTracing.logger.info('Trace uploader starting')
119
120
  drain_queue until @shutdown_barrier.await_shutdown(reporting_interval)
120
- puts 'Stopping uploader run loop'
121
+ ApolloStudioTracing.logger.info('Draining queue before shutdown...')
121
122
  drain_queue
122
123
  rescue StandardError => e
123
124
  ApolloStudioTracing.logger.warn("Exception thrown in uploader process. #{e}")
124
125
  raise e
125
126
  ensure
126
- ApolloStudioTracing.logger.info('Apollo trace uploader exiting')
127
+ ApolloStudioTracing.logger.info('Trace uploader exiting')
127
128
  end
128
129
 
129
130
  def drain_queue
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ApolloStudioTracing
4
- VERSION = '1.0.0'
4
+ VERSION = '1.0.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apollo-studio-tracing
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luke Saniwck
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-26 00:00:00.000000000 Z
11
+ date: 2020-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: graphql
@@ -220,6 +220,7 @@ files:
220
220
  - bin/rspec
221
221
  - lib/apollo-studio-tracing.rb
222
222
  - lib/apollo-studio-tracing/api.rb
223
+ - lib/apollo-studio-tracing/logger.rb
223
224
  - lib/apollo-studio-tracing/node_map.rb
224
225
  - lib/apollo-studio-tracing/proto.rb
225
226
  - lib/apollo-studio-tracing/proto/apollo.proto