newrelic-infinite_tracing 8.13.1 → 8.15.0

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: 7d1c8e822a9bca51eccf2b2c93a12d3cedabedea0f1269e9c423663cffd9eb0e
4
- data.tar.gz: ea3a78f73f1ab78be3c68c8c6b433c851fd502ba95cf3d193be8a4b3634be475
3
+ metadata.gz: ef58ccd55c212b9f5de2fb32b7574ecbdfdb8d82794fccf628de4c76ae17cb5f
4
+ data.tar.gz: '0868bd0fc973b1a0562701b966a29e62636ed9558fe8710f0148be6239bd5433'
5
5
  SHA512:
6
- metadata.gz: 7f0162e668193e3da17d6d5aeeb05e1dd0beed258d049a2e02bcb20fece10b30521aec64401122ff2c51bed37f6c15b90ee0f3ff286c5d26ec3449b159316cbe
7
- data.tar.gz: 4b716c1bffd149167b29a5c00ef4881ae50e406392f0b302f59375bf0d144bd82a85ba58f8a67cc312706e09078aab726f8064abdb2c437819e60904f7e48511
6
+ metadata.gz: 2f5570f978e5a18bb7e7f6f9c9a06676ed4d3edc2fb874fbcfde6a19a8778806023af125a850e053479b6a2245a2d6d7da3a5718ba4a14a9eaa1a804954a158e
7
+ data.tar.gz: 6aead156960e0785cda78807c50e74dbf802b02a5e96e4b0073ad6593347dedfc3a53934d4345682a2de7f41bf5840c37f8b1a3300ac0df76cc6cb1a762541e9
@@ -5,8 +5,8 @@
5
5
  module NewRelic::Agent
6
6
  module InfiniteTracing
7
7
  class Channel
8
- COMPRESSION_LEVELS = %i[none low medium high].freeze
9
- DEFAULT_COMPRESSION_LEVEL = :none
8
+ SETTINGS_BASE = {'grpc.enable_deadline_checking' => 0}.freeze
9
+ SETTINGS_COMPRESSION_DISABLED = SETTINGS_BASE.merge({'grpc.minimal_stack' => 1}).freeze
10
10
 
11
11
  def stub
12
12
  NewRelic::Agent.logger.debug("Infinite Tracer Opening Channel to #{host_and_port}")
@@ -19,64 +19,29 @@ module NewRelic::Agent
19
19
  )
20
20
  end
21
21
 
22
- def channel
23
- GRPC::Core::Channel.new(host_and_port, settings, credentials)
24
- end
25
-
26
- def channel_args
27
- return NewRelic::EMPTY_HASH unless compression_enabled?
28
-
29
- GRPC::Core::CompressionOptions.new(compression_options).to_channel_arg_hash
30
- end
31
-
32
- def compression_enabled?
33
- compression_level != :none
34
- end
35
-
36
- def compression_level
37
- @compression_level ||= begin
38
- level = if valid_compression_level?(configured_compression_level)
39
- configured_compression_level
40
- else
41
- DEFAULT_COMPRESSION_LEVEL
42
- end
43
- NewRelic::Agent.logger.debug("Infinite Tracer compression level set to #{level}")
44
- level
45
- end
46
- end
47
-
48
- def compression_options
49
- {default_algorithm: :gzip,
50
- default_level: compression_level}
51
- end
52
-
53
- def configured_compression_level
54
- NewRelic::Agent.config[:'infinite_tracing.compression_level']
22
+ def host_and_port
23
+ Config.trace_observer_host_and_port
55
24
  end
56
25
 
57
26
  def credentials
58
- # Uses system configured certificates by default
59
- GRPC::Core::ChannelCredentials.new
27
+ @credentials ||= GRPC::Core::ChannelCredentials.new
60
28
  end
61
29
 
62
- def host_and_port
63
- Config.trace_observer_host_and_port
30
+ def channel
31
+ GRPC::Core::Channel.new(host_and_port, settings, credentials)
64
32
  end
65
33
 
66
34
  def settings
67
- {
68
- 'grpc.minimal_stack' => 1,
69
- 'grpc.enable_deadline_checking' => 0
70
- }
71
- end
35
+ return channel_args.merge(SETTINGS_COMPRESSION_DISABLED).freeze unless Config.compression_enabled?
72
36
 
73
- def valid_compression_level?(level)
74
- return true if COMPRESSION_LEVELS.include?(level)
37
+ channel_args.merge(SETTINGS_BASE).freeze
38
+ end
75
39
 
76
- NewRelic::Agent.logger.error("Invalid compression level '#{level}' specified! Must be one of " \
77
- "#{COMPRESSION_LEVELS.join('|')}. Using default level of '#{DEFAULT_COMPRESSION_LEVEL}'")
40
+ def channel_args
41
+ return NewRelic::EMPTY_HASH unless Config.compression_enabled?
78
42
 
