marlowe 1.0.3 → 2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Contributing.md +71 -0
- data/History.md +31 -0
- data/{Licence.rdoc → Licence.md} +5 -5
- data/Manifest.txt +3 -4
- data/README.rdoc +121 -29
- data/Rakefile +43 -29
- data/lib/marlowe.rb +3 -1
- data/lib/marlowe/formatter.rb +3 -3
- data/lib/marlowe/middleware.rb +77 -16
- data/lib/marlowe/rails.rb +21 -4
- data/lib/marlowe/simple_formatter.rb +0 -2
- data/test/minitest_config.rb +1 -12
- data/test/test_marlowe.rb +88 -18
- metadata +121 -55
- data/.autotest +0 -25
- data/Gemfile +0 -9
- data/History.rdoc +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c9fe361f2fbf3bede39f63ffcd1a5ed43d530a1f
|
4
|
+
data.tar.gz: 518bc0e7bc871020ba7104d71cafd31ef3413fd0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9bb3bb37b9bbf674c727a6afa9c8d0911ec3a54a5b65c8fc66049727d9178ecd14380801dc8273860ada1d4d44782a06ec9bd959e450cb391ea9c6c2a00799a5
|
7
|
+
data.tar.gz: 672c0aedaf0b0c5fd9b8313bd9ed8d3e530c93906c17ce6bbfa307cddaf74d95dcd6d25a3a6eccd8146e57794146e6bfcdf676188ba57274656f887ff917b071
|
data/Contributing.md
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
## Contributing
|
2
|
+
|
3
|
+
We value any contribution to Marlowe you can provide: a bug report,
|
4
|
+
a feature request, or code contributions. Marlowe is reasonably complex
|
5
|
+
code, so there are a few contribution guidelines:
|
6
|
+
|
7
|
+
* Changes *will not* be accepted without tests. The test suite is written
|
8
|
+
with [Minitest][].
|
9
|
+
* Match our coding style.
|
10
|
+
* Use a thoughtfully-named topic branch that contains your change. Rebase
|
11
|
+
your commits into logical chunks as necessary.
|
12
|
+
* Use [quality commit messages][].
|
13
|
+
* Do not change the version number; when your patch is accepted and a release
|
14
|
+
is made, the version will be updated at that point.
|
15
|
+
* Submit a GitHub pull request with your changes.
|
16
|
+
|
17
|
+
### Test Dependencies
|
18
|
+
|
19
|
+
Marlowe uses Ryan Davis’s [Hoe][] to manage the release process, which
|
20
|
+
adds a number of rake tasks. You will mostly be interested in:
|
21
|
+
|
22
|
+
$ rake
|
23
|
+
|
24
|
+
which runs the tests the same way that:
|
25
|
+
|
26
|
+
$ rake test
|
27
|
+
$ rake travis
|
28
|
+
|
29
|
+
will do.
|
30
|
+
|
31
|
+
To assist with the installation of the development dependencies for
|
32
|
+
Marlowe, I have provided the simplest possible Gemfile pointing to the
|
33
|
+
(generated) `marlowe.gemspec` file. This will permit you to do:
|
34
|
+
|
35
|
+
$ bundle install
|
36
|
+
|
37
|
+
to get the development dependencies. If you aleady have `hoe` installed, you
|
38
|
+
can accomplish the same thing with:
|
39
|
+
|
40
|
+
$ rake newb
|
41
|
+
|
42
|
+
This task will install any missing dependencies, run the tests/specs, and
|
43
|
+
generate the RDoc.
|
44
|
+
|
45
|
+
### Workflow
|
46
|
+
|
47
|
+
Here's the most direct way to get your work merged into the project:
|
48
|
+
|
49
|
+
* Fork the project.
|
50
|
+
* Clone down your fork (`git clone
|
51
|
+
git://github.com/KineticCafe/marlowe.git`).
|
52
|
+
* Create a topic branch to contain your change (`git checkout -b
|
53
|
+
my_awesome_feature`).
|
54
|
+
* Hack away, add tests. Not necessarily in that order.
|
55
|
+
* Make sure everything still passes by running `rake`.
|
56
|
+
* If necessary, rebase your commits into logical chunks, without errors.
|
57
|
+
* Push the branch up (`git push origin my_awesome_feature`).
|
58
|
+
* Create a pull request against KineticCafe/marlowe and describe
|
59
|
+
what your change does and the why you think it should be merged.
|
60
|
+
|
61
|
+
### Contributors
|
62
|
+
|
63
|
+
* Trevor Oke [@thefury](https://github.com/thefury) created marlowe.
|
64
|
+
* Austin Ziegler [@halostatue](https://github.com/halostatue)
|
65
|
+
* Adam Solove [@asolove](https://github.com/asolove)
|
66
|
+
* Tim Morton [@tmorton](https://github.com/tmorton)
|
67
|
+
|
68
|
+
[Minitest]: https://github.com/seattlerb/minitest
|
69
|
+
[quality commit messages]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
|
70
|
+
[Hoe]: https://github.com/seattlerb/hoe
|
71
|
+
[kccoc]: https://github.com/KineticCafe/code-of-conduct
|
data/History.md
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
### 2.0 / 2016-11-16
|
2
|
+
|
3
|
+
* Breaking change: the correlation header defaults to `X-Request-Id` instead
|
4
|
+
of `Correlation-Id`.
|
5
|
+
* Breaking change: by default, the `correlation_id` is sanitized in the same
|
6
|
+
way as `ActionDispatch::RequestId` when provided from an upstream
|
7
|
+
source (only alphanumerics with dashes up to 255 characters in
|
8
|
+
length).
|
9
|
+
* Breaking change: by default, the `correlation_id` is returned to the client
|
10
|
+
as part of the response.
|
11
|
+
* Marlowe is more configurable now.
|
12
|
+
|
13
|
+
### 1.0.3 / 2016-01-15
|
14
|
+
|
15
|
+
* Update Readme example of using available formatted subclass.
|
16
|
+
* Make the correlation header name configurable
|
17
|
+
|
18
|
+
### 1.0.2 / 2015-11-24
|
19
|
+
|
20
|
+
* Add documentation for using Marlowe with [lograge][].
|
21
|
+
|
22
|
+
### 1.0.1 / 2015-10-20
|
23
|
+
|
24
|
+
* Update gemspec with homepage
|
25
|
+
* Update Rakefile
|
26
|
+
|
27
|
+
### 1.0.0 / 2015-10-16
|
28
|
+
|
29
|
+
* Initial Commit
|
30
|
+
|
31
|
+
[lograge]: https://github.com/roidrage/lograge
|
data/{Licence.rdoc → Licence.md}
RENAMED
@@ -1,8 +1,8 @@
|
|
1
|
-
|
1
|
+
## Licence
|
2
2
|
|
3
3
|
This software is available under an MIT-style licence.
|
4
4
|
|
5
|
-
*
|
5
|
+
* Copyright 2015–2016 Kinetic Cafe
|
6
6
|
|
7
7
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
8
8
|
this software and associated documentation files (the "Software"), to deal in
|
@@ -11,9 +11,9 @@ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
11
11
|
of the Software, and to permit persons to whom the Software is furnished to do
|
12
12
|
so, subject to the following conditions:
|
13
13
|
|
14
|
-
*
|
15
|
-
|
16
|
-
|
14
|
+
* The names of its contributors may not be used to endorse or promote
|
15
|
+
products derived from this software without specific prior written
|
16
|
+
permission.
|
17
17
|
|
18
18
|
The above copyright notice and this permission notice shall be included in all
|
19
19
|
copies or substantial portions of the Software.
|
data/Manifest.txt
CHANGED
data/README.rdoc
CHANGED
@@ -1,37 +1,104 @@
|
|
1
|
-
=
|
1
|
+
= Marlowe, Your Request Sleuth
|
2
|
+
|
3
|
+
code :: https://github.com/KineticCafe/marlowe/
|
4
|
+
issues :: https://github.com/KineticCafe/marlowe/issues
|
5
|
+
docs :: http://www.rubydoc.info/github/KineticCafe/marlowe/master
|
6
|
+
continuous integration :: {<img src="https://travis-ci.org/KineticCafe/marlowe.svg?branch=master" alt="Build Status" />}[https://travis-ci.org/KineticCafe/marlowe]
|
2
7
|
|
3
8
|
== Description
|
4
9
|
|
5
|
-
{
|
6
|
-
|
7
|
-
across multiple services.
|
10
|
+
{Marlowe}[https://github.com/KineticCafe/marlowe] is a Rack middleware that
|
11
|
+
extracts or creates a request ID using a pre-defined header, permitting request
|
12
|
+
correlation across multiple services.
|
8
13
|
|
9
|
-
|
14
|
+
When using Rails, Marlowe automatically adds itself to the middleware before
|
15
|
+
<tt>Rails::Rack::Logger</tt>.
|
10
16
|
|
11
|
-
|
17
|
+
=== Upgrading from Marlowe 1.x
|
12
18
|
|
13
|
-
|
19
|
+
In Marlowe 1.0, the correlation header was called <tt>Correlation-Id</tt>;
|
20
|
+
since then, Rails 5 and other tools and frameworks (such as Phoenix) have
|
21
|
+
standardized on the header <tt>X-Request-Id</tt>. Marlowe 2.0 changes to this
|
22
|
+
header by default.
|
23
|
+
|
24
|
+
To keep complete compatibility with Marlowe 1.0, the following should be used:
|
14
25
|
|
15
|
-
|
26
|
+
# Rails
|
27
|
+
config.marlowe_header = 'Correlation-Id'
|
28
|
+
config.marlowe_handler = :simple
|
29
|
+
config.marlowe_return = false
|
16
30
|
|
17
|
-
|
31
|
+
# Rack
|
32
|
+
use Marlowe::Middleware, header: 'Correlation-Id', handler: :simple, return: false
|
18
33
|
|
19
34
|
== Configuration
|
20
35
|
|
21
|
-
|
36
|
+
Marlowe has three main configuration options: the request ID header, the
|
37
|
+
request ID handler, and the request ID return. The options may be provided to
|
38
|
+
the Rack +use+ command as a keyword option, or set in a corresponding
|
39
|
+
<tt>marlowe_<em>option</em></tt> configuration variable in Rails.
|
40
|
+
|
41
|
+
=== Request ID Header
|
42
|
+
|
43
|
+
Specifies the header to be used for the request correlation ID. Defaults to
|
44
|
+
<tt>X-Request-Id</tt>.
|
45
|
+
|
46
|
+
# Rails
|
47
|
+
config.marlowe_header = 'Correlation-Id'
|
48
|
+
# OR: config.marlowe_correlation_header = 'Correlation-Id'
|
49
|
+
|
50
|
+
# Rack
|
51
|
+
use Marlowe::Middleware, header: 'Correlation-Id'
|
52
|
+
# OR: use Marlowe::Middleware, correlation_header: 'Correlation-Id'
|
53
|
+
|
54
|
+
Marlowe will convert this to an appropriate HTTP header (in the Rack +env+
|
55
|
+
parameter, the above header would be represented as
|
56
|
+
<tt>env['HTTP_CORRELATION_ID']</tt>).
|
57
|
+
|
58
|
+
=== Request ID Handler
|
59
|
+
|
60
|
+
Specifies the method for sanitizing or generating the request correlation ID.
|
61
|
+
Values can be <tt>:clean</tt> (the default, which limits incoming correlation
|
62
|
+
IDs to 255 alphanumeric-or-dash characters), <tt>:simple</tt> (does not limit
|
63
|
+
incoming correlation IDs), or a proc to transform or generate a correlation ID.
|
64
|
+
|
65
|
+
In all cases, if a correlation request ID is not handled, a UUID will be
|
66
|
+
generated.
|
67
|
+
|
68
|
+
# Rails
|
69
|
+
config.marlowe_handler = :simple
|
70
|
+
config.marlowe_handler = ->(req_id) {
|
71
|
+
req_id.try(:reverse) || SecureRandom.uuid
|
72
|
+
}
|
73
|
+
|
74
|
+
# Rack
|
75
|
+
use Marlowe::Middleware, handler: :simple
|
76
|
+
use Marlowe::Middleware, handler: ->(req_id) {
|
77
|
+
req_id.try(:reverse) || SecureRandom.uuid
|
78
|
+
}
|
22
79
|
|
23
|
-
|
80
|
+
=== Request ID Return
|
24
81
|
|
25
|
-
|
82
|
+
If +true+ (the default), the request correlation ID will be returned to the
|
83
|
+
client in the same header that it was provided in.
|
26
84
|
|
27
|
-
|
85
|
+
# Rails
|
86
|
+
config.marlowe_return = false
|
28
87
|
|
29
|
-
|
88
|
+
# Rack
|
89
|
+
use Marlowe::Middleware, return: false
|
30
90
|
|
31
|
-
|
32
|
-
represented as `env['HTTP_MY_CORRELATION_ID']`.)
|
91
|
+
=== Using Marlowe with Rails 5
|
33
92
|
|
34
|
-
|
93
|
+
Rails 5 includes the <tt>ActionDispatch::RequestId</tt> middleware, reducing
|
94
|
+
the need for Marlowe. Marlowe is more configurable than the Rails 5 default, so
|
95
|
+
set +marlowe_replace_action_dispatch_request_id+ to true to have
|
96
|
+
<tt>Marlowe::Middleware</tt> will replace <tt>ActionDispatch::RequestId</tt>:
|
97
|
+
|
98
|
+
# Rails only
|
99
|
+
config.marlowe_replace_action_dispatch_request_id = true
|
100
|
+
|
101
|
+
== Accessing the Correlation ID
|
35
102
|
|
36
103
|
The correlation id can be accessed throughout the application by accessing the
|
37
104
|
{RequestStore}[https://github.com/steveklabnik/request_store] storage.
|
@@ -40,16 +107,15 @@ The correlation id can be accessed throughout the application by accessing the
|
|
40
107
|
|
41
108
|
== Logging
|
42
109
|
|
43
|
-
For a
|
44
|
-
the provided ones. Correlated versions of both the SimpleFormatter and
|
45
|
-
are included.
|
110
|
+
For a Rails application, you simply need to change the log formatter to one of
|
111
|
+
the provided ones. Correlated versions of both the SimpleFormatter and
|
112
|
+
Formatter are included.
|
46
113
|
|
47
114
|
# config/environments/development.rb
|
48
115
|
Rails.application.configure do
|
49
116
|
config.log_formatter = Marlowe::SimpleFormatter.new
|
50
117
|
end
|
51
118
|
|
52
|
-
|
53
119
|
To create your own formatter, you'll need to access the RequestStore storage.
|
54
120
|
You can use this pattern if you've rolled your own logger/formatter:
|
55
121
|
|
@@ -64,7 +130,7 @@ You can use this pattern if you've rolled your own logger/formatter:
|
|
64
130
|
|
65
131
|
=== Lograge
|
66
132
|
|
67
|
-
As {lograge}[https://github.com/roidrage/lograge] supplies
|
133
|
+
As {lograge}[https://github.com/roidrage/lograge] supplies its own formatter,
|
68
134
|
you will need to do something a little different:
|
69
135
|
|
70
136
|
# config/application.rb
|
@@ -84,7 +150,7 @@ you will need to do something a little different:
|
|
84
150
|
|
85
151
|
Catching and creating the correlation ID is a great all on its own, but to
|
86
152
|
really take advantage of the correlation in a service based architecture you'll
|
87
|
-
need to pass the
|
153
|
+
need to pass the request ID to the next service in the change.
|
88
154
|
|
89
155
|
Here's an example of a {Hurley}[https://github.com/lostisland/hurley] client:
|
90
156
|
|
@@ -96,16 +162,16 @@ Here's an example of a {Hurley}[https://github.com/lostisland/hurley] client:
|
|
96
162
|
class Hurley::CorrelatedClient < Hurley::Client
|
97
163
|
def initialize(*args, &block)
|
98
164
|
super
|
99
|
-
header['
|
165
|
+
header['X-Request-Id'] = ::RequestStore.store[:correlation_id]
|
100
166
|
end
|
101
167
|
end
|
102
168
|
|
103
|
-
If you have long-lived Hurley clients, it is also possible to use the Hurley
|
104
|
-
machanism}[https://github.com/lostisland/hurley#client-callbacks] to
|
105
|
-
outgoing headers:
|
169
|
+
If you have long-lived Hurley clients, it is also possible to use the Hurley
|
170
|
+
{callback machanism}[https://github.com/lostisland/hurley#client-callbacks] to
|
171
|
+
add the outgoing headers:
|
106
172
|
|
107
173
|
client.before_call do |request|
|
108
|
-
request.header['
|
174
|
+
request.header['X-Request-Id'] = ::RequestStore.store[:correlation_id]
|
109
175
|
end
|
110
176
|
|
111
177
|
or
|
@@ -116,10 +182,36 @@ or
|
|
116
182
|
end
|
117
183
|
|
118
184
|
def call(request)
|
119
|
-
request.header['
|
185
|
+
request.header['X-Request-Id'] = ::RequestStore.store[:correlation_id]
|
120
186
|
end
|
121
187
|
end
|
122
188
|
|
123
189
|
client.before_call(Correlator.new)
|
124
190
|
|
191
|
+
== Install
|
192
|
+
|
193
|
+
Add Marlowe to your Gemfile:
|
194
|
+
|
195
|
+
gem 'marlowe', '~> 2.0'
|
196
|
+
|
197
|
+
Or manually install:
|
198
|
+
|
199
|
+
$ gem install marlowe
|
200
|
+
|
201
|
+
== Marlowe Semantic Versioning
|
202
|
+
|
203
|
+
Marlowe uses a {Semantic Versioning}[http://semver.org/] scheme with one
|
204
|
+
significant change:
|
205
|
+
|
206
|
+
* When PATCH is zero (+0+), it will be omitted from version references.
|
207
|
+
|
208
|
+
Additionally, the major version will generally be reserved for plug-in
|
209
|
+
infrastructure changes.
|
210
|
+
|
211
|
+
== Community and Contributing
|
125
212
|
|
213
|
+
Marlowe welcomes your contributions as described in
|
214
|
+
{Contributing.md}[https://github.com/KineticCafe/marlowe/blob/master/Contributing.md].
|
215
|
+
This project, like all Kinetic Cafe {open source
|
216
|
+
projects}[https://github.com/KineticCafe], is under the Kinetic Cafe Open
|
217
|
+
Source {Code of Conduct}[https://github.com/KineticCafe/code-of-conduct].
|
data/Rakefile
CHANGED
@@ -1,61 +1,75 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'rubygems'
|
4
4
|
require 'hoe'
|
5
|
+
require 'rake/clean'
|
5
6
|
|
6
7
|
Hoe.plugin :doofus
|
7
|
-
Hoe.plugin :email unless ENV['CI']
|
8
|
+
Hoe.plugin :email unless ENV['CI'] || ENV['TRAVIS']
|
8
9
|
Hoe.plugin :gemspec2
|
9
10
|
Hoe.plugin :git
|
10
11
|
Hoe.plugin :minitest
|
11
12
|
Hoe.plugin :rubygems
|
12
13
|
Hoe.plugin :travis
|
13
14
|
|
14
|
-
Hoe.spec 'marlowe' do
|
15
|
+
spec = Hoe.spec 'marlowe' do
|
15
16
|
developer('Trevor Oke', 'toke@kineticcafe.com')
|
16
17
|
developer('Kinetic Cafe', 'dev@kineticcafe.com')
|
17
18
|
|
18
|
-
self.history_file = 'History.
|
19
|
+
self.history_file = 'History.md'
|
19
20
|
self.readme_file = 'README.rdoc'
|
20
21
|
|
21
22
|
license 'MIT'
|
22
23
|
|
24
|
+
ruby20!
|
25
|
+
|
23
26
|
extra_deps << ['request_store', '~> 1.2']
|
24
|
-
extra_deps << ['rack', '>= 0.9', '<
|
27
|
+
extra_deps << ['rack', '>= 0.9', '< 3']
|
25
28
|
|
29
|
+
extra_dev_deps << ['appraisal', '~> 2.1']
|
30
|
+
extra_dev_deps << ['hoe-doofus', '~> 1.0']
|
31
|
+
extra_dev_deps << ['hoe-gemspec2', '~> 1.1']
|
32
|
+
extra_dev_deps << ['hoe-git', '~> 1.6']
|
33
|
+
extra_dev_deps << ['hoe-rubygems', '~> 1.0']
|
34
|
+
extra_dev_deps << ['hoe-travis', '~> 1.2']
|
35
|
+
extra_dev_deps << ['minitest', '~> 5.4']
|
36
|
+
extra_dev_deps << ['minitest-autotest', '~> 1.0']
|
37
|
+
extra_dev_deps << ['minitest-bonus-assertions', '~> 2.0']
|
38
|
+
extra_dev_deps << ['minitest-focus', '~> 1.1']
|
39
|
+
extra_dev_deps << ['minitest-moar', '~> 0.0']
|
26
40
|
extra_dev_deps << ['rack-test', '~> 0.6']
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
self.extra_dev_deps << ['minitest', '~> 5.4']
|
33
|
-
self.extra_dev_deps << ['minitest-autotest', '~> 1.0']
|
34
|
-
self.extra_dev_deps << ['minitest-bisect', '~> 1.2']
|
35
|
-
self.extra_dev_deps << ['minitest-focus', '~> 1.1']
|
36
|
-
self.extra_dev_deps << ['minitest-moar', '~> 0.0']
|
37
|
-
self.extra_dev_deps << ['simplecov', '~> 0.7']
|
41
|
+
extra_dev_deps << ['rake', '>= 10.0', '< 12']
|
42
|
+
extra_dev_deps << ['rdoc', '~> 4.2']
|
43
|
+
extra_dev_deps << ['rubocop', '~> 0.32']
|
44
|
+
extra_dev_deps << ['coveralls', '~> 0.8']
|
45
|
+
extra_dev_deps << ['simplecov', '~> 0.7']
|
38
46
|
end
|
39
47
|
|
40
|
-
|
41
|
-
|
48
|
+
ENV['RUBYOPT'] = '-W0'
|
49
|
+
|
50
|
+
module Hoe::Publish #:nodoc:
|
51
|
+
alias __make_rdoc_cmd__marlowe__ make_rdoc_cmd
|
42
52
|
|
43
53
|
def make_rdoc_cmd(*extra_args) # :nodoc:
|
44
54
|
spec.extra_rdoc_files.reject! { |f| f == 'Manifest.txt' }
|
45
|
-
|
55
|
+
__make_rdoc_cmd__marlowe__(*extra_args)
|
46
56
|
end
|
47
57
|
end
|
48
58
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
59
|
+
if File.exist?('.simplecov-prelude.rb')
|
60
|
+
namespace :test do
|
61
|
+
task :coverage do
|
62
|
+
spec.test_prelude = 'load ".simplecov-prelude.rb"'
|
63
|
+
Rake::Task['test'].execute
|
64
|
+
end
|
65
|
+
|
66
|
+
task :coveralls do
|
67
|
+
ENV['coveralls'] = '1'
|
68
|
+
Rake::Task['test:coverage'].execute
|
69
|
+
end
|
70
|
+
|
71
|
+
CLOBBER << 'coverage'
|
58
72
|
end
|
59
73
|
end
|
60
74
|
|
61
|
-
|
75
|
+
CLOBBER << 'tmp'
|
data/lib/marlowe.rb
CHANGED
data/lib/marlowe/formatter.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'request_store'
|
2
4
|
|
3
5
|
module Marlowe
|
4
|
-
|
5
6
|
# Marlowe::Formatter is a subclass of +ActiveSupport::Logger::Formatter+
|
6
7
|
# that adds a correlation id string to a rails log.
|
7
8
|
class Formatter < ActiveSupport::Logger::Formatter
|
8
|
-
|
9
9
|
# Overrides the formatter return to add the correlation id.
|
10
|
-
def call(
|
10
|
+
def call(_severity, _timestamp, _progname, _msg)
|
11
11
|
"[#{RequestStore.store[:correlation_id]}] #{super}"
|
12
12
|
end
|
13
13
|
end
|
data/lib/marlowe/middleware.rb
CHANGED
@@ -1,36 +1,97 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'rack'
|
2
4
|
require 'request_store'
|
3
5
|
require 'securerandom'
|
4
6
|
|
5
7
|
module Marlowe
|
6
|
-
# Marlowe correlation id middleware. Including this into your
|
7
|
-
#
|
8
|
-
#
|
9
|
-
|
10
|
-
# Name of the default header to look for and put the correlation id in.
|
11
|
-
CORRELATION_HEADER = 'Correlation-Id'.freeze
|
12
|
-
|
8
|
+
# Marlowe correlation id middleware. Including this into your middleware
|
9
|
+
# stack will add a correlation id header as an incoming request, and save
|
10
|
+
# that id in a request session variable.
|
13
11
|
class Middleware
|
14
|
-
#
|
15
|
-
|
12
|
+
# The name of the default header to look for and put the correlation id in.
|
13
|
+
CORRELATION_HEADER = 'X-Request-Id' #:nodoc:
|
14
|
+
|
15
|
+
# Configure the Marlowe middleware to call +app+ with options +opts+.
|
16
|
+
#
|
17
|
+
# === Options
|
18
|
+
#
|
19
|
+
# <tt>:header</tt>:: The name of the header to inspect. Defaults to
|
20
|
+
# 'X-Request-Id'. Also available as
|
21
|
+
# <tt>:correlation_header</tt>.
|
22
|
+
# <tt>:handler</tt>:: The handler for request correlation IDs. Defaults to
|
23
|
+
# sanitizing provided request IDs or generating a UUID.
|
24
|
+
# If <tt>:simple</tt> is provided, provided request IDs
|
25
|
+
# will not be sanitized. A callable (expecting a single
|
26
|
+
# input of any possible existing request ID) may be
|
27
|
+
# provided to introduce more complex request ID
|
28
|
+
# handling.
|
29
|
+
# <tt>:return</tt>:: If +true+ (the default), the request correlation ID
|
30
|
+
# will be returned as part of the response headers.
|
31
|
+
# <tt>:action_dispatch</tt>:: If +true+, Marlowe will add code to behave
|
32
|
+
# like <tt>ActionDispatch::RequestId</tt>.
|
33
|
+
# Depends on <tt>ActionDispatch::Request</tt>.
|
34
|
+
def initialize(app, opts = {})
|
16
35
|
@app = app
|
17
|
-
@
|
36
|
+
@header, @http_header = format_header_name(
|
37
|
+
opts[:header] || opts[:correlation_header] || CORRELATION_HEADER
|
38
|
+
)
|
39
|
+
@handler = opts.fetch(:handler, :clean)
|
40
|
+
@return = opts.fetch(:return, true)
|
41
|
+
@action_dispatch = opts.fetch(:action_dispatch, false)
|
18
42
|
end
|
19
43
|
|
20
44
|
# Stores the incoming correlation id from the +env+ hash. If the correlation
|
21
45
|
# id has not been sent, a new UUID is generated and the +env+ is modified.
|
22
46
|
def call(env)
|
23
|
-
env[@
|
24
|
-
RequestStore.store[:correlation_id] = env[@
|
47
|
+
req_id = make_request_id(env[@http_header])
|
48
|
+
RequestStore.store[:correlation_id] = env[@http_header] = req_id
|
49
|
+
|
50
|
+
if @action_dispatch
|
51
|
+
req = ActionDispatch::Request.new(env)
|
52
|
+
req.request_id = req_id
|
53
|
+
end
|
25
54
|
|
26
|
-
@
|
27
|
-
|
55
|
+
@app.call(env).tap { |_status, headers, _body|
|
56
|
+
if @return
|
57
|
+
headers[@header] = if @action_dispatch
|
58
|
+
req.request_id
|
59
|
+
else
|
60
|
+
RequestStore.store[:correlation_id]
|
61
|
+
end
|
62
|
+
end
|
63
|
+
}
|
28
64
|
end
|
29
65
|
|
30
66
|
private
|
31
67
|
|
32
|
-
def
|
33
|
-
|
68
|
+
def format_header_name(header)
|
69
|
+
[
|
70
|
+
header.to_s.tr('_', '-').freeze,
|
71
|
+
"HTTP_#{header.to_s.tr('-', '_').upcase}"
|
72
|
+
]
|
73
|
+
end
|
74
|
+
|
75
|
+
def make_request_id(request_id)
|
76
|
+
if @handler == :simple
|
77
|
+
simple(request_id)
|
78
|
+
elsif @handler.kind_of?(Proc)
|
79
|
+
simple(@handler.call(request_id))
|
80
|
+
else
|
81
|
+
clean(request_id)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
def clean(request_id)
|
86
|
+
simple(request_id).gsub(/[^\w\-]/, '')[0, 255]
|
87
|
+
end
|
88
|
+
|
89
|
+
def simple(request_id)
|
90
|
+
if request_id && !request_id.empty? && request_id !~ /\A[[:space]]*\z/
|
91
|
+
request_id
|
92
|
+
else
|
93
|
+
SecureRandom.uuid
|
94
|
+
end
|
34
95
|
end
|
35
96
|
end
|
36
97
|
end
|
data/lib/marlowe/rails.rb
CHANGED
@@ -1,11 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Marlowe
|
2
|
-
class Railtie < Rails::Railtie
|
4
|
+
class Railtie < Rails::Railtie # :nodoc:
|
3
5
|
initializer 'marlowe.configure_rails_initialization' do
|
4
|
-
|
6
|
+
config = app.config
|
7
|
+
|
8
|
+
opts = {
|
9
|
+
header: config.try(:marlowe_header) || config.try(:marlowe_correlation_header),
|
10
|
+
handler: config.try(:marlowe_request_id_handler),
|
11
|
+
return: config.try(:marlowe_return_request_id),
|
12
|
+
action_dispatch: config.try(:marlowe_replace_action_dispatch_request_id)
|
13
|
+
}.compact
|
14
|
+
|
15
|
+
if opts[:action_dispatch]
|
16
|
+
app.middleware.insert_before ActionDispatch::RequestId,
|
17
|
+
Marlowe::Middleware, opts
|
18
|
+
app.middleware.delete ActionDispatch::RequestId
|
19
|
+
else
|
20
|
+
app.middleware.insert_before Rails::Rack::Logger, Marlowe::Middleware,
|
21
|
+
opts
|
22
|
+
end
|
5
23
|
end
|
6
24
|
|
7
|
-
#:nodoc:
|
8
|
-
def app
|
25
|
+
def app #:nodoc:
|
9
26
|
Rails.application
|
10
27
|
end
|
11
28
|
end
|
data/test/minitest_config.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
3
|
gem 'minitest'
|
4
4
|
|
@@ -7,16 +7,5 @@ require 'rack/mock'
|
|
7
7
|
require 'minitest/autorun'
|
8
8
|
require 'minitest/focus'
|
9
9
|
require 'minitest/moar'
|
10
|
-
require 'minitest/bisect'
|
11
10
|
|
12
|
-
require 'request_store'
|
13
11
|
require 'marlowe'
|
14
|
-
|
15
|
-
class RackApp
|
16
|
-
def call(env)
|
17
|
-
end
|
18
|
-
|
19
|
-
def coordination_id
|
20
|
-
RequestStore[:correlation_id]
|
21
|
-
end
|
22
|
-
end
|
data/test/test_marlowe.rb
CHANGED
@@ -1,32 +1,102 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'minitest_config'
|
2
4
|
|
3
5
|
class TestMarlowe < Minitest::Test
|
6
|
+
include Rack::Test::Methods
|
7
|
+
|
8
|
+
attr_reader :marlowe_options
|
9
|
+
|
4
10
|
def setup
|
5
|
-
@
|
6
|
-
|
11
|
+
@marlowe_options = {}
|
12
|
+
end
|
13
|
+
|
14
|
+
def app
|
15
|
+
options = marlowe_options
|
16
|
+
Rack::Builder.new do
|
17
|
+
use Marlowe::Middleware, options
|
18
|
+
|
19
|
+
run lambda { |_env|
|
20
|
+
[
|
21
|
+
200,
|
22
|
+
{ 'Content-Type' => 'text/plain' },
|
23
|
+
[ RequestStore[:correlation_id] ]
|
24
|
+
]
|
25
|
+
}
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_default_config_no_header_value
|
30
|
+
get '/'
|
31
|
+
assert last_response.header.key?('X-Request-Id')
|
32
|
+
refute_empty last_response.header['X-Request-Id']
|
33
|
+
assert_equal last_response.header['X-Request-Id'], last_response.body
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_default_config_with_header_value
|
37
|
+
get '/', {}, { 'HTTP_X_REQUEST_ID' => 'testvalue' }
|
38
|
+
assert last_response.header.key?('X-Request-Id')
|
39
|
+
refute_empty last_response.header['X-Request-Id']
|
40
|
+
assert_equal last_response.header['X-Request-Id'], last_response.body
|
41
|
+
assert_equal 'testvalue', last_response.header['X-Request-Id']
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_header_config_no_header_value
|
45
|
+
marlowe_options[:header] = 'Correlation-Id'
|
46
|
+
get '/'
|
47
|
+
assert last_response.header.key?('Correlation-Id')
|
48
|
+
refute_empty last_response.header['Correlation-Id']
|
49
|
+
assert_equal last_response.header['Correlation-Id'], last_response.body
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_header_config_no_header_with_header_value
|
53
|
+
marlowe_options[:header] = 'Correlation-Id'
|
54
|
+
get '/', {}, { 'HTTP_CORRELATION_ID' => 'testvalue' }
|
55
|
+
assert last_response.header.key?('Correlation-Id')
|
56
|
+
refute_empty last_response.header['Correlation-Id']
|
57
|
+
assert_equal last_response.header['Correlation-Id'], last_response.body
|
58
|
+
assert_equal 'testvalue', last_response.header['Correlation-Id']
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_handler_config_default_handler
|
62
|
+
get '/', {}, { 'HTTP_X_REQUEST_ID' => 'test+value' }
|
63
|
+
assert last_response.header.key?('X-Request-Id')
|
64
|
+
refute_empty last_response.header['X-Request-Id']
|
65
|
+
assert_equal last_response.header['X-Request-Id'], last_response.body
|
66
|
+
assert_equal 'testvalue', last_response.header['X-Request-Id']
|
7
67
|
end
|
8
68
|
|
9
|
-
def
|
10
|
-
|
11
|
-
|
69
|
+
def test_handler_config_with_simple_handler
|
70
|
+
marlowe_options[:handler] = :simple
|
71
|
+
get '/', {}, { 'HTTP_X_REQUEST_ID' => 'test+value' }
|
72
|
+
assert last_response.header.key?('X-Request-Id')
|
73
|
+
refute_empty last_response.header['X-Request-Id']
|
74
|
+
assert_equal last_response.header['X-Request-Id'], last_response.body
|
75
|
+
assert_equal 'test+value', last_response.header['X-Request-Id']
|
12
76
|
end
|
13
77
|
|
14
|
-
def
|
15
|
-
|
16
|
-
|
17
|
-
|
78
|
+
def test_handler_config_with_proc_handler
|
79
|
+
marlowe_options[:handler] = ->(item) { item && item.reverse || SecureRandom.uuid }
|
80
|
+
get '/', {}, { 'HTTP_X_REQUEST_ID' => 'test+value' }
|
81
|
+
assert last_response.header.key?('X-Request-Id')
|
82
|
+
refute_empty last_response.header['X-Request-Id']
|
83
|
+
assert_equal last_response.header['X-Request-Id'], last_response.body
|
84
|
+
assert_equal 'eulav+tset', last_response.header['X-Request-Id']
|
18
85
|
end
|
19
86
|
|
20
|
-
def
|
21
|
-
|
22
|
-
|
23
|
-
|
87
|
+
def test_handler_config_with_proc_handler_returning_nil
|
88
|
+
marlowe_options[:handler] = ->(item) { nil }
|
89
|
+
get '/', {}, { 'HTTP_X_REQUEST_ID' => 'test+value' }
|
90
|
+
assert last_response.header.key?('X-Request-Id')
|
91
|
+
refute_empty last_response.header['X-Request-Id']
|
92
|
+
assert_equal last_response.header['X-Request-Id'], last_response.body
|
93
|
+
assert_match(/\A[-\w]+\z/, last_response.header['X-Request-Id'])
|
24
94
|
end
|
25
95
|
|
26
|
-
def
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
assert_equal
|
96
|
+
def test_return_config_false
|
97
|
+
marlowe_options[:return] = false
|
98
|
+
get '/'
|
99
|
+
refute last_response.header.key?('X-Request-Id')
|
100
|
+
assert_equal RequestStore[:correlation_id], last_response.body
|
31
101
|
end
|
32
102
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: marlowe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: '2.0'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Trevor Oke
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-11-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: request_store
|
@@ -34,7 +34,7 @@ dependencies:
|
|
34
34
|
version: '0.9'
|
35
35
|
- - "<"
|
36
36
|
- !ruby/object:Gem::Version
|
37
|
-
version: '
|
37
|
+
version: '3'
|
38
38
|
type: :runtime
|
39
39
|
prerelease: false
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -44,65 +44,79 @@ dependencies:
|
|
44
44
|
version: '0.9'
|
45
45
|
- - "<"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '3'
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: minitest
|
50
50
|
requirement: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '5.
|
54
|
+
version: '5.9'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
57
|
version_requirements: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '5.
|
61
|
+
version: '5.9'
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
|
-
name:
|
63
|
+
name: appraisal
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '2.1'
|
69
69
|
type: :development
|
70
70
|
prerelease: false
|
71
71
|
version_requirements: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '2.1'
|
76
76
|
- !ruby/object:Gem::Dependency
|
77
|
-
name:
|
77
|
+
name: hoe-doofus
|
78
78
|
requirement: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '0
|
82
|
+
version: '1.0'
|
83
83
|
type: :development
|
84
84
|
prerelease: false
|
85
85
|
version_requirements: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '0
|
89
|
+
version: '1.0'
|
90
90
|
- !ruby/object:Gem::Dependency
|
91
|
-
name:
|
91
|
+
name: hoe-gemspec2
|
92
92
|
requirement: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
96
|
+
version: '1.1'
|
97
97
|
type: :development
|
98
98
|
prerelease: false
|
99
99
|
version_requirements: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
103
|
+
version: '1.1'
|
104
104
|
- !ruby/object:Gem::Dependency
|
105
|
-
name: hoe-
|
105
|
+
name: hoe-git
|
106
|
+
requirement: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '1.6'
|
111
|
+
type: :development
|
112
|
+
prerelease: false
|
113
|
+
version_requirements: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '1.6'
|
118
|
+
- !ruby/object:Gem::Dependency
|
119
|
+
name: hoe-rubygems
|
106
120
|
requirement: !ruby/object:Gem::Requirement
|
107
121
|
requirements:
|
108
122
|
- - "~>"
|
@@ -116,103 +130,151 @@ dependencies:
|
|
116
130
|
- !ruby/object:Gem::Version
|
117
131
|
version: '1.0'
|
118
132
|
- !ruby/object:Gem::Dependency
|
119
|
-
name: hoe-
|
133
|
+
name: hoe-travis
|
120
134
|
requirement: !ruby/object:Gem::Requirement
|
121
135
|
requirements:
|
122
136
|
- - "~>"
|
123
137
|
- !ruby/object:Gem::Version
|
124
|
-
version: '1.
|
138
|
+
version: '1.2'
|
125
139
|
type: :development
|
126
140
|
prerelease: false
|
127
141
|
version_requirements: !ruby/object:Gem::Requirement
|
128
142
|
requirements:
|
129
143
|
- - "~>"
|
130
144
|
- !ruby/object:Gem::Version
|
131
|
-
version: '1.
|
145
|
+
version: '1.2'
|
132
146
|
- !ruby/object:Gem::Dependency
|
133
|
-
name:
|
147
|
+
name: minitest-autotest
|
134
148
|
requirement: !ruby/object:Gem::Requirement
|
135
149
|
requirements:
|
136
150
|
- - "~>"
|
137
151
|
- !ruby/object:Gem::Version
|
138
|
-
version: '1.
|
152
|
+
version: '1.0'
|
139
153
|
type: :development
|
140
154
|
prerelease: false
|
141
155
|
version_requirements: !ruby/object:Gem::Requirement
|
142
156
|
requirements:
|
143
157
|
- - "~>"
|
144
158
|
- !ruby/object:Gem::Version
|
145
|
-
version: '1.
|
159
|
+
version: '1.0'
|
146
160
|
- !ruby/object:Gem::Dependency
|
147
|
-
name:
|
161
|
+
name: minitest-bonus-assertions
|
148
162
|
requirement: !ruby/object:Gem::Requirement
|
149
163
|
requirements:
|
150
164
|
- - "~>"
|
151
165
|
- !ruby/object:Gem::Version
|
152
|
-
version: '
|
166
|
+
version: '2.0'
|
153
167
|
type: :development
|
154
168
|
prerelease: false
|
155
169
|
version_requirements: !ruby/object:Gem::Requirement
|
156
170
|
requirements:
|
157
171
|
- - "~>"
|
158
172
|
- !ruby/object:Gem::Version
|
159
|
-
version: '
|
173
|
+
version: '2.0'
|
160
174
|
- !ruby/object:Gem::Dependency
|
161
|
-
name: minitest-
|
175
|
+
name: minitest-focus
|
162
176
|
requirement: !ruby/object:Gem::Requirement
|
163
177
|
requirements:
|
164
178
|
- - "~>"
|
165
179
|
- !ruby/object:Gem::Version
|
166
|
-
version: '1.
|
180
|
+
version: '1.1'
|
167
181
|
type: :development
|
168
182
|
prerelease: false
|
169
183
|
version_requirements: !ruby/object:Gem::Requirement
|
170
184
|
requirements:
|
171
185
|
- - "~>"
|
172
186
|
- !ruby/object:Gem::Version
|
173
|
-
version: '1.
|
187
|
+
version: '1.1'
|
174
188
|
- !ruby/object:Gem::Dependency
|
175
|
-
name: minitest-
|
189
|
+
name: minitest-moar
|
176
190
|
requirement: !ruby/object:Gem::Requirement
|
177
191
|
requirements:
|
178
192
|
- - "~>"
|
179
193
|
- !ruby/object:Gem::Version
|
180
|
-
version: '
|
194
|
+
version: '0.0'
|
181
195
|
type: :development
|
182
196
|
prerelease: false
|
183
197
|
version_requirements: !ruby/object:Gem::Requirement
|
184
198
|
requirements:
|
185
199
|
- - "~>"
|
186
200
|
- !ruby/object:Gem::Version
|
187
|
-
version: '
|
201
|
+
version: '0.0'
|
188
202
|
- !ruby/object:Gem::Dependency
|
189
|
-
name:
|
203
|
+
name: rack-test
|
190
204
|
requirement: !ruby/object:Gem::Requirement
|
191
205
|
requirements:
|
192
206
|
- - "~>"
|
193
207
|
- !ruby/object:Gem::Version
|
194
|
-
version: '
|
208
|
+
version: '0.6'
|
195
209
|
type: :development
|
196
210
|
prerelease: false
|
197
211
|
version_requirements: !ruby/object:Gem::Requirement
|
198
212
|
requirements:
|
199
213
|
- - "~>"
|
200
214
|
- !ruby/object:Gem::Version
|
201
|
-
version: '
|
215
|
+
version: '0.6'
|
202
216
|
- !ruby/object:Gem::Dependency
|
203
|
-
name:
|
217
|
+
name: rake
|
218
|
+
requirement: !ruby/object:Gem::Requirement
|
219
|
+
requirements:
|
220
|
+
- - ">="
|
221
|
+
- !ruby/object:Gem::Version
|
222
|
+
version: '10.0'
|
223
|
+
- - "<"
|
224
|
+
- !ruby/object:Gem::Version
|
225
|
+
version: '12'
|
226
|
+
type: :development
|
227
|
+
prerelease: false
|
228
|
+
version_requirements: !ruby/object:Gem::Requirement
|
229
|
+
requirements:
|
230
|
+
- - ">="
|
231
|
+
- !ruby/object:Gem::Version
|
232
|
+
version: '10.0'
|
233
|
+
- - "<"
|
234
|
+
- !ruby/object:Gem::Version
|
235
|
+
version: '12'
|
236
|
+
- !ruby/object:Gem::Dependency
|
237
|
+
name: rdoc
|
204
238
|
requirement: !ruby/object:Gem::Requirement
|
205
239
|
requirements:
|
206
240
|
- - "~>"
|
207
241
|
- !ruby/object:Gem::Version
|
208
|
-
version: '
|
242
|
+
version: '4.2'
|
209
243
|
type: :development
|
210
244
|
prerelease: false
|
211
245
|
version_requirements: !ruby/object:Gem::Requirement
|
212
246
|
requirements:
|
213
247
|
- - "~>"
|
214
248
|
- !ruby/object:Gem::Version
|
215
|
-
version: '
|
249
|
+
version: '4.2'
|
250
|
+
- !ruby/object:Gem::Dependency
|
251
|
+
name: rubocop
|
252
|
+
requirement: !ruby/object:Gem::Requirement
|
253
|
+
requirements:
|
254
|
+
- - "~>"
|
255
|
+
- !ruby/object:Gem::Version
|
256
|
+
version: '0.32'
|
257
|
+
type: :development
|
258
|
+
prerelease: false
|
259
|
+
version_requirements: !ruby/object:Gem::Requirement
|
260
|
+
requirements:
|
261
|
+
- - "~>"
|
262
|
+
- !ruby/object:Gem::Version
|
263
|
+
version: '0.32'
|
264
|
+
- !ruby/object:Gem::Dependency
|
265
|
+
name: coveralls
|
266
|
+
requirement: !ruby/object:Gem::Requirement
|
267
|
+
requirements:
|
268
|
+
- - "~>"
|
269
|
+
- !ruby/object:Gem::Version
|
270
|
+
version: '0.8'
|
271
|
+
type: :development
|
272
|
+
prerelease: false
|
273
|
+
version_requirements: !ruby/object:Gem::Requirement
|
274
|
+
requirements:
|
275
|
+
- - "~>"
|
276
|
+
- !ruby/object:Gem::Version
|
277
|
+
version: '0.8'
|
216
278
|
- !ruby/object:Gem::Dependency
|
217
279
|
name: simplecov
|
218
280
|
requirement: !ruby/object:Gem::Requirement
|
@@ -233,32 +295,36 @@ dependencies:
|
|
233
295
|
requirements:
|
234
296
|
- - "~>"
|
235
297
|
- !ruby/object:Gem::Version
|
236
|
-
version: '3.
|
298
|
+
version: '3.15'
|
237
299
|
type: :development
|
238
300
|
prerelease: false
|
239
301
|
version_requirements: !ruby/object:Gem::Requirement
|
240
302
|
requirements:
|
241
303
|
- - "~>"
|
242
304
|
- !ruby/object:Gem::Version
|
243
|
-
version: '3.
|
244
|
-
description:
|
245
|
-
|
246
|
-
|
305
|
+
version: '3.15'
|
306
|
+
description: |-
|
307
|
+
{Marlowe}[https://github.com/KineticCafe/marlowe] is a Rack middleware that
|
308
|
+
extracts or creates a request ID using a pre-defined header, permitting request
|
309
|
+
correlation across multiple services.
|
310
|
+
|
311
|
+
When using Rails, Marlowe automatically adds itself to the middleware before
|
312
|
+
<tt>Rails::Rack::Logger</tt>.
|
247
313
|
email:
|
248
314
|
- toke@kineticcafe.com
|
249
315
|
- dev@kineticcafe.com
|
250
316
|
executables: []
|
251
317
|
extensions: []
|
252
318
|
extra_rdoc_files:
|
253
|
-
-
|
254
|
-
-
|
319
|
+
- Contributing.md
|
320
|
+
- History.md
|
321
|
+
- Licence.md
|
255
322
|
- Manifest.txt
|
256
323
|
- README.rdoc
|
257
324
|
files:
|
258
|
-
-
|
259
|
-
-
|
260
|
-
-
|
261
|
-
- Licence.rdoc
|
325
|
+
- Contributing.md
|
326
|
+
- History.md
|
327
|
+
- Licence.md
|
262
328
|
- Manifest.txt
|
263
329
|
- README.rdoc
|
264
330
|
- Rakefile
|
@@ -269,7 +335,7 @@ files:
|
|
269
335
|
- lib/marlowe/simple_formatter.rb
|
270
336
|
- test/minitest_config.rb
|
271
337
|
- test/test_marlowe.rb
|
272
|
-
homepage:
|
338
|
+
homepage: https://github.com/KineticCafe/marlowe/
|
273
339
|
licenses:
|
274
340
|
- MIT
|
275
341
|
metadata: {}
|
@@ -281,9 +347,9 @@ require_paths:
|
|
281
347
|
- lib
|
282
348
|
required_ruby_version: !ruby/object:Gem::Requirement
|
283
349
|
requirements:
|
284
|
-
- - "
|
350
|
+
- - "~>"
|
285
351
|
- !ruby/object:Gem::Version
|
286
|
-
version: '0'
|
352
|
+
version: '2.0'
|
287
353
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
288
354
|
requirements:
|
289
355
|
- - ">="
|
@@ -291,10 +357,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
291
357
|
version: '0'
|
292
358
|
requirements: []
|
293
359
|
rubyforge_project:
|
294
|
-
rubygems_version: 2.
|
360
|
+
rubygems_version: 2.5.1
|
295
361
|
signing_key:
|
296
362
|
specification_version: 4
|
297
|
-
summary: "{
|
298
|
-
|
299
|
-
|
363
|
+
summary: "{Marlowe}[https://github.com/KineticCafe/marlowe] is a Rack middleware that
|
364
|
+
extracts or creates a request ID using a pre-defined header, permitting request
|
365
|
+
correlation across multiple services"
|
300
366
|
test_files: []
|
data/.autotest
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
# -*- ruby -*-
|
2
|
-
|
3
|
-
require "autotest/restart"
|
4
|
-
|
5
|
-
# Autotest.add_hook :initialize do |at|
|
6
|
-
# at.testlib = "minitest/unit"
|
7
|
-
#
|
8
|
-
# at.extra_files << "../some/external/dependency.rb"
|
9
|
-
#
|
10
|
-
# at.libs << ":../some/external"
|
11
|
-
#
|
12
|
-
# at.add_exception "vendor"
|
13
|
-
#
|
14
|
-
# at.add_mapping(/dependency.rb/) do |f, _|
|
15
|
-
# at.files_matching(/test_.*rb$/)
|
16
|
-
# end
|
17
|
-
#
|
18
|
-
# %w(TestA TestB).each do |klass|
|
19
|
-
# at.extra_class_map[klass] = "test/test_misc.rb"
|
20
|
-
# end
|
21
|
-
# end
|
22
|
-
|
23
|
-
# Autotest.add_hook :run_command do |at|
|
24
|
-
# system "rake build"
|
25
|
-
# end
|
data/Gemfile
DELETED
data/History.rdoc
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
=== 1.0.3 / 2016-01-15
|
2
|
-
|
3
|
-
* Update Readme example of using available formatted subclass
|
4
|
-
* Make the correlation header name configurable
|
5
|
-
|
6
|
-
=== 1.0.2 / 2015-11-24
|
7
|
-
|
8
|
-
* Add documentation for using Marlowe with {lograge}[https://github.com/roidrage/lograge]
|
9
|
-
|
10
|
-
=== 1.0.1 / 2015-10-20
|
11
|
-
|
12
|
-
* Update gemspec with homepage
|
13
|
-
* Update Rakefile
|
14
|
-
|
15
|
-
=== 1.0.0 / 2015-10-16
|
16
|
-
|
17
|
-
* Initial Commit
|