coverband-service-client 0.0.12.rc → 0.0.12.rc.1

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: b21c24a8ca01191ebb807640f09555b360ba6f0333b86d6e0c109387832bb35a
4
- data.tar.gz: 7657f2a6942d2474d196f470c1fbaca8b069ae49619c483e8e0e2c1787b39410
3
+ metadata.gz: 9b93d9abe50ba1657318562b8fa04b645cfdd2fc22bca0f711cbde57b6d6b3c7
4
+ data.tar.gz: 1918f4689b50c6bda5b51d2f578b13b4bf439d38fb3510318165152b9093f1d2
5
5
  SHA512:
6
- metadata.gz: ef97e09b88610ae38f45295e650e8b79b5cdaf77e46d616753ffcc1aa98cb34f5f0267b30a1ca7dc3a859df55f9b4305b150e7412dc05ad1062504777be819d2
7
- data.tar.gz: c4cae237dd5fbf03da3ddb8061ee76cc597e5fcc44d45b6351d2a2fad646bf6f4e3ff035dd9dba803e4cb70c421bfeeea1b09544dcb4d837b9ad9135d7bec1cc
6
+ metadata.gz: 33c461c2915ef4f9582fd8f87b5b2afa230076f1349e88ef7f66987cb1a8dda25d97c26983421ca52f900c3dd2d48d313e44dd69a8b15984a349dbe3fe4b3fd9
7
+ data.tar.gz: 0ea1b378ae8044400d50ad33944881d27552b42296cae06ceda360617b30d26a9bb3614e6a81c10b0bd530bcf59ca10ef9be3fba928e4c98b2f22929c21f4a66
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- coverband-service-client (0.0.12.rc)
4
+ coverband-service-client (0.0.12.rc.1)
5
5
  coverband (~> 4.2.4)
6
6
 
7
7
  GEM
@@ -10,7 +10,7 @@ require 'securerandom'
10
10
  module Coverband
11
11
  COVERBAND_ENV = ENV['RACK_ENV'] || ENV['RAILS_ENV'] || (defined?(Rails) ? Rails.env : 'unknown')
12
12
  COVERBAND_SERVICE_URL = ENV['COVERBAND_URL'] || 'https://coverband.io'
13
- COVERBAND_TIMEOUT = (COVERBAND_ENV == 'development') ? 5 : 1
13
+ COVERBAND_TIMEOUT = (COVERBAND_ENV == 'development') ? 5 : 2
14
14
  COVERBAND_ENABLE_DEV_MODE = ENV['COVERBAND_ENABLE_DEV_MODE'] || false
15
15
  COVERBAND_ENABLE_TEST_MODE = ENV['COVERBAND_ENABLE_TEST_MODE'] || false
16
16
  COVERBAND_PROCESS_TYPE = ENV['PROCESS_TYPE'] || 'unknown'
@@ -39,7 +39,7 @@ module Coverband
39
39
  # * currently JSON, but likely better to move to something faster
40
40
  ###
41
41
  class Service < Base
42
- attr_reader :coverband_url, :process_type, :runtime_env, :hostname, :pid
42
+ attr_reader :coverband_url, :process_type, :runtime_env, :hostname, :pid, :stats
43
43
 
44
44
  def initialize(coverband_url, opts = {})
45
45
  super()
@@ -47,6 +47,25 @@ module Coverband
47
47
  @process_type = opts.fetch(:process_type) { $PROGRAM_NAME&.split('/')&.last || COVERBAND_PROCESS_TYPE }
48
48
  @hostname = opts.fetch(:hostname) { ENV["DYNO"] || Socket.gethostname.force_encoding('utf-8').encode }
49
49
  @runtime_env = opts.fetch(:runtime_env) { COVERBAND_ENV }
50
+ initialize_stats
51
+ end
52
+
53
+ def initialize_stats
54
+ return unless ENV['COVERBAND_STATS_KEY']
55
+ return unless defined?(Dogapi::Client)
56
+
57
+ @stats = Dogapi::Client.new(ENV['COVERBAND_STATS_KEY'])
58
+ end
59
+
60
+ def report_timing(timing)
61
+ return unless @stats
62
+
63
+ @stats.emit_point(
64
+ 'coverband.save.time',
65
+ timing,
66
+ host: hostname,
67
+ env: runtime_env,
68
+ client: "coverband_#{self.class.name.split("::").last}")
50
69
  end
51
70
 
52
71
  def logger
@@ -110,7 +129,11 @@ module Coverband
110
129
  file_coverage: data
111
130
  }
112
131
  }
132
+
133
+ starting = Process.clock_gettime(Process::CLOCK_MONOTONIC)
113
134
  save_coverage(full_package)
135
+ ending = Process.clock_gettime(Process::CLOCK_MONOTONIC)
136
+ report_timing((ending - starting))
114
137
  end&.join
115
138
  end
116
139
 
@@ -149,7 +172,7 @@ module Coverband
149
172
  end
150
173
 
151
174
  class PersistentService < Service
152
- attr_reader :http
175
+ attr_reader :http, :stats
153
176
 
154
177
  def initialize(coverband_url, opts = {})
155
178
  super
@@ -1,7 +1,7 @@
1
1
  module Coverband
2
2
  module Service
3
3
  module Client
4
- VERSION = '0.0.12.rc'
4
+ VERSION = '0.0.12.rc.1'
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coverband-service-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12.rc
4
+ version: 0.0.12.rc.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Mayer
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2020-06-15 00:00:00.000000000 Z
12
+ date: 2020-06-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler