rack-instruments 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/rack/instruments.rb +14 -3
  2. metadata +1 -17
@@ -1,5 +1,3 @@
1
- require "uuidtools"
2
-
3
1
  module Rack
4
2
  class Instruments
5
3
  def initialize(app)
@@ -7,7 +5,7 @@ module Rack
7
5
  end
8
6
 
9
7
  def call(env)
10
- request_id = UUIDTools::UUID.timestamp_create.to_s
8
+ request_id = self.class.id_generator.call
11
9
  request_start = Time.now
12
10
  status, headers, response = nil, nil, nil
13
11
 
@@ -27,4 +25,17 @@ module Rack
27
25
  [status, headers, response]
28
26
  end
29
27
  end
28
+
29
+ module InstrumentsConfig
30
+ def self.extended(base)
31
+ base.id_generator = -> { rand(36**8).to_s(36) }
32
+ end
33
+
34
+ attr_accessor :id_generator
35
+
36
+ def configure
37
+ yield self
38
+ end
39
+ end
40
+ Instruments.extend(InstrumentsConfig)
30
41
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-instruments
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -27,22 +27,6 @@ dependencies:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
29
  version: '0.1'
30
- - !ruby/object:Gem::Dependency
31
- name: uuidtools
32
- requirement: !ruby/object:Gem::Requirement
33
- none: false
34
- requirements:
35
- - - ~>
36
- - !ruby/object:Gem::Version
37
- version: 2.1.2
38
- type: :runtime
39
- prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ~>
44
- - !ruby/object:Gem::Version
45
- version: 2.1.2
46
30
  description:
47
31
  email: brandur@mutelight.org
48
32
  executables: []