instrument_all_the_things 1.0.1 → 1.0.2

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: c02770ff0eb1a16c0ceb0445d79fa72da37730f63af5cb6eb1c3d91ae1515e15
4
- data.tar.gz: 633c041ff8ba1c7a69eb379b1e88d5747efba79fd2329f807542f2a8214bf533
3
+ metadata.gz: 8bcc57ca40a267c78c39c37d55711d1ca2ca33637c115b293e9f679b5950b6e7
4
+ data.tar.gz: 720d12fbd72e5c7bb7b82f9088c882037cc6c2ba675f3f7c097bfcfdb03771e5
5
5
  SHA512:
6
- metadata.gz: aa97a7e5bc661000c27347f2f384dc9ca123dae7b3fd9a4c58e62d89e628b1e669baf29b1a8e50bbc53402ca479a765e3d46b94d5cf38b6db623abadca90a8c0
7
- data.tar.gz: f429c6957026f341c459fb7d82abd6d7e58ecadef663af04e6639a7889ce69122ba995424dd9471542d3d4434f9ee10c6f528bd62d2f340dcfcedb6c6306ef1c
6
+ metadata.gz: 2a99e6d00c90458e247bb4a018d2abd23774aec7d2c660bdad9e0e6e22dc9b29058e2d605f4dd0fa126084bb2163721fb1e2e8670b1521c488718d3e1d225010
7
+ data.tar.gz: 9e9ea9639a45dd1f766882bb2ae355a4e9029a388a9421849d681389d8595de5f7cf81ac38f7648add79b4db7582320bc33ccdf057cc352e6634b6ee8c392dad
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- instrument_all_the_things (1.0.1)
4
+ instrument_all_the_things (1.0.2)
5
5
  ddtrace
6
6
  dogstatsd-ruby
7
7
 
data/README.md CHANGED
@@ -23,7 +23,7 @@ Or install it yourself as:
23
23
  $ gem install instrument_all_the_things
24
24
 
25
25
  ## Usage
26
- *Note:* For convenience the InstrumentAllTheThings constant is aliased to IATT.
26
+ *Note:* For convenience the InstrumentAllTheThings constant is aliased to IATT unless the constant is already defined.
27
27
 
28
28
 
29
29
  ## Method Instrumentation
@@ -368,4 +368,4 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
368
368
 
369
369
  ## Contributing
370
370
 
371
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/instrument_all_the_things.
371
+ Bug reports and pull requests are welcome on GitHub at https://github.com/GetTerminus/instrument_all_the_things.
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'pry'
4
3
  lib = File.expand_path('lib', __dir__)
5
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
6
5
  require 'instrument_all_the_things/version'
@@ -67,4 +67,4 @@ module InstrumentAllTheThings
67
67
  end
68
68
  end
69
69
 
70
- IATT = InstrumentAllTheThings
70
+ IATT = InstrumentAllTheThings unless defined?(IATT)
@@ -34,7 +34,7 @@ module InstrumentAllTheThings
34
34
 
35
35
  e.instance_variable_set(:@_logged_by_iatt, true)
36
36
 
37
- IATT.logger&.error <<~ERROR
37
+ InstrumentAllTheThings.logger&.error <<~ERROR
38
38
  An error occurred in #{context.trace_name(klass)}
39
39
 
40
40
  #{e.message}
@@ -22,7 +22,7 @@ module InstrumentAllTheThings
22
22
  end
23
23
 
24
24
  report_value = proc do |klass, stat_name, value|
