appoptics_apm 4.10.1 → 4.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +27 -6
- data/.travis.yml +3 -3
- data/appoptics_apm.gemspec +2 -1
- data/examples/SDK/01_basic_tracing.rb +1 -1
- data/ext/oboe_metal/extconf.rb +4 -2
- data/ext/oboe_metal/src/VERSION +1 -1
- data/lib/appoptics_apm/api/logging.rb +6 -2
- data/lib/appoptics_apm/api/util.rb +5 -7
- data/lib/appoptics_apm/config.rb +1 -1
- data/lib/appoptics_apm/frameworks/grape.rb +3 -2
- data/lib/appoptics_apm/frameworks/padrino.rb +1 -1
- data/lib/appoptics_apm/frameworks/sinatra.rb +1 -1
- data/lib/appoptics_apm/inst/graphql.rb +215 -0
- data/lib/appoptics_apm/sdk/logging.rb +1 -1
- data/lib/appoptics_apm/sdk/tracing.rb +4 -4
- data/lib/appoptics_apm/version.rb +2 -2
- data/lib/oboe_metal.rb +1 -1
- data/lib/rails/generators/appoptics_apm/install_generator.rb +23 -21
- data/lib/rails/generators/appoptics_apm/templates/appoptics_apm_initializer.rb +33 -20
- metadata +38 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 10400db84a2a1a68fb58d21e3242c39377cc334d18cbd8ed5df1f47f5708787b
|
4
|
+
data.tar.gz: 0ca5bfa1737e1dc75e63d8b3f97af692a305620554428ac379eada53c802842b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c59d11940602ab5e3d36b6b0809c4247ac7217ea335904b4b18bff5cd7b601e650d3f696d4e4146fe919b0f4a5f725a199711d50fd4b25a8ca14478a4d88df00
|
7
|
+
data.tar.gz: 6dfaea0bfe049cccaefbd174433d22918d0516c9e6ddb7c6b2503cbb11cea86848cf9b8efb26546ebf738df3c6daf8f3e8dbacbf5d691116ecd1e736e91dd5cd
|
data/.rubocop.yml
CHANGED
@@ -1,8 +1,29 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
Style/StringLiterals:
|
2
|
+
Description: 'Checks if uses of quotes match the configured preference.'
|
3
|
+
StyleGuide: '#consistent-string-literals'
|
4
|
+
Enabled: false
|
3
5
|
|
4
|
-
|
5
|
-
|
6
|
+
Layout/LineLength:
|
7
|
+
Description: 'Limit lines to 80 characters.'
|
8
|
+
Enabled: false
|
6
9
|
|
7
|
-
|
8
|
-
|
10
|
+
Naming/VariableNumber:
|
11
|
+
Description: 'Use the configured style when numbering variables.'
|
12
|
+
Enabled: false
|
13
|
+
|
14
|
+
Style/FrozenStringLiteralComment:
|
15
|
+
Description: >-
|
16
|
+
Add the frozen_string_literal comment to the top of files
|
17
|
+
to help transition to frozen string literals by default.
|
18
|
+
Enabled: false
|
19
|
+
|
20
|
+
Style/Documentation:
|
21
|
+
Description: 'Document classes and non-namespace modules.'
|
22
|
+
Enabled: false
|
23
|
+
|
24
|
+
Style/WordArray:
|
25
|
+
EnforcedStyle: brackets
|
26
|
+
|
27
|
+
Metrics/BlockLength:
|
28
|
+
Exclude:
|
29
|
+
- test/*/*_test.rb
|
data/.travis.yml
CHANGED
@@ -14,8 +14,8 @@ rvm:
|
|
14
14
|
- 2.6.4
|
15
15
|
- 2.5.5
|
16
16
|
- 2.4.5
|
17
|
-
- 2.7.0
|
18
|
-
|
17
|
+
- 2.7.0
|
18
|
+
- ruby-head
|
19
19
|
# - jruby-9.0.5.0
|
20
20
|
|
21
21
|
gemfile:
|
@@ -87,7 +87,7 @@ matrix:
|
|
87
87
|
env: DBTYPE=mysql2
|
88
88
|
allow_failures:
|
89
89
|
- rvm: ruby-head
|
90
|
-
- rvm: 2.7.0
|
90
|
+
- rvm: 2.7.0
|
91
91
|
|
92
92
|
# FIXME: Figure out if this is still an issue when reviewing cassandra test setup
|
93
93
|
# Attempt Travis/Cassandra fix re: https://github.com/travis-ci/travis-ci/issues/1484
|
data/appoptics_apm.gemspec
CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |s|
|
|
6
6
|
s.version = AppOpticsAPM::Version::STRING
|
7
7
|
s.date = Time.now.strftime('%Y-%m-%d')
|
8
8
|
|
9
|
-
s.license = "Librato Open License, Version 1.0"
|
9
|
+
s.license = "Librato Open License, Version 1.0, https://bit.ly/2Kmm0mN"
|
10
10
|
|
11
11
|
s.authors = ["Maia Engeli", "Peter Giacomo Lombardo", "Spiros Eliopoulos"]
|
12
12
|
s.email = %q{support@appoptics.com}
|
@@ -54,6 +54,7 @@ Automatic tracing and metrics for Ruby applications. Get started at appoptics.co
|
|
54
54
|
unless defined?(JRUBY_VERSION)
|
55
55
|
s.add_development_dependency('byebug', '>= 8.0.0')
|
56
56
|
s.add_development_dependency('minitest-hooks', '>= 1.5.0')
|
57
|
+
s.add_development_dependency('minitest-focus', '>=1.1.2')
|
57
58
|
s.add_development_dependency('benchmark-ips', '>= 2.7.2')
|
58
59
|
end
|
59
60
|
|
data/ext/oboe_metal/extconf.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Copyright (c) 2016 SolarWinds, LLC.
|
2
4
|
# All rights reserved.
|
3
5
|
|
@@ -20,7 +22,7 @@ ao_include = File.join(ext_dir, 'src')
|
|
20
22
|
version = File.read(File.join(ao_include, 'VERSION')).chomp
|
21
23
|
if ENV['APPOPTICS_FROM_S3'].to_s.downcase == 'true'
|
22
24
|
ao_path = File.join('https://s3-us-west-2.amazonaws.com/rc-files-t2/c-lib/', version)
|
23
|
-
puts
|
25
|
+
puts 'Fetching c-lib from S3'
|
24
26
|
else
|
25
27
|
ao_path = File.join('https://files.appoptics.com/c-lib', version)
|
26
28
|
end
|
@@ -29,7 +31,7 @@ ao_arch = 'x86_64'
|
|
29
31
|
if File.exist?('/etc/alpine-release')
|
30
32
|
version = open('/etc/alpine-release').read.chomp
|
31
33
|
ao_arch =
|
32
|
-
if Gem::Version.new(version) <
|
34
|
+
if Gem::Version.new(version) < Gem::Version.new('3.9')
|
33
35
|
'alpine-libressl-x86_64'
|
34
36
|
else # openssl
|
35
37
|
'alpine-x86_64'
|
data/ext/oboe_metal/src/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
7.
|
1
|
+
7.1.0
|
@@ -55,7 +55,7 @@ module AppOpticsAPM
|
|
55
55
|
# ==== Arguments
|
56
56
|
#
|
57
57
|
# * +layer+ - The layer the reported event belongs to
|
58
|
-
# * +exception+ - The exception to report
|
58
|
+
# * +exception+ - The exception to report, responds to :message and :backtrace(optional)
|
59
59
|
# * +opts+ - Custom params if you want to log extra information
|
60
60
|
#
|
61
61
|
# ==== Example
|
@@ -80,7 +80,10 @@ module AppOpticsAPM
|
|
80
80
|
opts.merge!(:Spec => 'error',
|
81
81
|
:ErrorClass => exception.class.name,
|
82
82
|
:ErrorMsg => exception.message)
|
83
|
-
|
83
|
+
|
84
|
+
if exception.respond_to?(:backtrace) && exception.backtrace
|
85
|
+
opts.merge!(:Backtrace => exception.backtrace.join("\r\n"))
|
86
|
+
end
|
84
87
|
|
85
88
|
exception.instance_variable_set(:@exn_logged, true)
|
86
89
|
log(layer, :error, opts)
|
@@ -205,6 +208,7 @@ module AppOpticsAPM
|
|
205
208
|
def log_info(layer, opts = {})
|
206
209
|
return AppOpticsAPM::Context.toString unless AppOpticsAPM.tracing?
|
207
210
|
|
211
|
+
opts[:Spec] = 'info'
|
208
212
|
log_event(layer, :info, AppOpticsAPM::Context.createEvent, opts)
|
209
213
|
end
|
210
214
|
|
@@ -24,16 +24,14 @@ module AppOpticsAPM
|
|
24
24
|
|
25
25
|
# Internal: Get the current backtrace.
|
26
26
|
#
|
27
|
-
#
|
28
|
-
#
|
29
|
-
# made.
|
27
|
+
# from - int, from position in array of backtraces
|
28
|
+
# to - int, end position in array of backtraces, can be negative to count from the end
|
30
29
|
#
|
31
30
|
# Returns a string with each frame of the backtrace separated by '\r\n'.
|
32
31
|
#
|
33
|
-
def backtrace(
|
32
|
+
def backtrace(from = 0, to = -1)
|
34
33
|
bt = Kernel.caller
|
35
|
-
bt.
|
36
|
-
trim_backtrace(bt).join("\r\n")
|
34
|
+
trim_backtrace(bt[from..to]).join("\r\n")
|
37
35
|
end
|
38
36
|
|
39
37
|
# Internal: Trim a backtrace to a manageable size
|
@@ -115,7 +113,7 @@ module AppOpticsAPM
|
|
115
113
|
end
|
116
114
|
|
117
115
|
def xtrace_v2?(xtr)
|
118
|
-
|
116
|
+
xtr && xtr.start_with?('2B')
|
119
117
|
end
|
120
118
|
end
|
121
119
|
end
|
data/lib/appoptics_apm/config.rb
CHANGED
@@ -16,7 +16,7 @@ module AppOpticsAPM
|
|
16
16
|
@@instrumentation = [:action_controller, :action_controller_api, :action_view,
|
17
17
|
:active_record, :bunnyclient, :bunnyconsumer, :cassandra, :curb,
|
18
18
|
:dalli, :delayed_jobclient, :delayed_jobworker,
|
19
|
-
:excon, :faraday, :grpc_client, :grpc_server, :grape,
|
19
|
+
:excon, :faraday, :graphql, :grpc_client, :grpc_server, :grape,
|
20
20
|
:httpclient, :nethttp, :memcached, :mongo, :moped, :padrino, :rack, :redis,
|
21
21
|
:resqueclient, :resqueworker, :rest_client,
|
22
22
|
:sequel, :sidekiqclient, :sidekiqworker, :sinatra, :typhoeus]
|
@@ -53,7 +53,8 @@ module AppOpticsAPM
|
|
53
53
|
end
|
54
54
|
|
55
55
|
def error_response_with_appoptics(error = {})
|
56
|
-
|
56
|
+
response = error_response_without_appoptics(error)
|
57
|
+
status, headers, _body = response.finish
|
57
58
|
|
58
59
|
xtrace = AppOpticsAPM::Context.toString
|
59
60
|
|
@@ -77,7 +78,7 @@ module AppOpticsAPM
|
|
77
78
|
end
|
78
79
|
end
|
79
80
|
|
80
|
-
|
81
|
+
response
|
81
82
|
end
|
82
83
|
end
|
83
84
|
end
|
@@ -58,7 +58,7 @@ module AppOpticsAPM
|
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
|
-
if defined?(Padrino) &&
|
61
|
+
if defined?(Padrino) && AppOpticsAPM::Config[:padrino][:enabled]
|
62
62
|
# This instrumentation is a superset of the Sinatra instrumentation similar
|
63
63
|
# to how Padrino is a superset of Sinatra itself.
|
64
64
|
AppOpticsAPM.logger.info '[appoptics_apm/loading] Instrumenting Padrino' if AppOpticsAPM::Config[:verbose]
|
@@ -73,7 +73,7 @@ module AppOpticsAPM
|
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
76
|
-
if defined?(Sinatra) &&
|
76
|
+
if defined?(Sinatra) && AppOpticsAPM::Config[:sinatra][:enabled]
|
77
77
|
require 'appoptics_apm/inst/rack'
|
78
78
|
|
79
79
|
AppOpticsAPM.logger.info '[appoptics_apm/loading] Instrumenting Sinatra' if AppOpticsAPM::Config[:verbose]
|
@@ -0,0 +1,215 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
#--
|
4
|
+
# Copyright (c) 2019 SolarWinds, LLC.
|
5
|
+
# All rights reserved.
|
6
|
+
#++
|
7
|
+
|
8
|
+
# initial version of this instrumentation:
|
9
|
+
# https://github.com/librato/api/blob/master/graph/tracing/appoptics.rb
|
10
|
+
#
|
11
|
+
|
12
|
+
# TODO: make sure this stays up to date with
|
13
|
+
# ____ what is in the graphql gem and vice-versa
|
14
|
+
|
15
|
+
|
16
|
+
if defined?(GraphQL::Tracing)
|
17
|
+
module GraphQL
|
18
|
+
module Tracing
|
19
|
+
# AppOpticsTracing in the graphql gem may be a different version than the
|
20
|
+
# one defined here, we want to use the newer one
|
21
|
+
dont_redefine = false
|
22
|
+
this_version = Gem::Version.new('1.0.0')
|
23
|
+
|
24
|
+
if defined?(GraphQL::Tracing::AppOpticsTracing)
|
25
|
+
if this_version > GraphQL::Tracing::AppOpticsTracing.version
|
26
|
+
send(:remove_const, :AppOpticsTracing)
|
27
|
+
else
|
28
|
+
dont_redefine = true
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
unless dont_redefine
|
33
|
+
#-----------------------------------------------------------------------------#
|
34
|
+
#----- this class is duplicated in the graphql gem ---------------------------#
|
35
|
+
#-----------------------------------------------------------------------------#
|
36
|
+
class AppOpticsTracing < GraphQL::Tracing::PlatformTracing
|
37
|
+
# These GraphQL events will show up as 'graphql.prep' spans
|
38
|
+
PREP_KEYS = ['lex', 'parse', 'validate', 'analyze_query', 'analyze_multiplex'].freeze
|
39
|
+
EXEC_KEYS = ['execute_multiplex', 'execute_query', 'execute_query_lazy'].freeze
|
40
|
+
|
41
|
+
# During auto-instrumentation this version of AppOpticsTracing is compared
|
42
|
+
# with the version provided in the graphql gem, so that the newer
|
43
|
+
# version of the class can be used
|
44
|
+
|
45
|
+
def self.version
|
46
|
+
Gem::Version.new('1.0.0')
|
47
|
+
end
|
48
|
+
|
49
|
+
self.platform_keys = {
|
50
|
+
'lex' => 'lex',
|
51
|
+
'parse' => 'parse',
|
52
|
+
'validate' => 'validate',
|
53
|
+
'analyze_query' => 'analyze_query',
|
54
|
+
'analyze_multiplex' => 'analyze_multiplex',
|
55
|
+
'execute_multiplex' => 'execute_multiplex',
|
56
|
+
'execute_query' => 'execute_query',
|
57
|
+
'execute_query_lazy' => 'execute_query_lazy'
|
58
|
+
}
|
59
|
+
|
60
|
+
def platform_trace(platform_key, _key, data)
|
61
|
+
return yield if !defined?(AppOpticsAPM) || gql_config[:enabled] == false
|
62
|
+
|
63
|
+
layer = span_name(platform_key)
|
64
|
+
kvs = metadata(data, layer)
|
65
|
+
kvs[:Key] = platform_key if (PREP_KEYS + EXEC_KEYS).include?(platform_key)
|
66
|
+
|
67
|
+
transaction_name(kvs[:InboundQuery]) if kvs[:InboundQuery] && layer == 'graphql.execute'
|
68
|
+
|
69
|
+
::AppOpticsAPM::SDK.trace(layer, kvs) do
|
70
|
+
kvs.clear # we don't have to send them twice
|
71
|
+
yield
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def platform_field_key(type, field)
|
76
|
+
"graphql.#{type.name}.#{field.name}"
|
77
|
+
end
|
78
|
+
|
79
|
+
private
|
80
|
+
|
81
|
+
def gql_config
|
82
|
+
::AppOpticsAPM::Config[:graphql] ||= {}
|
83
|
+
end
|
84
|
+
|
85
|
+
def transaction_name(query)
|
86
|
+
return if gql_config[:transaction_name] == false ||
|
87
|
+
::AppOpticsAPM::SDK.get_transaction_name
|
88
|
+
|
89
|
+
split_query = query.strip.split(/\W+/, 3)
|
90
|
+
split_query[0] = 'query' if split_query[0].empty?
|
91
|
+
name = "graphql.#{split_query[0..1].join('.')}"
|
92
|
+
|
93
|
+
::AppOpticsAPM::SDK.set_transaction_name(name)
|
94
|
+
end
|
95
|
+
|
96
|
+
def multiplex_transaction_name(names)
|
97
|
+
return if gql_config[:transaction_name] == false ||
|
98
|
+
::AppOpticsAPM::SDK.get_transaction_name
|
99
|
+
|
100
|
+
name = "graphql.multiplex.#{names.join('.')}"
|
101
|
+
name = "#{name[0..251]}..." if name.length > 254
|
102
|
+
|
103
|
+
::AppOpticsAPM::SDK.set_transaction_name(name)
|
104
|
+
end
|
105
|
+
|
106
|
+
def span_name(key)
|
107
|
+
return 'graphql.prep' if PREP_KEYS.include?(key)
|
108
|
+
return 'graphql.execute' if EXEC_KEYS.include?(key)
|
109
|
+
|
110
|
+
key[/^graphql\./] ? key : "graphql.#{key}"
|
111
|
+
end
|
112
|
+
|
113
|
+
# rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
114
|
+
def metadata(data, layer)
|
115
|
+
data.keys.map do |key|
|
116
|
+
case key
|
117
|
+
when :context
|
118
|
+
graphql_context(data[key], layer)
|
119
|
+
when :query
|
120
|
+
graphql_query(data[key])
|
121
|
+
when :query_string
|
122
|
+
graphql_query_string(data[key])
|
123
|
+
when :multiplex
|
124
|
+
graphql_multiplex(data[key])
|
125
|
+
else
|
126
|
+
[key, data[key]]
|
127
|
+
end
|
128
|
+
end.flatten.each_slice(2).to_h.merge(Spec: 'graphql')
|
129
|
+
end
|
130
|
+
# rubocop:enable Metrics/AbcSize, Metrics/MethodLength
|
131
|
+
|
132
|
+
def graphql_context(context, layer)
|
133
|
+
context.errors && context.errors.each do |err|
|
134
|
+
AppOpticsAPM::API.log_exception(layer, err)
|
135
|
+
end
|
136
|
+
|
137
|
+
[[:Path, context.path.join('.')]]
|
138
|
+
end
|
139
|
+
|
140
|
+
def graphql_query(query)
|
141
|
+
return [] unless query
|
142
|
+
|
143
|
+
query_string = query.query_string
|
144
|
+
query_string = remove_comments(query_string) if gql_config[:remove_comments] != false
|
145
|
+
query_string = sanitize(query_string) if gql_config[:sanitize_query] != false
|
146
|
+
|
147
|
+
[[:InboundQuery, query_string],
|
148
|
+
[:Operation, query.selected_operation_name]]
|
149
|
+
end
|
150
|
+
|
151
|
+
def graphql_query_string(query_string)
|
152
|
+
query_string = remove_comments(query_string) if gql_config[:remove_comments] != false
|
153
|
+
query_string = sanitize(query_string) if gql_config[:sanitize_query] != false
|
154
|
+
|
155
|
+
[:InboundQuery, query_string]
|
156
|
+
end
|
157
|
+
|
158
|
+
def graphql_multiplex(data)
|
159
|
+
names = data.queries.map(&:operations).map(&:keys).flatten.compact
|
160
|
+
multiplex_transaction_name(names) if names.size > 1
|
161
|
+
|
162
|
+
[:Operations, names.join(', ')]
|
163
|
+
end
|
164
|
+
|
165
|
+
def sanitize(query)
|
166
|
+
return unless query
|
167
|
+
|
168
|
+
# remove arguments
|
169
|
+
query.gsub(/"[^"]*"/, '"?"') # strings
|
170
|
+
.gsub(/-?[0-9]*\.?[0-9]+e?[0-9]*/, '?') # ints + floats
|
171
|
+
.gsub(/\[[^\]]*\]/, '[?]') # arrays
|
172
|
+
end
|
173
|
+
|
174
|
+
def remove_comments(query)
|
175
|
+
return unless query
|
176
|
+
|
177
|
+
query.gsub(/#[^\n\r]*/, '')
|
178
|
+
end
|
179
|
+
end
|
180
|
+
#-----------------------------------------------------------------------------#
|
181
|
+
end
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
module AppOpticsAPM
|
186
|
+
module GraphQLSchemaPrepend
|
187
|
+
def use(plugin, options = {})
|
188
|
+
super unless GraphQL::Schema.plugins.find { |pl| pl[0].to_s == plugin.to_s }
|
189
|
+
|
190
|
+
GraphQL::Schema.plugins
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
# rubocop:disable Style/RedundantSelf
|
195
|
+
module GraphQLErrorPrepend
|
196
|
+
def initialize(*args)
|
197
|
+
super
|
198
|
+
bt = AppOpticsAPM::API.backtrace(1)
|
199
|
+
set_backtrace(bt) unless self.backtrace
|
200
|
+
end
|
201
|
+
end
|
202
|
+
# rubocop:enable Style/RedundantSelf
|
203
|
+
end
|
204
|
+
|
205
|
+
if defined?(GraphQL::Schema)
|
206
|
+
GraphQL::Schema.singleton_class.prepend(AppOpticsAPM::GraphQLSchemaPrepend)
|
207
|
+
GraphQL::Schema.use(GraphQL::Tracing::AppOpticsTracing)
|
208
|
+
end
|
209
|
+
|
210
|
+
# rubocop:disable Style/IfUnlessModifier
|
211
|
+
if defined?(GraphQL::Error)
|
212
|
+
GraphQL::Error.prepend(AppOpticsAPM::GraphQLErrorPrepend)
|
213
|
+
end
|
214
|
+
# rubocop:enable Style/IfUnlessModifier
|
215
|
+
end
|
@@ -25,7 +25,7 @@ module AppOpticsAPM
|
|
25
25
|
# * +exception+ - an exception, must respond to :message and :backtrace
|
26
26
|
# * +opts+ - (optional) hash containing key/value pairs that will be reported with this span.
|
27
27
|
#
|
28
|
-
def log_exception(exception, opts)
|
28
|
+
def log_exception(exception, opts = {})
|
29
29
|
AppOpticsAPM::API.log_exception(AppOpticsAPM.layer, exception, opts)
|
30
30
|
end
|
31
31
|
|
@@ -300,7 +300,7 @@ module AppOpticsAPM
|
|
300
300
|
end
|
301
301
|
|
302
302
|
AppOpticsAPM::SDK.trace(span, report_kvs) do
|
303
|
-
report_kvs[:Backtrace] = AppOpticsAPM::API.backtrace
|
303
|
+
report_kvs[:Backtrace] = AppOpticsAPM::API.backtrace if backtrace
|
304
304
|
send(without_appoptics, *args, &block)
|
305
305
|
end
|
306
306
|
end
|
@@ -311,7 +311,7 @@ module AppOpticsAPM
|
|
311
311
|
elsif class_method
|
312
312
|
klass.define_singleton_method(with_appoptics) do |*args, &block|
|
313
313
|
AppOpticsAPM::SDK.trace(span, report_kvs) do
|
314
|
-
report_kvs[:Backtrace] = AppOpticsAPM::API.backtrace
|
314
|
+
report_kvs[:Backtrace] = AppOpticsAPM::API.backtrace if backtrace
|
315
315
|
send(without_appoptics, *args, &block)
|
316
316
|
end
|
317
317
|
end
|
@@ -411,7 +411,7 @@ module AppOpticsAPM
|
|
411
411
|
#
|
412
412
|
# === Example:
|
413
413
|
#
|
414
|
-
# unless
|
414
|
+
# unless AppOpticsAPM::SDK.appoptics_ready?(10_000)
|
415
415
|
# Logger.info "AppOptics not ready after 10 seconds, no metrics will be sent"
|
416
416
|
# end
|
417
417
|
#
|
@@ -424,7 +424,7 @@ module AppOpticsAPM
|
|
424
424
|
# OBOE_SERVER_RESPONSE_LIMIT_EXCEEDED 3
|
425
425
|
# OBOE_SERVER_RESPONSE_INVALID_API_KEY 4
|
426
426
|
# OBOE_SERVER_RESPONSE_CONNECT_ERROR 5
|
427
|
-
|
427
|
+
AppOpticsAPM::Context.isReady(wait_milliseconds) == 1
|
428
428
|
end
|
429
429
|
end
|
430
430
|
|
@@ -7,8 +7,8 @@ module AppOpticsAPM
|
|
7
7
|
# appoptics_apm.gemspec during gem build process
|
8
8
|
module Version
|
9
9
|
MAJOR = 4 # breaking,
|
10
|
-
MINOR =
|
11
|
-
PATCH =
|
10
|
+
MINOR = 11 # feature,
|
11
|
+
PATCH = 0 # fix => BFF
|
12
12
|
|
13
13
|
STRING = [MAJOR, MINOR, PATCH].compact.join('.')
|
14
14
|
end
|
data/lib/oboe_metal.rb
CHANGED
@@ -5,7 +5,7 @@ require 'thread'
|
|
5
5
|
|
6
6
|
# Disable docs and Camelcase warns since we're implementing
|
7
7
|
# an interface here. See OboeBase for details.
|
8
|
-
# rubocop:disable Style/Documentation,
|
8
|
+
# rubocop:disable Style/Documentation, Naming/MethodName
|
9
9
|
module AppOpticsAPM
|
10
10
|
extend AppOpticsAPMBase
|
11
11
|
include Oboe_metal
|
@@ -20,26 +20,28 @@ module AppOpticsAPM
|
|
20
20
|
|
21
21
|
private
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
23
|
+
# rubocop:disable Metrics/MethodLength
|
24
|
+
def print_header
|
25
|
+
say ""
|
26
|
+
say shell.set_color "Welcome to the AppOpticsAPM Ruby instrumentation setup.", :green, :bold
|
27
|
+
say ""
|
28
|
+
say shell.set_color "Documentation Links", :magenta
|
29
|
+
say "-------------------"
|
30
|
+
say ""
|
31
|
+
say "AppOpticsAPM Installation Overview:"
|
32
|
+
say "http://docs.appoptics.solarwinds.com/AppOpticsAPM/install-instrumentation.html"
|
33
|
+
say ""
|
34
|
+
say "More information on instrumenting Ruby applications can be found here:"
|
35
|
+
say "http://docs.appoptics.solarwinds.com/Instrumentation/ruby.html#installing-ruby-instrumentation"
|
36
|
+
end
|
37
|
+
# rubocop:enable Metrics/MethodLength
|
38
|
+
|
39
|
+
def print_footer
|
40
|
+
say ""
|
41
|
+
say "You can change configuration values in the future by modifying config/initializers/appoptics_apm.rb"
|
42
|
+
say ""
|
43
|
+
say "Thanks! Creating the AppOpticsAPM initializer..."
|
44
|
+
say ""
|
45
|
+
end
|
44
46
|
end
|
45
47
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# AppOpticsAPM Initializer (for the appoptics_apm gem)
|
2
4
|
# https://www.appoptics.com/
|
3
5
|
#
|
@@ -110,6 +112,25 @@ if defined?(AppOpticsAPM::Config)
|
|
110
112
|
AppOpticsAPM::Config[:sanitize_sql_regexp] = '(\'[^\']*\'|\d*\.\d+|\d+|NULL)'
|
111
113
|
AppOpticsAPM::Config[:sanitize_sql_opts] = Regexp::IGNORECASE
|
112
114
|
|
115
|
+
#
|
116
|
+
# GraphQL
|
117
|
+
#
|
118
|
+
# Enable tracing for GraphQL.
|
119
|
+
# (true | false, default: true)
|
120
|
+
AppOpticsAPM::Config[:graphql][:enabled] = true
|
121
|
+
# Replace query arguments with a '?' when sent with a trace.
|
122
|
+
# (true | false, default: true)
|
123
|
+
AppOpticsAPM::Config[:graphql][:sanitize] = true
|
124
|
+
# Remove comments from queries when sent with a trace.
|
125
|
+
# (true | false, default: true)
|
126
|
+
AppOpticsAPM::Config[:graphql][:remove_comments] = true
|
127
|
+
# Create a transaction name by combining
|
128
|
+
# "query" or "mutation" with the first word of the query.
|
129
|
+
# This overwrites the default transaction name, which is a combination of
|
130
|
+
# controller + action and would be the same for all graphql queries.
|
131
|
+
# (true | false, default: true)
|
132
|
+
AppOpticsAPM::Config[:graphql][:transaction_name] = true
|
133
|
+
|
113
134
|
#
|
114
135
|
# Do Not Trace - DNT
|
115
136
|
#
|
@@ -136,7 +157,6 @@ if defined?(AppOpticsAPM::Config)
|
|
136
157
|
#
|
137
158
|
AppOpticsAPM::Config[:dnt_regexp] = '\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|pdf|txt|tar|wav|bmp|rtf|js|flv|swf|otf|eot|ttf|woff|woff2|svg|less)(\?.+){0,1}$'
|
138
159
|
AppOpticsAPM::Config[:dnt_opts] = Regexp::IGNORECASE
|
139
|
-
#
|
140
160
|
|
141
161
|
#
|
142
162
|
# Transaction Settings
|
@@ -164,21 +184,20 @@ if defined?(AppOpticsAPM::Config)
|
|
164
184
|
#
|
165
185
|
AppOpticsAPM::Config[:transaction_settings] = {
|
166
186
|
url: [
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
187
|
+
# {
|
188
|
+
# extensions: %w['long_job'],
|
189
|
+
# tracing: :disabled
|
190
|
+
# },
|
191
|
+
# {
|
192
|
+
# regexp: '^.*\/long_job\/.*$',
|
193
|
+
# opts: Regexp::IGNORECASE,
|
194
|
+
# tracing: :disabled
|
195
|
+
# },
|
196
|
+
# {
|
197
|
+
# regexp: /batch/,
|
198
|
+
# }
|
179
199
|
]
|
180
200
|
}
|
181
|
-
#
|
182
201
|
|
183
202
|
#
|
184
203
|
# Blacklist urls
|
@@ -192,7 +211,6 @@ if defined?(AppOpticsAPM::Config)
|
|
192
211
|
# Example: AppOpticsAPM::Config[:blacklist] = ['google.com']
|
193
212
|
#
|
194
213
|
AppOpticsAPM::Config[:blacklist] = []
|
195
|
-
#
|
196
214
|
|
197
215
|
#
|
198
216
|
# Rails Exception Logging
|
@@ -203,7 +221,6 @@ if defined?(AppOpticsAPM::Config)
|
|
203
221
|
# report all raised exceptions regardless.
|
204
222
|
#
|
205
223
|
AppOpticsAPM::Config[:report_rescued_errors] = false
|
206
|
-
#
|
207
224
|
|
208
225
|
#
|
209
226
|
# EC2 Metadata Fetching Timeout
|
@@ -215,7 +232,6 @@ if defined?(AppOpticsAPM::Config)
|
|
215
232
|
#
|
216
233
|
AppOpticsAPM::Config[:ec2_metadata_timeout] = 1000
|
217
234
|
|
218
|
-
|
219
235
|
#############################################
|
220
236
|
## SETTINGS FOR INDIVIDUAL GEMS/FRAMEWORKS ##
|
221
237
|
#############################################
|
@@ -238,7 +254,6 @@ if defined?(AppOpticsAPM::Config)
|
|
238
254
|
#
|
239
255
|
AppOpticsAPM::Config[:bunnyconsumer][:controller] = :app_id
|
240
256
|
AppOpticsAPM::Config[:bunnyconsumer][:action] = :type
|
241
|
-
#
|
242
257
|
|
243
258
|
#
|
244
259
|
# Enabling/Disabling Instrumentation
|
@@ -282,7 +297,6 @@ if defined?(AppOpticsAPM::Config)
|
|
282
297
|
AppOpticsAPM::Config[:sidekiqworker][:enabled] = true
|
283
298
|
AppOpticsAPM::Config[:sinatra][:enabled] = true
|
284
299
|
AppOpticsAPM::Config[:typhoeus][:enabled] = true
|
285
|
-
#
|
286
300
|
|
287
301
|
#
|
288
302
|
# Argument logging
|
@@ -305,7 +319,6 @@ if defined?(AppOpticsAPM::Config)
|
|
305
319
|
AppOpticsAPM::Config[:sidekiqclient][:log_args] = true
|
306
320
|
AppOpticsAPM::Config[:sidekiqworker][:log_args] = true
|
307
321
|
AppOpticsAPM::Config[:typhoeus][:log_args] = true
|
308
|
-
#
|
309
322
|
|
310
323
|
#
|
311
324
|
# Enabling/Disabling Backtrace Collection
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appoptics_apm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maia Engeli
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2020-01-14 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: json
|
@@ -30,20 +30,20 @@ dependencies:
|
|
30
30
|
name: no_proxy_fix
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
32
32
|
requirements:
|
33
|
-
- - "
|
33
|
+
- - ">="
|
34
34
|
- !ruby/object:Gem::Version
|
35
35
|
version: 0.1.2
|
36
|
-
- - "
|
36
|
+
- - "~>"
|
37
37
|
- !ruby/object:Gem::Version
|
38
38
|
version: 0.1.2
|
39
39
|
type: :runtime
|
40
40
|
prerelease: false
|
41
41
|
version_requirements: !ruby/object:Gem::Requirement
|
42
42
|
requirements:
|
43
|
-
- - "
|
43
|
+
- - ">="
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: 0.1.2
|
46
|
-
- - "
|
46
|
+
- - "~>"
|
47
47
|
- !ruby/object:Gem::Version
|
48
48
|
version: 0.1.2
|
49
49
|
- !ruby/object:Gem::Dependency
|
@@ -60,6 +60,20 @@ dependencies:
|
|
60
60
|
- - ">="
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: 0.9.0
|
63
|
+
- !ruby/object:Gem::Dependency
|
64
|
+
name: irb
|
65
|
+
requirement: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 1.0.0
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 1.0.0
|
63
77
|
- !ruby/object:Gem::Dependency
|
64
78
|
name: byebug
|
65
79
|
requirement: !ruby/object:Gem::Requirement
|
@@ -88,6 +102,20 @@ dependencies:
|
|
88
102
|
- - ">="
|
89
103
|
- !ruby/object:Gem::Version
|
90
104
|
version: 1.5.0
|
105
|
+
- !ruby/object:Gem::Dependency
|
106
|
+
name: minitest-focus
|
107
|
+
requirement: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: 1.1.2
|
112
|
+
type: :development
|
113
|
+
prerelease: false
|
114
|
+
version_requirements: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - ">="
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: 1.1.2
|
91
119
|
- !ruby/object:Gem::Dependency
|
92
120
|
name: benchmark-ips
|
93
121
|
requirement: !ruby/object:Gem::Requirement
|
@@ -105,7 +133,7 @@ dependencies:
|
|
105
133
|
description: 'Automatic tracing and metrics for Ruby applications. Get started at
|
106
134
|
appoptics.com. @AppOptics
|
107
135
|
|
108
|
-
'
|
136
|
+
'
|
109
137
|
email: support@appoptics.com
|
110
138
|
executables:
|
111
139
|
- appoptics_apm_config
|
@@ -176,6 +204,7 @@ files:
|
|
176
204
|
- lib/appoptics_apm/inst/em-http-request.rb
|
177
205
|
- lib/appoptics_apm/inst/excon.rb
|
178
206
|
- lib/appoptics_apm/inst/faraday.rb
|
207
|
+
- lib/appoptics_apm/inst/graphql.rb
|
179
208
|
- lib/appoptics_apm/inst/grpc_client.rb
|
180
209
|
- lib/appoptics_apm/inst/grpc_server.rb
|
181
210
|
- lib/appoptics_apm/inst/http.rb
|
@@ -225,7 +254,7 @@ files:
|
|
225
254
|
- yardoc_frontpage.md
|
226
255
|
homepage: https://www.appoptics.com/
|
227
256
|
licenses:
|
228
|
-
- Librato Open License, Version 1.0
|
257
|
+
- Librato Open License, Version 1.0, https://bit.ly/2Kmm0mN
|
229
258
|
metadata:
|
230
259
|
changelog_uri: https://github.com/appoptics/appoptics-apm-ruby/releases
|
231
260
|
documentation_uri: https://docs.appoptics.com/kb/apm_tracing/ruby/
|
@@ -246,8 +275,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
246
275
|
- !ruby/object:Gem::Version
|
247
276
|
version: '0'
|
248
277
|
requirements: []
|
249
|
-
|
250
|
-
rubygems_version: 2.6.11
|
278
|
+
rubygems_version: 3.0.3
|
251
279
|
signing_key:
|
252
280
|
specification_version: 4
|
253
281
|
summary: AppOptics APM performance instrumentation gem for Ruby
|