mnemosyne-ruby 1.1.0.rc1 → 1.1.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
  SHA1:
3
- metadata.gz: 99dce4e5dc6cc2a267e8189e7d02bec8bc06beae
4
- data.tar.gz: 0b5f1bf920009d85c5147ee52a2fdbf6fe313ce9
3
+ metadata.gz: d3041b1bd2093674c509a9d037f7fa864a06e669
4
+ data.tar.gz: 66714af6d59848f008438c18f2ac3429bdd54f23
5
5
  SHA512:
6
- metadata.gz: 77e0cd8aad0ccc076168d44f433a9dee967d7d426807fd5d8870892888523ddbe046fa5d9f3e980050abb1a3d844f7fe7d82a101a470ad160e25089925ed047b
7
- data.tar.gz: da9ad5a98a9cfded7a8358dd18f62132e238b501d82264d6b9ed04d748206814613fa1c0973cf7b484cc080a50b38e6269ff8e7d60b055910dc4500f82891be3
6
+ metadata.gz: 0bdb13b855926133b2250c82d607c35d397b744c4f2704deb9e27305067e79a212f66c2ef37f5556e1cbcde0d58c3618203c3fba063d18b7e87cffc851c60d88
7
+ data.tar.gz: bcf5d485d708c55b286788c9c8302694bec75cee1b2f2bf30da30d785bc92cd520266586809deb2b9a51df42330572a792cb73c2955524a4ed63a787fec7e7e4
data/.travis.yml CHANGED
@@ -4,9 +4,6 @@ rvm:
4
4
  - '2.4.0'
5
5
  - '2.3.3'
6
6
  - '2.2.6'
7
- - '2.1.10'
8
- before_script:
9
- - export JRUBY_OPTS="--2.0"
10
7
  before_install:
11
8
  - gem update --system
12
9
  - gem install bundler
data/CHANGELOG.md CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  ## 1.1.0
4
4
 
5
+ * Add metadata to rack instrumentation
5
6
  * Add msgr server & client instrumentation
6
7
  * Add sidekiq client instrumentation
7
8
  * Add sidekiq server instrumentation
data/README.md CHANGED
@@ -12,6 +12,7 @@ Currently supported probes:
12
12
  * Mnemosyne: Custom traces
13
13
  * Responders: render time
14
14
  * Restify: Remote calls including tracing middleware
15
+ * Sidekiq: Client and server tracing
15
16
  * Rack: Middleware for request tracing
16
17
 
17
18
  ## Installation
@@ -42,7 +42,7 @@ module Mnemosyne
42
42
 
43
43
  exchange.publish JSON.dump(message),
44
44
  persistent: true,
45
- routing_key: 'mnemosyne.trace',
45
+ routing_key: "mnemosyne.trace.#{@config.platform}",
46
46
  content_type: 'application/json'
47
47
  end
48
48
 
@@ -28,6 +28,18 @@ module Mnemosyne
28
28
  @amqp = AMQ::Settings.configure(server).freeze
29
29
  @server = make_amqp_uri(@amqp).to_s.freeze
30
30
 
31
+ raise ArgumentError.new 'Platform is required' if platform.blank?
32
+
33
+ if @platform =~ /[^a-zA-Z0-9\-]/
34
+ raise ArgumentError.new \
35
+ 'Platform may only contain alphanumeric characters'
36
+ end
37
+
38
+ unless @platform =~ /\A[a-zA-Z0-9]+(\-[a-zA-Z0-9]+)*\z/
39
+ raise ArgumentError.new \
40
+ 'Platform must start and end with a alphanumeric characters'
41
+ end
42
+
31
43
  raise ArgumentError.new('Application is required') if application.blank?
32
44
  raise ArgumentError.new('Hostname is required') if hostname.blank?
33
45
  end
@@ -54,15 +54,28 @@ module Mnemosyne
54
54
  @app = app
55
55
  end
56
56
 
57
- def call(env)
57
+ def call(env) # rubocop:disable AbcSize
58
58
  origin = env.fetch('HTTP_X_MNEMOSYNE_ORIGIN', false)
59
59
  transaction = env.fetch('HTTP_X_MNEMOSYNE_TRANSACTION') do
60
60
  ::SecureRandom.uuid
61
61
  end
62
62
 
63
+ meta = {
64
+ method: env['REQUEST_METHOD'],
65
+ path: env['REQUEST_PATH'],
66
+ query: env['QUERY_STRING'],
67
+ protocol: env['SERVER_PROTOCOL'],
68
+ headers: {
69
+ 'Accept': env['HTTP_ACCEPT'],
70
+ 'Host': env['HTTP_HOST'],
71
+ 'User-Agent': env['HTTP_USER_AGENT']
72
+ }
73
+ }
74
+
63
75
  trace = ::Mnemosyne::Instrumenter.trace 'app.web.request.rack',
64
76
  transaction: transaction,
65
- origin: origin
77
+ origin: origin,
78
+ meta: meta
66
79
 
67
80
  if trace
68
81
  trace.start!
@@ -16,10 +16,11 @@ module Mnemosyne
16
16
  def dispatch(message) # rubocop:disable AbcSize
17
17
  route = message.route
18
18
  metadata = message.metadata
19
+ headers = metadata.headers || {}
19
20
  delivery_info = message.delivery_info
20
21
 
21
- origin = metadata.headers.delete('mnemosyne.origin')
22
- transaction = metadata.headers.delete('mnemosyne.transaction') do
22
+ origin = headers.delete('mnemosyne.origin')
23
+ transaction = headers.delete('mnemosyne.transaction') do
23
24
  ::SecureRandom.uuid
24
25
  end
25
26
 
@@ -5,7 +5,7 @@ module Mnemosyne
5
5
  MAJOR = 1
6
6
  MINOR = 1
7
7
  PATCH = 0
8
- STAGE = :rc1
8
+ STAGE = nil
9
9
 
10
10
  STRING = [MAJOR, MINOR, PATCH, STAGE].reject(&:nil?).join('.')
11
11
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mnemosyne-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0.rc1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Graichen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-12 00:00:00.000000000 Z
11
+ date: 2017-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bunny
@@ -176,9 +176,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
176
176
  version: '0'
177
177
  required_rubygems_version: !ruby/object:Gem::Requirement
178
178
  requirements:
179
- - - ">"
179
+ - - ">="
180
180
  - !ruby/object:Gem::Version
181
- version: 1.3.1
181
+ version: '0'
182
182
  requirements: []
183
183
  rubyforge_project:
184
184
  rubygems_version: 2.6.11