rack-honeycomb 0.0.15 → 0.0.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -1
- data/lib/rack/honeycomb/middleware.rb +6 -6
- data/lib/rack/honeycomb/version.rb +1 -1
- data/rack-honeycomb.gemspec +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd607cec0d5aee31890fe76f0a053315e767f6f2be87ebe0dab906194372649e
|
4
|
+
data.tar.gz: 455582fb49afd1fd9d191a00689a29080a98d859ee138e3341997ff2b4554019
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24a61539ccbd7908a35f6335b66893451044aa4a7b34f642d792cfc721b506a7489cd8c7fdc18435bacfca37ddc54bce09c9789bf9014be64d6788e0b3a6ea95
|
7
|
+
data.tar.gz: ed0535c26cc1734cc49464b24fa374ca10845f0c6b2acb696260d4b24d989a4db3cecc28fc14b421afa5c8c3351a38c2e145fd254ea574f9d149cded31e2e664
|
data/README.md
CHANGED
@@ -6,6 +6,8 @@ For more information about using Honeycomb, check out our [docs](https://honeyco
|
|
6
6
|
|
7
7
|
## Adding instrumentation to a Sinatra application
|
8
8
|
|
9
|
+
Attaching the middleware is simple. Inside handlers, you also have the choice of attaching custom metadata to be stripped off by the middleware.
|
10
|
+
|
9
11
|
```ruby
|
10
12
|
#!/usr/bin/env ruby -rubygems
|
11
13
|
require 'sinatra'
|
@@ -13,7 +15,10 @@ require 'rack/honeycomb'
|
|
13
15
|
|
14
16
|
use Rack::Honeycomb::Middleware, writekey: "<YOUR WRITEKEY HERE>", dataset: "<YOUR DATASET NAME HERE>"
|
15
17
|
|
16
|
-
get('/hello')
|
18
|
+
get('/hello') do
|
19
|
+
env[Rack::Honeycomb::ENV_PREFIX + "handler"] = "hello world handler"
|
20
|
+
"Hello, world!\n"
|
21
|
+
end
|
17
22
|
```
|
18
23
|
|
19
24
|
## Adding instrumentation to a Rails application
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require "libhoney"
|
2
|
+
require "rack/honeycomb/version"
|
2
3
|
|
3
4
|
module Rack
|
4
5
|
module Honeycomb
|
@@ -7,7 +8,8 @@ module Rack
|
|
7
8
|
ENV_PREFIX = "honeycomb."
|
8
9
|
|
9
10
|
class Middleware
|
10
|
-
|
11
|
+
ENV_REGEX = /^#{ Regexp.escape ENV_PREFIX }/
|
12
|
+
USER_AGENT_SUFFIX = "rack-honeycomb/#{VERSION}"
|
11
13
|
|
12
14
|
attr_reader :app
|
13
15
|
attr_reader :options
|
@@ -21,9 +23,7 @@ module Rack
|
|
21
23
|
def initialize(app, options = {})
|
22
24
|
@app, @options = app, options
|
23
25
|
|
24
|
-
@honeycomb = Libhoney::Client.new(:
|
25
|
-
:dataset => options[:dataset],
|
26
|
-
:api_host => options[:api_host])
|
26
|
+
@honeycomb = Libhoney::Client.new(options.merge(user_agent_addition: USER_AGENT_SUFFIX))
|
27
27
|
end
|
28
28
|
|
29
29
|
def add_field(ev, field, value)
|
@@ -51,8 +51,8 @@ module Rack
|
|
51
51
|
# Pull arbitrary metadata off `env` if the caller attached anything
|
52
52
|
# inside the Rack handler.
|
53
53
|
env.each_pair do |k, v|
|
54
|
-
if k.is_a?(String) && k.match(
|
55
|
-
add_field(ev, k.sub(
|
54
|
+
if k.is_a?(String) && k.match(ENV_REGEX)
|
55
|
+
add_field(ev, k.sub(ENV_REGEX, ''), v)
|
56
56
|
env.delete(k)
|
57
57
|
end
|
58
58
|
end
|
data/rack-honeycomb.gemspec
CHANGED
@@ -35,7 +35,7 @@ Gem::Specification.new do |spec|
|
|
35
35
|
spec.add_development_dependency "minitest", "~> 5.0"
|
36
36
|
spec.add_development_dependency "yardstick", "~> 0.9"
|
37
37
|
spec.add_runtime_dependency 'rack', '>= 1.0.0'
|
38
|
-
spec.add_runtime_dependency 'libhoney', '
|
38
|
+
spec.add_runtime_dependency 'libhoney', '>= 1.5.0'
|
39
39
|
spec.add_development_dependency 'rack-test'
|
40
40
|
spec.add_development_dependency 'yard'
|
41
41
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-honeycomb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- The Honeycomb.io Team
|
@@ -112,16 +112,16 @@ dependencies:
|
|
112
112
|
name: libhoney
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - "
|
115
|
+
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
117
|
+
version: 1.5.0
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- - "
|
122
|
+
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
124
|
+
version: 1.5.0
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: rack-test
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -186,7 +186,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
186
186
|
version: '0'
|
187
187
|
requirements: []
|
188
188
|
rubyforge_project:
|
189
|
-
rubygems_version: 2.7.
|
189
|
+
rubygems_version: 2.7.6
|
190
190
|
signing_key:
|
191
191
|
specification_version: 4
|
192
192
|
summary: Rack middleware for logging request data to Honeycomb.
|