percy-common 2.1.1 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.circleci/config.yml +18 -0
- data/.rubocop.yml +4 -0
- data/lib/percy/common/version.rb +1 -1
- data/lib/percy/stats.rb +37 -20
- data/percy-common.gemspec +3 -5
- metadata +14 -14
- data/.travis.yml +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c0fe4132dddef08590d485a30d755fa43e95bc0cc4569b0f716e25c756c5dca5
|
4
|
+
data.tar.gz: 9de9dbc2f26404e03f22175bfc742080df122824d9510197a23a0f55c8ca0c65
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4063a9ab97a6a5e30774733dbe8922dc690b6556f80f6a3c28651043e050043ea5a76b4de1220a2e3f3fa0688968a259fe9eaba7a77f11699fb9a9e5348f68ab
|
7
|
+
data.tar.gz: 89cb3605660c98e521e3f08c72be55b3517236ee3702dda10c65d09c35eaa855b5b6715d2e349359c34e8fdb41020139dce834e8a3acb2ff7457e0bfe4e6b641
|
@@ -0,0 +1,18 @@
|
|
1
|
+
version: 2.1
|
2
|
+
|
3
|
+
jobs:
|
4
|
+
ruby_25:
|
5
|
+
docker:
|
6
|
+
- image: circleci/ruby:2.5-node-browsers
|
7
|
+
steps:
|
8
|
+
- checkout
|
9
|
+
- run: gem update --system
|
10
|
+
- run: gem install bundler
|
11
|
+
- run: bundle install
|
12
|
+
- run: bundle exec rubocop -D
|
13
|
+
|
14
|
+
workflows:
|
15
|
+
version: 2
|
16
|
+
test:
|
17
|
+
jobs:
|
18
|
+
- ruby_25
|
data/.rubocop.yml
CHANGED
data/lib/percy/common/version.rb
CHANGED
data/lib/percy/stats.rb
CHANGED
@@ -3,41 +3,58 @@ require 'time'
|
|
3
3
|
|
4
4
|
module Percy
|
5
5
|
class Stats < ::Datadog::Statsd
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
6
|
+
DEFAULT_HOST = ENV.fetch(
|
7
|
+
'DATADOG_AGENT_HOST',
|
8
|
+
::Datadog::Statsd::Connection::DEFAULT_HOST,
|
9
|
+
)
|
10
|
+
|
11
|
+
DEFAULT_PORT = Integer(
|
12
|
+
ENV.fetch(
|
13
|
+
'DATADOG_AGENT_PORT',
|
14
|
+
::Datadog::Statsd::Connection::DEFAULT_PORT,
|
15
|
+
),
|
16
|
+
)
|
17
|
+
|
18
|
+
DEFAULT_TAGS = %W[
|
19
|
+
env:#{ENV.fetch('PERCY_ENV', 'development')}
|
20
|
+
].freeze
|
21
|
+
|
22
|
+
def initialize(
|
23
|
+
host = DEFAULT_HOST,
|
24
|
+
port = DEFAULT_PORT,
|
25
|
+
tags: DEFAULT_TAGS,
|
26
|
+
**kwargs
|
27
|
+
)
|
28
|
+
super(host, port, tags: tags, **kwargs)
|
23
29
|
end
|
24
30
|
|
25
|
-
# Equivalent to stats.time, but without wrapping in blocks and dealing with
|
31
|
+
# Equivalent to stats.time, but without wrapping in blocks and dealing with
|
32
|
+
# var scoping issues.
|
26
33
|
#
|
27
34
|
# @example Report the time taken to activate an account.
|
28
35
|
# stats.start_timing
|
29
36
|
# account.activate!
|
30
37
|
# stats.stop_timing('account.activate')
|
31
38
|
def start_timing
|
32
|
-
@_timing_start =
|
39
|
+
@_timing_start = now
|
33
40
|
true
|
34
41
|
end
|
35
42
|
|
36
43
|
def stop_timing(stat, options = {})
|
37
|
-
|
44
|
+
# Programmer mistake, so raise an error.
|
45
|
+
raise 'no timing started' unless @_timing_start
|
46
|
+
|
38
47
|
time_since(stat, @_timing_start, options)
|
39
48
|
@_timing_start = nil
|
40
49
|
true
|
41
50
|
end
|
51
|
+
|
52
|
+
def time_since(stat, start, opts = {})
|
53
|
+
timing(stat, ((now.to_f - start.to_f) * 1000).round, opts)
|
54
|
+
end
|
55
|
+
|
56
|
+
private def now
|
57
|
+
Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
58
|
+
end
|
42
59
|
end
|
43
60
|
end
|
data/percy-common.gemspec
CHANGED
@@ -16,14 +16,12 @@ Gem::Specification.new do |spec|
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
17
|
spec.require_paths = ['lib']
|
18
18
|
|
19
|
-
|
20
|
-
spec.add_dependency 'dogstatsd-ruby', '3.2.0'
|
21
|
-
|
19
|
+
spec.add_dependency 'dogstatsd-ruby', '~> 4.4.0'
|
22
20
|
spec.add_dependency 'excon', '~> 0.57'
|
23
21
|
|
24
|
-
spec.add_development_dependency 'bundler', '~>
|
22
|
+
spec.add_development_dependency 'bundler', '~> 2.0.2'
|
25
23
|
spec.add_development_dependency 'rake', '~> 10.0'
|
26
24
|
spec.add_development_dependency 'rspec', '~> 3.2'
|
27
25
|
spec.add_development_dependency 'guard-rspec', '~> 4.7'
|
28
|
-
spec.add_development_dependency 'percy-style'
|
26
|
+
spec.add_development_dependency 'percy-style', '~> 0.6.0'
|
29
27
|
end
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: percy-common
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Perceptual Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-07-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dogstatsd-ruby
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 4.4.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 4.4.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: excon
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 2.0.2
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 2.0.2
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -98,16 +98,16 @@ dependencies:
|
|
98
98
|
name: percy-style
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - "
|
101
|
+
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
103
|
+
version: 0.6.0
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - "
|
108
|
+
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
110
|
+
version: 0.6.0
|
111
111
|
description: ''
|
112
112
|
email:
|
113
113
|
- team@percy.io
|
@@ -115,10 +115,10 @@ executables: []
|
|
115
115
|
extensions: []
|
116
116
|
extra_rdoc_files: []
|
117
117
|
files:
|
118
|
+
- ".circleci/config.yml"
|
118
119
|
- ".gitignore"
|
119
120
|
- ".rspec"
|
120
121
|
- ".rubocop.yml"
|
121
|
-
- ".travis.yml"
|
122
122
|
- Gemfile
|
123
123
|
- Guardfile
|
124
124
|
- LICENSE
|
@@ -153,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
153
153
|
version: '0'
|
154
154
|
requirements: []
|
155
155
|
rubyforge_project:
|
156
|
-
rubygems_version: 2.
|
156
|
+
rubygems_version: 2.7.8
|
157
157
|
signing_key:
|
158
158
|
specification_version: 4
|
159
159
|
summary: Server-side common library for Percy.
|