chef-telemetry 1.0.1 → 1.0.14

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: 951106fab84f344b20c55bc404f20d9bb2a95cb01a72932601760fd631b2057d
4
- data.tar.gz: '08e2823c213708756f6ba4928391fdea3b1ed31d3788d4c77fc949f978baf81e'
3
+ metadata.gz: 405cb6ee43827c1b73cc089e79f072cebe2ccd76ae59310b329d7ac27fe0f13f
4
+ data.tar.gz: 9bb8e14499f75a34e83fe929b141151c5557c25bda5d209aa213c6c82d654ddf
5
5
  SHA512:
6
- metadata.gz: 61c52d92b225a46f7657c3527fc2a38f30e1a0d28e144e6f90530a52616217d84e9297c03c50065ecc5a1c94c557d493f64ed262d5727a2647a4112c2ddedb84
7
- data.tar.gz: a46f56f408161b1ed0962266aa31433d5378d1d811c1652bec1173f5c488a1b4f55fcd4d615950f9cae98e44626aa7195c2bb3c2aa40b63c37081299dbea650b
6
+ metadata.gz: 733ebb7aaf3417e00a566c3628d19b141d8ced9e4f6955fa87700539ac3593c0ab17422e391523136c0745f6d9e7d2b8888a07d60e49ed335b9e3d9064c0f645
7
+ data.tar.gz: 5854f27a9bf16e88c46ab463438756a53e9c843584d0545afe7b6eedca5ece82f189d5baac2e5c8479ec0d650931634aa0db0a1b049c36d9c76f6f620691d95d
@@ -15,14 +15,14 @@
15
15
  # limitations under the License.
16
16
  #
17
17
 
18
- require "chef/telemetry/version"
19
- require "benchmark"
20
- require "forwardable"
21
- require "singleton"
22
- require "json"
18
+ require_relative "telemetry/version"
19
+ require "benchmark" unless defined?(Benchmark)
20
+ require "forwardable" unless defined?(Forwardable)
21
+ require "singleton" unless defined?(Singleton)
22
+ require "json" unless defined?(JSON)
23
23
  require "digest/sha1"
24
- require "securerandom"
25
- require "yaml"
24
+ require "securerandom" unless defined?(SecureRandom)
25
+ require "yaml" unless defined?(YAML)
26
26
 
27
27
  class Chef
28
28
  # This definites the Telemeter interface. Implementation thoughts for
@@ -51,17 +51,18 @@ class Chef
51
51
  # :dev_mode # false, not required
52
52
  config[:dev_mode] ||= false
53
53
  config[:enabled] ||= false
54
- require "chef_core/telemeter/sender"
54
+ require_relative "telemeter/sender"
55
55
  @config = config
56
56
  Sender.start_upload_thread(config)
57
57
  end
58
58
 
59
59
  def enabled?
60
- require "chef/telemetry/decision"
60
+ require_relative "telemetry/decision"
61
61
  config[:enabled] && !Telemetry::Decision.env_opt_out?
62
62
  end
63
63
 
64
64
  def initialize
65
+ @config = []
65
66
  @events_to_send = []
66
67
  @run_timestamp = Time.now.utc.strftime("%FT%TZ")
67
68
  end
@@ -15,8 +15,8 @@
15
15
  # limitations under the License.
16
16
  #
17
17
 
18
- require "chef/telemetry"
19
- require "chef/telemeter"
18
+ require_relative "../telemetry"
19
+ require_relative "../telemeter"
20
20
  require "logger"
21
21
 
22
22
  class Chef
@@ -1,8 +1,8 @@
1
- require "chef/telemetry/client"
2
- require "chef/telemetry/decision"
3
- require "chef/telemetry/event"
4
- require "chef/telemetry/session"
5
- require "chef/telemetry/version"
1
+ require_relative "telemetry/client"
2
+ require_relative "telemetry/decision"
3
+ require_relative "telemetry/event"
4
+ require_relative "telemetry/session"
5
+ require_relative "telemetry/version"
6
6
 
7
7
  class Chef
8
8
  class Telemetry
@@ -1,4 +1,6 @@
1
- require "http"
1
+ require "net/http" unless defined?(Net::HTTP)
2
+ require "uri" unless defined?(URI)
3
+ require "json" unless defined?(JSON)
2
4
  require "concurrent"
3
5
 
4
6
  class Chef
@@ -11,11 +13,18 @@ class Chef
11
13
  attr_reader :http
12
14
  def initialize(endpoint = TELEMETRY_ENDPOINT)
13
15
  super()
14
- @http = HTTP.persistent(endpoint)
16
+ uri = URI(endpoint)
17
+ @http = Net::HTTP.new(uri.host, uri.port)
18
+ @http.use_ssl = uri.scheme == "https"
19
+ @http.start
15
20
  end
16
21
 
17
22
  def fire(event)
18
- http.post("/events", json: event).flush
23
+ req = Net::HTTP::Post.new("/events")
24
+ req["Content-Type"] = "application/json"
25
+ req.body = JSON.dump(event)
26
+ # TODO: @cwolfe use response and at least debug log status
27
+ http.request req
19
28
  end
20
29
  end
21
30
 
@@ -1,4 +1,4 @@
1
- require "securerandom"
1
+ require "securerandom" unless defined?(SecureRandom)
2
2
  require "chef-config/path_helper"
3
3
 
4
4
  class Chef
@@ -1,5 +1,5 @@
1
1
  class Chef
2
2
  class Telemetry
3
- VERSION = "1.0.1".freeze
3
+ VERSION = "1.0.14".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-telemetry
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chef Software, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-16 00:00:00.000000000 Z
11
+ date: 2020-08-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -24,20 +24,6 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: http
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '2.2'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '2.2'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: ffi-yajl
43
29
  requirement: !ruby/object:Gem::Requirement