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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cfe839ce437cd3fd95a31f9abcd8ed59acc62b4094b04b1e95d57246ad4bea0e
4
- data.tar.gz: e892e9ada926776887a9eb731ea8bbadad87c201d15c5f0890422146d1255c02
3
+ metadata.gz: cd607cec0d5aee31890fe76f0a053315e767f6f2be87ebe0dab906194372649e
4
+ data.tar.gz: 455582fb49afd1fd9d191a00689a29080a98d859ee138e3341997ff2b4554019
5
5
  SHA512:
6
- metadata.gz: c1fe4cb326c7948d7e82bfdcd53979e3cfbbe2c448494819e74471a489afdc56e8192cca3843a85bb7d9f6cc5492fe52c891a4a58c1aae9fc6ce289b1dda991c
7
- data.tar.gz: 3a583b5fdd375da03982e26c0163bb7d75203c332268cf30bbfc0138de1ac236dc013bdf81549f3310896a6ea1e161d496ce1f0c5b0fa877a03835106209e236
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') { "Hello, world!\n" }
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
- HEADER_REGEX = /^#{ Regexp.escape ENV_PREFIX }/
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(:writekey => options[:writekey],
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(HEADER_REGEX)
55
- add_field(ev, k.sub(HEADER_REGEX, ''), v)
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
@@ -1,5 +1,5 @@
1
1
  module Rack
2
2
  module Honeycomb
3
- VERSION="0.0.15"
3
+ VERSION="0.0.16"
4
4
  end
5
5
  end
@@ -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', '~> 1.0'
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.15
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: '1.0'
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: '1.0'
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.3
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.