25
- IATT.stat_reporter.histogram(
25
+ InstrumentAllTheThings.stat_reporter.histogram(
26
26
  context.stats_name(klass) + ".#{stat_name}_change",
27
27
  value
28
28
  )
@@ -37,7 +37,7 @@ module InstrumentAllTheThings
37
37
  new_value - starting_value
38
38
  end
39
39
 
40
- if (span = IATT.tracer.active_span)
40
+ if (span = InstrumentAllTheThings.tracer.active_span)
41
41
  span.set_tag('gc_stats', diff)
42
42
  end
43
43
 
@@ -4,17 +4,20 @@ require_relative './instrumentors/all'
4
4
 
5
5
  module InstrumentAllTheThings
6
6
  class MethodInstrumentor
7
- WAPPERS = {
8
- trace: Instrumentors::TRACE_WRAPPER,
9
- error_logging: Instrumentors::ERROR_LOGGING_WRAPPER,
7
+ WRAPPERS = {
8
+ # Note that the order of these hash keys are applied top to bottom, with the first inserted key
9
+ # being the inner most wrapper
10
10
  gc_stats: Instrumentors::GC_STATS_WRAPPER,
11
+ error_logging: Instrumentors::ERROR_LOGGING_WRAPPER,
11
12
  execution_counts_and_timing: Instrumentors::EXECUTION_COUNT_AND_TIMING_WRAPPER,
13
+ trace: Instrumentors::TRACE_WRAPPER,
12
14
  }.freeze
13
15
 
14
16
  DEFAULT_OPTIONS = {
15
17
  trace: true,
16
18
  gc_stats: true,
17
19
  error_logging: true,
20
+ execution_counts_and_timing: true
18
21
  }.freeze
19
22
 
20
23
  attr_accessor :options, :instrumentor
@@ -28,7 +31,7 @@ module InstrumentAllTheThings
28
31
  end
29
32
 
30
33
  def build_instrumentor
31
- procs = WAPPERS.collect do |type, builder|
34
+ procs = WRAPPERS.collect do |type, builder|
32
35
  next unless options[type]
33
36
 
34
37
  builder.call(options[type], options[:context])
@@ -4,12 +4,12 @@ module InstrumentAllTheThings
4
4
  module Testing
5
5
  module RSpecMatchers
6
6
  def histogram_value(counter_name)
7
- stats = IATT.stat_reporter.emitted_values[:histogram][counter_name]
7
+ stats = InstrumentAllTheThings.stat_reporter.emitted_values[:histogram][counter_name]
8
8
  stats.inject(0){|l, n| l + n[:args][0] }
9
9
  end
10
10
 
11
11
  def distribution_values(distribution_name, with_tags: nil)
12
- stats = IATT.stat_reporter.emitted_values[:distribution][distribution_name]
12
+ stats = InstrumentAllTheThings.stat_reporter.emitted_values[:distribution][distribution_name]
13
13
 
14
14
  if with_tags && !stats.empty?
15
15
  stats = stats.select do |s|
@@ -21,7 +21,7 @@ module InstrumentAllTheThings
21
21
  end
22
22
 
23
23
  def histogram_values(histogram_name, with_tags: nil)
24
- stats = IATT.stat_reporter.emitted_values[:histogram][histogram_name]
24
+ stats = InstrumentAllTheThings.stat_reporter.emitted_values[:histogram][histogram_name]
25
25
 
26
26
  if with_tags && !stats.empty?
27
27
  stats = stats.select do |s|
@@ -33,7 +33,7 @@ module InstrumentAllTheThings
33
33
  end
34
34
 
35
35
  def timing_values(timing_name, with_tags: nil)
36
- stats = IATT.stat_reporter.emitted_values[:timing][timing_name]
36
+ stats = InstrumentAllTheThings.stat_reporter.emitted_values[:timing][timing_name]
37
37
 
38
38
  if with_tags && !stats.empty?
39
39
  stats = stats.select do |s|
@@ -45,7 +45,7 @@ module InstrumentAllTheThings
45
45
  end
46
46
 
47
47
  def set_value(counter_name, with_tags: nil)
48
- stats = IATT.stat_reporter.emitted_values[:set][counter_name]
48
+ stats = InstrumentAllTheThings.stat_reporter.emitted_values[:set][counter_name]
49
49
 
50
50
  if with_tags && !stats.empty?
51
51
  stats = stats.select do |s|
@@ -58,7 +58,7 @@ module InstrumentAllTheThings
58
58
  end
59
59
 
60
60
  def gauge_value(counter_name, with_tags: nil)
61
- stats = IATT.stat_reporter.emitted_values[:gauge][counter_name]
61
+ stats = InstrumentAllTheThings.stat_reporter.emitted_values[:gauge][counter_name]
62
62
 
63
63
  if with_tags && !stats.empty?
64
64
  stats = stats.select do |s|
@@ -69,7 +69,7 @@ module InstrumentAllTheThings
69
69
  end
70
70
 
71
71
  def counter_value(counter_name, with_tags: nil)
72
- stats = IATT.stat_reporter.emitted_values[:count][counter_name]
72
+ stats = InstrumentAllTheThings.stat_reporter.emitted_values[:count][counter_name]
73
73
  if with_tags && !stats.empty?
74
74
  stats = stats.select do |s|
75
75
  with_tags.all?{|t| s[:tags].include?(t) }
@@ -84,7 +84,7 @@ module InstrumentAllTheThings
84
84
 
85
85
  def emitted_spans(filtered_by: nil)
86
86
  sleep 0.01
87
- traces = IATT::Testing::TraceTracker.tracker.traces.map(&:dup)
87
+ traces = InstrumentAllTheThings::Testing::TraceTracker.tracker.traces.map(&:dup)
88
88
  if filtered_by
89
89
  filtered_by.transform_keys!(&:to_s)
90
90
  traces.select! { |t| filtered_by < t }
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module InstrumentAllTheThings
2
- VERSION = "1.0.1"
4
+ VERSION = '1.0.2'
3
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: instrument_all_the_things
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Malinconico
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-03-09 00:00:00.000000000 Z
11
+ date: 2020-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ddtrace
@@ -220,7 +220,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
220
220
  - !ruby/object:Gem::Version
221
221
  version: '0'
222
222
  requirements: []
223
- rubygems_version: 3.0.6
223
+ rubygems_version: 3.1.2
224
224
  signing_key:
225
225
  specification_version: 4
226
226
  summary: Make instrumentation with DataDog easy peasy