79
- false
43
+ GRPC::Core::CompressionOptions.new(default_algorithm: :gzip,
44
+ default_level: Config.compression_level).to_channel_arg_hash
80
45
  end
81
46
  end
82
47
  end
@@ -7,6 +7,9 @@ module NewRelic::Agent
7
7
  module Config
8
8
  extend self
9
9
 
10
+ COMPRESSION_LEVEL_DISABLED = :none
11
+ COMPRESSION_LEVEL_DEFAULT = :high
12
+ COMPRESSION_LEVEL_LIST = %i[none low medium high].freeze
10
13
  TRACE_OBSERVER_NOT_CONFIGURED_ERROR = "Trace Observer host not configured!"
11
14
 
12
15
  # We only want to load the infinite tracing gem's files when
@@ -109,6 +112,29 @@ module NewRelic::Agent
109
112
  def trace_observer_configured?
110
113
  trace_observer_host != NewRelic::EMPTY_STR
111
114
  end
115
+
116
+ def compression_enabled?
117
+ compression_level != COMPRESSION_LEVEL_DISABLED
118
+ end
119
+
120
+ def compression_level
121
+ @compression_level ||= begin
122
+ level = if COMPRESSION_LEVEL_LIST.include?(configured_compression_level)
123
+ configured_compression_level
124
+ else
125
+ NewRelic::Agent.logger.error("Invalid compression level '#{configured_compression_level}' specified! " \
126
+ "Must be one of #{COMPRESSION_LEVEL_LIST.join('|')}. Using default level " \
127
+ "of '#{COMPRESSION_LEVEL_DEFAULT}'")
128
+ COMPRESSION_LEVEL_DEFAULT
129
+ end
130
+ NewRelic::Agent.logger.debug("Infinite Tracer compression level set to #{level}")
131
+ level
132
+ end
133
+ end
134
+
135
+ def configured_compression_level
136
+ NewRelic::Agent.config[:'infinite_tracing.compression_level']
137
+ end
112
138
  end
113
139
  end
114
140
  end
@@ -17,6 +17,12 @@
17
17
  module NewRelic::Agent
18
18
  module InfiniteTracing
19
19
  class Connection
20
+ GZIP_METADATA = {'grpc-internal-encoding-request' => 'gzip',
21
+ 'grpc-encoding' => 'gzip',
22
+ 'grpc-accept-encoding' => ['gzip'],
23
+ 'content-coding' => 'gzip',
24
+ 'content-encoding' => 'gzip'}.freeze
25
+
20
26
  # listens for server side configurations added to the agent. When a new config is
21
27
  # added, we have a new agent run token and need to restart the client's RPC stream
22
28
  # with the new metadata information.
@@ -100,9 +106,18 @@ module NewRelic::Agent
100
106
  "agent_run_token" => agent_id
101
107
  }
102
108
  @metadata.merge!(request_headers_map)
109
+ merge_gzip_metadata
103
110
  end
104
111
  end
105
112
 
113
+ # If (gzip based) compression is enabled, explicitly provide all
114
+ # relevant metadata
115
+ def merge_gzip_metadata
116
+ return @metadata unless Config.compression_enabled?
117
+
118
+ @metadata.merge!(GZIP_METADATA)
119
+ end
120
+
106
121
  # Initializes rpc so we can get a Channel and Stub (connect to gRPC server)
107
122
  # Initializes metadata so we use newest values in establishing channel
108
123
  # Sets the agent_connected flag and signals the agent started so any
@@ -2,6 +2,40 @@
2
2
  # See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
3
3
  # frozen_string_literal: true
4
4
 
5
- unless defined? NewRelic::Agent::InfiniteTracing
6
- require_relative '../infinite_tracing'
5
+ # Entry point for New Relic Infinite Tracing.
6
+
7
+ require 'uri'
8
+
9
+ require 'newrelic_rpm'
10
+
11
+ NewRelic::Agent.logger.debug("Detected New Relic Infinite Tracing Gem")
12
+
13
+ require 'infinite_tracing/version'
14
+ require 'infinite_tracing/config'
15
+
16
+ DependencyDetection.defer do
17
+ named :infinite_tracing
18
+
19
+ depends_on do
20
+ NewRelic::Agent::InfiniteTracing::Config.should_load?
21
+ end
22
+
23
+ executes do
24
+ NewRelic::Agent.logger.debug("Loading New Relic Infinite Tracing Library")
25
+
26
+ require 'infinite_tracing/proto'
27
+
28
+ require 'infinite_tracing/constants'
29
+ require 'infinite_tracing/worker'
30
+ require 'infinite_tracing/record_status_handler'
31
+
32
+ require 'infinite_tracing/transformer'
33
+ require 'infinite_tracing/streaming_buffer'
34
+ require 'infinite_tracing/suspended_streaming_buffer'
35
+ require 'infinite_tracing/channel'
36
+ require 'infinite_tracing/connection'
37
+ require 'infinite_tracing/client'
38
+
39
+ require 'infinite_tracing/agent_integrations'
40
+ end
7
41
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: newrelic-infinite_tracing
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.13.1
4
+ version: 8.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tanna McClure
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2022-11-21 00:00:00.000000000 Z
14
+ date: 2023-01-09 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: newrelic_rpm
@@ -19,14 +19,14 @@ dependencies:
19
19
  requirements:
20
20
  - - '='
21
21
  - !ruby/object:Gem::Version
22
- version: 8.13.1
22
+ version: 8.15.0
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - '='
28
28
  - !ruby/object:Gem::Version
29
- version: 8.13.1
29
+ version: 8.15.0
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: grpc
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -248,7 +248,6 @@ files:
248
248
  - Gemfile
249
249
  - LICENSE
250
250
  - Rakefile
251
- - lib/infinite_tracing.rb
252
251
  - lib/infinite_tracing/agent_integrations.rb
253
252
  - lib/infinite_tracing/agent_integrations/agent.rb
254
253
  - lib/infinite_tracing/agent_integrations/datastore_segment.rb
@@ -268,7 +267,6 @@ files:
268
267
  - lib/infinite_tracing/transformer.rb
269
268
  - lib/infinite_tracing/version.rb
270
269
  - lib/infinite_tracing/worker.rb
271
- - lib/new_relic/infinite_tracing.rb
272
270
  - lib/newrelic/infinite_tracing.rb
273
271
  - lib/proto/infinite_tracing.proto
274
272
  - newrelic-infinite_tracing.gemspec
@@ -1,39 +0,0 @@
1
- # This file is distributed under New Relic's license terms.
2
- # See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
3
- # frozen_string_literal: true
4
-
5
- require 'uri'
6
-
7
- require 'newrelic_rpm'
8
-
9
- NewRelic::Agent.logger.debug("Detected New Relic Infinite Tracing Gem")
10
-
11
- require 'infinite_tracing/version'
12
- require 'infinite_tracing/config'
13
-
14
- DependencyDetection.defer do
15
- named :infinite_tracing
16
-
17
- depends_on do
18
- NewRelic::Agent::InfiniteTracing::Config.should_load?
19
- end
20
-
21
- executes do
22
- NewRelic::Agent.logger.debug("Loading New Relic Infinite Tracing Library")
23
-
24
- require 'infinite_tracing/proto'
25
-
26
- require 'infinite_tracing/constants'
27
- require 'infinite_tracing/worker'
28
- require 'infinite_tracing/record_status_handler'
29
-
30
- require 'infinite_tracing/transformer'
31
- require 'infinite_tracing/streaming_buffer'
32
- require 'infinite_tracing/suspended_streaming_buffer'
33
- require 'infinite_tracing/channel'
34
- require 'infinite_tracing/connection'
35
- require 'infinite_tracing/client'
36
-
37
- require 'infinite_tracing/agent_integrations'
38
- end
39
- end
@@ -1,39 +0,0 @@
1
- # This file is distributed under New Relic's license terms.
2
- # See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
3
- # frozen_string_literal: true
4
-
5
- require 'uri'
6
-
7
- require 'newrelic_rpm'
8
-
9
- NewRelic::Agent.logger.debug("Detected New Relic Infinite Tracing Gem")
10
-
11
- require 'new_relic/infinite_tracing/version'
12
- require 'new_relic/infinite_tracing/config'
13
-
14
- DependencyDetection.defer do
15
- named :infinite_tracing
16
-
17
- depends_on do
18
- NewRelic::Agent::InfiniteTracing::Config.should_load?
19
- end
20
-
21
- executes do
22
- NewRelic::Agent.logger.debug("Loading New Relic Infinite Tracing Library")
23
-
24
- require 'new_relic/infinite_tracing/proto'
25
-
26
- require 'new_relic/infinite_tracing/constants'
27
- require 'new_relic/infinite_tracing/worker'
28
- require 'new_relic/infinite_tracing/record_status_handler'
29
-
30
- require 'new_relic/infinite_tracing/transformer'
31
- require 'new_relic/infinite_tracing/streaming_buffer'
32
- require 'new_relic/infinite_tracing/suspended_streaming_buffer'
33
- require 'new_relic/infinite_tracing/channel'
34
- require 'new_relic/infinite_tracing/connection'
35
- require 'new_relic/infinite_tracing/client'
36
-
37
- require 'new_relic/infinite_tracing/agent_integrations'
38
- end
39
- end