dropsonde 0.0.5 → 0.0.8

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: 643def01638761803e04cf758bbf627ac821bb091fc7dad50c5b161251534728
4
- data.tar.gz: f0c8a36548214da7beeecee9dc583dcd8d81eceb640b967078fadf5b2978f987
3
+ metadata.gz: 05a4a694cd3915ec7c3683c7c8250fd1f857d07ef8fb6cae80c832404b35e3ce
4
+ data.tar.gz: 95245d11a85ef50539f86182cc458246178ffb24ff409bd04fbef9a0a23342ef
5
5
  SHA512:
6
- metadata.gz: 7c260e1617666fb83d7b0be1a3d73ad13aaee5c33844d5eb4117b186c6eec23a9aad6dc03ff3df393168b6a3715bf492ce677624fdbe536e4961d956d1e9cdcb
7
- data.tar.gz: cffbe7901afe08afa593ee73fa749358257efcd03d612564b3aac507684897d2d0db3e504a599d1eab7251508c3f455e236985501ea9f6722f108bb02cf80e2e
6
+ metadata.gz: a8eed2636ad7735accf3e3f6bacbcb16bae84514b3503e718eb96426ca0bbe6a39a06a9ea06727714b6e578ac4a3bd9ddd6fe76f9bebb4c1d63c084b3503c44b
7
+ data.tar.gz: 2d1c1cf87cef36cdcb196cab0c135970020389462b99b0ff8447dcefe3ae1f381da31a93ad29a34fedbfd6134eeba2b8c58a3ee30069021c74e3972a857f5950
data/CHANGELOG.md ADDED
@@ -0,0 +1,72 @@
1
+ # Changelog
2
+
3
+ ## [0.0.8](https://github.com/puppetlabs/dropsonde/tree/0.0.8) (2022-08-29)
4
+
5
+ [Full Changelog](https://github.com/puppetlabs/dropsonde/compare/v0.0.7...0.0.8)
6
+
7
+ **Merged pull requests:**
8
+
9
+ - \[maint\] correct cache [\#29](https://github.com/puppetlabs/dropsonde/pull/29) ([binford2k](https://github.com/binford2k))
10
+ - \[maint\] rubocop style fixes [\#28](https://github.com/puppetlabs/dropsonde/pull/28) ([binford2k](https://github.com/binford2k))
11
+ - Fix example generation [\#27](https://github.com/puppetlabs/dropsonde/pull/27) ([binford2k](https://github.com/binford2k))
12
+ - unused modules [\#26](https://github.com/puppetlabs/dropsonde/pull/26) ([binford2k](https://github.com/binford2k))
13
+ - Adding changelog generation to Rakefile [\#23](https://github.com/puppetlabs/dropsonde/pull/23) ([binford2k](https://github.com/binford2k))
14
+
15
+ ## [v0.0.7](https://github.com/puppetlabs/dropsonde/tree/v0.0.7) (2022-02-10)
16
+
17
+ [Full Changelog](https://github.com/puppetlabs/dropsonde/compare/v0.0.6...v0.0.7)
18
+
19
+ **Merged pull requests:**
20
+
21
+ - Releasing v00.7 [\#22](https://github.com/puppetlabs/dropsonde/pull/22) ([binford2k](https://github.com/binford2k))
22
+ - Releasing v00.7 [\#21](https://github.com/puppetlabs/dropsonde/pull/21) ([binford2k](https://github.com/binford2k))
23
+ - update server language [\#20](https://github.com/puppetlabs/dropsonde/pull/20) ([binford2k](https://github.com/binford2k))
24
+ - Updates the telemetry endpoint to a stable URL [\#19](https://github.com/puppetlabs/dropsonde/pull/19) ([MikaelSmith](https://github.com/MikaelSmith))
25
+ - docs updates now that it's shipped [\#18](https://github.com/puppetlabs/dropsonde/pull/18) ([binford2k](https://github.com/binford2k))
26
+
27
+ ## [v0.0.6](https://github.com/puppetlabs/dropsonde/tree/v0.0.6) (2021-11-17)
28
+
29
+ [Full Changelog](https://github.com/puppetlabs/dropsonde/compare/v0.0.5...v0.0.6)
30
+
31
+ **Merged pull requests:**
32
+
33
+ - \(MAINT\) Update gemspec license param to 'Apache-2.0' [\#17](https://github.com/puppetlabs/dropsonde/pull/17) ([sanfrancrisko](https://github.com/sanfrancrisko))
34
+ - \(MAINT\) Release prep for 0.0.6 [\#16](https://github.com/puppetlabs/dropsonde/pull/16) ([sanfrancrisko](https://github.com/sanfrancrisko))
35
+ - \(MAINT\) Fix Rubocop violations [\#15](https://github.com/puppetlabs/dropsonde/pull/15) ([sanfrancrisko](https://github.com/sanfrancrisko))
36
+ - \(SERVER-3079\) Allow overriding Puppet's base settings [\#14](https://github.com/puppetlabs/dropsonde/pull/14) ([Magisus](https://github.com/Magisus))
37
+ - Load Ruby's CA certificates instead of using httpclient defaults [\#13](https://github.com/puppetlabs/dropsonde/pull/13) ([Magisus](https://github.com/Magisus))
38
+ - \(IAC-1676\) - Add nightly workflow [\#12](https://github.com/puppetlabs/dropsonde/pull/12) ([adrianiurca](https://github.com/adrianiurca))
39
+ - \(IAC-1659\) - Add Acceptance Tests [\#11](https://github.com/puppetlabs/dropsonde/pull/11) ([adrianiurca](https://github.com/adrianiurca))
40
+ - \(IAC-1624\) - Expand unit test case suit [\#9](https://github.com/puppetlabs/dropsonde/pull/9) ([adrianiurca](https://github.com/adrianiurca))
41
+ - \(IAC-1620\) - replace travis workflow with github actions [\#8](https://github.com/puppetlabs/dropsonde/pull/8) ([adrianiurca](https://github.com/adrianiurca))
42
+ - \(IAC-1605\) - add static checks - rubocop [\#5](https://github.com/puppetlabs/dropsonde/pull/5) ([adrianiurca](https://github.com/adrianiurca))
43
+ - Allow to specify siteid with a flag [\#4](https://github.com/puppetlabs/dropsonde/pull/4) ([raphink](https://github.com/raphink))
44
+
45
+ ## [v0.0.5](https://github.com/puppetlabs/dropsonde/tree/v0.0.5) (2020-06-11)
46
+
47
+ [Full Changelog](https://github.com/puppetlabs/dropsonde/compare/v0.0.4...v0.0.5)
48
+
49
+ ## [v0.0.4](https://github.com/puppetlabs/dropsonde/tree/v0.0.4) (2020-06-05)
50
+
51
+ [Full Changelog](https://github.com/puppetlabs/dropsonde/compare/v0.0.3...v0.0.4)
52
+
53
+ ## [v0.0.3](https://github.com/puppetlabs/dropsonde/tree/v0.0.3) (2020-05-24)
54
+
55
+ [Full Changelog](https://github.com/puppetlabs/dropsonde/compare/v0.0.2...v0.0.3)
56
+
57
+ ## [v0.0.2](https://github.com/puppetlabs/dropsonde/tree/v0.0.2) (2020-05-08)
58
+
59
+ [Full Changelog](https://github.com/puppetlabs/dropsonde/compare/v0.0.1...v0.0.2)
60
+
61
+ ## [v0.0.1](https://github.com/puppetlabs/dropsonde/tree/v0.0.1) (2020-02-27)
62
+
63
+ [Full Changelog](https://github.com/puppetlabs/dropsonde/compare/502bce39de366c8d6816676e0cf7ca6284b90734...v0.0.1)
64
+
65
+ **Merged pull requests:**
66
+
67
+ - Add simple puppetfile metric [\#2](https://github.com/puppetlabs/dropsonde/pull/2) ([binford2k](https://github.com/binford2k))
68
+ - MVP workable tool [\#1](https://github.com/puppetlabs/dropsonde/pull/1) ([binford2k](https://github.com/binford2k))
69
+
70
+
71
+
72
+ \* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
data/README.md CHANGED
@@ -15,8 +15,7 @@ data in a way that lets you signal approval simply by using a module is the
15
15
  primary goal of this project.
16
16
 
17
17
  > **This means that the best way for you to help yourself find new modules is to
18
- > install this telemetry tool and, along with your peers, share your module usage
19
- > data.** ✅
18
+ > opt in and use this telemetry tool to share your module usage data.** ✅
20
19
 
21
20
 
22
21
  ## Design
@@ -34,11 +33,16 @@ You can see exactly what will be phoned home by running the command:
34
33
  $ dropsonde preview
35
34
  ```
36
35
 
37
- Dropsonde is a simple telemetry probe designed to run as a regular cron job.
38
- Metrics are defined by plugins that gather data, but also export a schema that
39
- constrains the data allowed to be reported on. Dropsonde will reject metrics
40
- that don't meet these constraints. The backend database is also defined by this
41
- schema so the system cannot gather any data that's not described in the schema.
36
+ > *Note:* as of Puppetserver 7.5.0, Dropsonde is bundled in as a standard `puppetserver`
37
+ > command. You should run it as `puppetserver dropsonde` (or `/opt/puppetlabs/bin/puppetserver
38
+ > dropsonde` if your `$PATH` isn't configured.)
39
+
40
+ Dropsonde is a simple telemetry probe designed to run both as a command-line
41
+ tool and optionally as a regularly scheduled task. Metrics are defined by
42
+ plugins that gather data, but also export a schema that constrains the data
43
+ allowed to be reported on. Dropsonde will reject metrics that don't meet these
44
+ constraints. The backend database is also defined by this schema so the system
45
+ cannot gather any data that's not described in the schema.
42
46
 
43
47
  See the full schema of all enabled plugins by running the command:
44
48
 
@@ -87,9 +91,11 @@ possible: [privacy@puppet.com](mailto:privacy@puppet.com)
87
91
 
88
92
  ## Installation
89
93
 
90
- This is distributed as a Ruby gem. Simply `gem install dropsonde`. There's a
91
- [Puppet module](https://github.com/puppetlabs/puppetlabs-dropsonde) to manage it
92
- if that's more your thing.
94
+ As of Puppetserver 7.5.0, Dropsonde is bundled in as a standard `puppetserver`
95
+ command. If you're running an older version, you can install it yourself with
96
+ `gem install dropsonde` or let the
97
+ [Puppet module](https://github.com/puppetlabs/puppetlabs-dropsonde) manage it
98
+ for you.
93
99
 
94
100
 
95
101
  ## Configuration
@@ -106,7 +112,29 @@ will not report the `:puppetfiles` metrics.
106
112
  - puppetfiles
107
113
  ```
108
114
 
109
- The `puppetlabs-dropsonde` Puppet module manages this configuration for you.
115
+ The [`puppetlabs-dropsonde`](https://github.com/puppetlabs/puppetlabs-dropsonde)
116
+ Puppet module manages this configuration for you.
117
+
118
+
119
+ ## Scheduled Reporting
120
+
121
+ Dropsonde is intended to run on a regular schedule to submit usage reports back
122
+ to Puppet. The [`puppetlabs-dropsonde`](https://github.com/puppetlabs/puppetlabs-dropsonde)
123
+ Puppet module will manage this for you, or you can follow the instructions below
124
+ to configure a schedule manually.
125
+
126
+ If you're running Puppetserver 7.5.0 or above, it's already set up so you can
127
+ simply opt in. Add or update the following stanza of
128
+ `/etc/puppetlabs/puppetserver/conf.d/puppetserver.conf`:
129
+
130
+ ``` hocon
131
+ dropsonde: {
132
+ enabled: true
133
+ }
134
+ ```
135
+
136
+ If you're running an older version of Puppetserver, then create a cron job that
137
+ runs `dropsonde submit` once a week.
110
138
 
111
139
 
112
140
  ## Running
@@ -139,7 +167,7 @@ Developer comands
139
167
 
140
168
  ## Architecture
141
169
 
142
- Dropsonde is a simple telemetry probe designed to run as a regular cron job. It
170
+ Dropsonde is a simple telemetry probe designed to run as a scheduled task. It
143
171
  will gather metrics defined by self-contained plugins that each defines its own
144
172
  partial schema and then gathers the data to meet that schema.
145
173
 
@@ -155,7 +183,8 @@ of modules is updated.
155
183
 
156
184
  ## Limitations
157
185
 
158
- This is super early in development and has not yet been battle tested.
186
+ The output format of individual metrics is not yet formally defined. If you write
187
+ tooling to use it, then make your tooling resilient to changes.
159
188
 
160
189
 
161
190
  Contact
data/bin/dropsonde CHANGED
@@ -5,6 +5,9 @@ require 'dropsonde'
5
5
  class Dropsonde
6
6
  extend GLI::App
7
7
 
8
+ @cache = nil
9
+ @puppetdb_session = Dropsonde.new
10
+
8
11
  program_desc 'A simple telemetry tool for Puppet infrastructures'
9
12
  config_file "#{File.dirname(Puppet.settings[:confdir])}/telemetry.yaml"
10
13
  version Dropsonde::VERSION
@@ -30,15 +33,18 @@ class Dropsonde
30
33
  desc 'Any number or string used to generate the randomized site ID.'
31
34
  flag [:seed]
32
35
 
36
+ desc 'Static site ID'
37
+ flag [:siteid]
38
+
33
39
  pre do |global, command, options, args|
34
40
  Dropsonde.settings = global
35
- Dropsonde::Cache.init(global[:cachepath], global[:ttl], global[:update])
41
+ @cache = Dropsonde::Cache.new(global[:cachepath], global[:ttl], global[:update])
36
42
  end
37
43
 
38
44
  desc 'Manually update the Forge module name cache'
39
45
  command :update do |c|
40
46
  c.action do |global, options, args|
41
- Dropsonde::Cache.update
47
+ @cache.update
42
48
  end
43
49
  end
44
50
 
@@ -55,21 +61,21 @@ class Dropsonde
55
61
  c.flag [:format], :default_value => 'human'
56
62
 
57
63
  c.action do |global, options, args|
58
- Dropsonde::Cache.autoupdate
59
- Dropsonde.generate_report(options[:format])
64
+ @cache.autoupdate
65
+ Dropsonde.generate_report(options[:format], @puppetdb_session)
60
66
  end
61
67
  end
62
68
 
63
69
  desc 'Submit a telemetry report'
64
70
  command :submit do |c|
65
71
  c.desc 'Telemetry endpoint'
66
- c.flag [:endpoint], :default_value => 'https://prod.dujour.k8s.puppet.net'
72
+ c.flag [:endpoint], :default_value => 'https://updates.puppet.com'
67
73
 
68
74
  c.desc 'Telemetry port'
69
75
  c.flag [:port], :default_value => 443, :type => Integer
70
76
 
71
77
  c.action do |global, options, args|
72
- Dropsonde::Cache.autoupdate
78
+ @cache.autoupdate
73
79
  Dropsonde.submit_report(options[:endpoint], options[:port])
74
80
  end
75
81
  end
@@ -111,7 +117,7 @@ class Dropsonde
111
117
  c.flag [:filename], :default_value => 'example.jsonl'
112
118
 
113
119
  c.action do |global, options, args|
114
- Dropsonde::Cache.autoupdate
120
+ @cache.autoupdate
115
121
  Dropsonde.generate_example(options[:size], options[:filename])
116
122
  end
117
123
  end
@@ -1,34 +1,47 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'date'
2
4
  require 'json'
3
5
  require 'fileutils'
4
6
  require 'puppet_forge'
5
7
 
8
+ # cache class
6
9
  class Dropsonde::Cache
7
- @@autoupdate = false
10
+ @@cache = nil # rubocop:disable Style/ClassVars
11
+ @autoupdate = false
8
12
 
9
- def self.init(path, ttl, autoupdate)
13
+ def initialize(path = '~/.dropsonde', ttl = 7, autoupdate = true) # rubocop:disable Style/OptionalBooleanParameter
14
+ path = File.expand_path(path)
10
15
  FileUtils.mkdir_p(path)
11
- @@path = "#{File.expand_path(path)}/forge.json"
12
- @@ttl = ttl
13
- @@autoupdate = autoupdate
14
-
15
- if File.file? @@path
16
- @@cache = JSON.parse(File.read(@@path))
17
- else
18
- @@cache = {
19
- 'timestamp' => '2000-1-1', # long before any puppet modules were released!
20
- 'modules' => [],
21
- }
22
- end
23
-
24
- PuppetForge.user_agent = "Dropsonde Telemetry Client/0.0.1"
16
+ @path = "#{path}/forge.json"
17
+ @ttl = ttl
18
+ @autoupdate = autoupdate
19
+
20
+ @@cache = if File.file? @path # rubocop:disable Style/ClassVars
21
+ JSON.parse(File.read(@path))
22
+ else
23
+ {
24
+ 'timestamp' => '2000-1-1', # long before any puppet modules were released!
25
+ 'modules' => [],
26
+ }
27
+ end
28
+
29
+ PuppetForge.user_agent = 'Dropsonde Telemetry Client/0.0.1'
25
30
  end
26
31
 
27
32
  def self.modules
28
33
  @@cache['modules']
29
34
  end
30
35
 
31
- def self.forgeModule?(mod)
36
+ def modules
37
+ Dropsonde::Cache.modules
38
+ end
39
+
40
+ def cache
41
+ @@cache
42
+ end
43
+
44
+ def self.forge_module?(mod)
32
45
  case mod
33
46
  when Puppet::Module
34
47
  modname = mod.forge_slug
@@ -39,12 +52,12 @@ class Dropsonde::Cache
39
52
  end
40
53
  return unless modname
41
54
 
42
- modules.include? modname.tr('/','-')
55
+ @@cache['modules'].include? modname.tr('/', '-')
43
56
  end
44
57
 
45
- def self.update
46
- puts "Updating module cache..."
47
- iter = PuppetForge::Module.all(:sort_by => 'latest_release')
58
+ def update
59
+ puts 'Updating module cache...'
60
+ iter = PuppetForge::Module.all(sort_by: 'latest_release')
48
61
  newest = DateTime.parse(@@cache['timestamp'])
49
62
 
50
63
  @@cache['timestamp'] = iter.first.updated_at
@@ -53,7 +66,7 @@ class Dropsonde::Cache
53
66
  # stop once we reach modules we've already cached
54
67
  break if DateTime.parse(iter.first.updated_at) <= newest
55
68
 
56
- @@cache['modules'].concat iter.map {|mod| mod.slug }
69
+ @@cache['modules'].concat(iter.map { |mod| mod.slug })
57
70
 
58
71
  iter = iter.next
59
72
  print '.'
@@ -62,22 +75,19 @@ class Dropsonde::Cache
62
75
  @@cache['modules'].sort!
63
76
  @@cache['modules'].uniq!
64
77
 
65
- File.write(@@path, JSON.pretty_generate(@@cache))
78
+ File.write(@path, JSON.pretty_generate(@@cache))
66
79
  end
67
80
 
68
- def self.autoupdate
69
- return unless @@autoupdate
81
+ def autoupdate
82
+ return unless @autoupdate
70
83
 
71
- unless File.file? @@path
72
- puts "Dropsonde caches a list of all Forge modules to ensure that it only reports"
73
- puts "usage data on public modules. Generating this cache may take some time on"
84
+ unless File.file? @path
85
+ puts 'Dropsonde caches a list of all Forge modules to ensure that it only reports'
86
+ puts 'usage data on public modules. Generating this cache may take some time on'
74
87
  puts "the first run and you'll see your screen fill up with dots."
75
88
  update
76
89
  end
77
90
 
78
- if (Date.today - File.mtime(@@path).to_date).to_i > @@ttl
79
- update
80
- end
91
+ return update if (Date.today - File.mtime(@path).to_date).to_i > @ttl
81
92
  end
82
-
83
93
  end
@@ -1,3 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ # dependencies plugin
1
4
  class Dropsonde::Metrics::Dependencies
2
5
  def self.initialize_dependencies
3
6
  # require any libraries needed here -- no need to load puppet; it's already initialized
@@ -5,10 +8,10 @@ class Dropsonde::Metrics::Dependencies
5
8
  end
6
9
 
7
10
  def self.description
8
- <<~EOF
11
+ <<~DESCRIPTION
9
12
  This group of metrics discovers dependencies between modules in all
10
13
  environments. It will omit dependencies on private modules.
11
- EOF
14
+ DESCRIPTION
12
15
  end
13
16
 
14
17
  def self.schema
@@ -18,23 +21,23 @@ class Dropsonde::Metrics::Dependencies
18
21
  {
19
22
  "fields": [
20
23
  {
21
- "description": "The depended on module name",
22
- "mode": "NULLABLE",
23
- "name": "name",
24
- "type": "STRING"
24
+ "description": 'The depended on module name',
25
+ "mode": 'NULLABLE',
26
+ "name": 'name',
27
+ "type": 'STRING',
25
28
  },
26
29
  {
27
- "description": "The depended on module version requirement",
28
- "mode": "NULLABLE",
29
- "name": "version_requirement",
30
- "type": "STRING"
31
- }
30
+ "description": 'The depended on module version requirement',
31
+ "mode": 'NULLABLE',
32
+ "name": 'version_requirement',
33
+ "type": 'STRING',
34
+ },
32
35
  ],
33
- "description": "List of modules that private modules in all environments depend on.",
34
- "mode": "REPEATED",
35
- "name": "dependencies",
36
- "type": "RECORD"
37
- }
36
+ "description": 'List of modules that private modules in all environments depend on.',
37
+ "mode": 'REPEATED',
38
+ "name": 'dependencies',
39
+ "type": 'RECORD',
40
+ },
38
41
  ]
39
42
  end
40
43
 
@@ -42,26 +45,25 @@ class Dropsonde::Metrics::Dependencies
42
45
  # run just before generating this metric
43
46
  end
44
47
 
45
- def self.run
48
+ def self.run(_puppetdb_session = nil)
46
49
  # return an array of hashes representing the data to be merged into the combined checkin
47
- environments = Puppet.lookup(:environments).list.map{|e|e.name}
48
- modules = environments.map do |env|
50
+ environments = Puppet.lookup(:environments).list.map { |e| e.name }
51
+ modules = environments.map { |env|
49
52
  Puppet.lookup(:environments).get(env).modules
50
- end.flatten
53
+ }.flatten
51
54
 
52
55
  # we want only PUBLIC modules that PRIVATE modules depend on
53
- dependencies = modules.map do|mod|
56
+ dependencies = modules.map { |mod|
54
57
  next unless mod.dependencies
55
- next if Dropsonde::Cache.forgeModule? mod # skip unless this is a private module
58
+ next if Dropsonde::Cache.forge_module? mod # skip unless this is a private module
56
59
 
57
60
  # and return a list of all public modules it depends on
58
- mod.dependencies.select {|mod| Dropsonde::Cache.forgeModule? mod }
59
- end.flatten.compact
61
+ mod.dependencies.select { |dep| Dropsonde::Cache.forge_module? dep }
62
+ }.flatten.compact
60
63
 
61
64
  [
62
- { :dependencies => dependencies },
65
+ { dependencies: dependencies },
63
66
  ]
64
-
65
67
  end
66
68
 
67
69
  def self.example
@@ -71,12 +73,14 @@ class Dropsonde::Metrics::Dependencies
71
73
 
72
74
  versions = ['>= 1.5.2', '>= 4.3.2', '>= 3.0.0 < 4.0.0', '>= 2.2.1 < 5.0.0', '>= 5.0.0 < 7.0.0', '>= 4.11.0']
73
75
  [
74
- :dependencies => Dropsonde::Cache.modules
75
- .sample(rand(250))
76
- .map {|item| {
77
- :name => item,
78
- :version_requirement => versions.sample,
79
- }},
76
+ dependencies: Dropsonde::Cache.modules
77
+ .sample(rand(250))
78
+ .map do |item|
79
+ {
80
+ name: item,
81
+ version_requirement: versions.sample,
82
+ }
83
+ end,
80
84
  ]
81
85
  end
82
86
 
@@ -1,3 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ # environments plugin
1
4
  class Dropsonde::Metrics::Environments
2
5
  def self.initialize_environments
3
6
  # Require any libraries needed here -- no need to load puppet or puppetdb;
@@ -7,20 +10,20 @@ class Dropsonde::Metrics::Environments
7
10
 
8
11
  def self.description
9
12
  # This is a Ruby squiggle heredoc; just a multi-line string with indentation removed
10
- <<~EOF
13
+ <<~DESCRIPTION
11
14
  This group of metrics gathers information about environments.
12
- EOF
15
+ DESCRIPTION
13
16
  end
14
17
 
15
18
  def self.schema
16
19
  # return an array of hashes of a partial schema to be merged into the complete schema
17
20
  [
18
21
  {
19
- "description": "The number of environments",
20
- "mode": "NULLABLE",
21
- "name": "environment_count",
22
- "type": "INTEGER"
23
- }
22
+ "description": 'The number of environments',
23
+ "mode": 'NULLABLE',
24
+ "name": 'environment_count',
25
+ "type": 'INTEGER',
26
+ },
24
27
  ]
25
28
  end
26
29
 
@@ -28,10 +31,10 @@ class Dropsonde::Metrics::Environments
28
31
  # run just before generating this metric
29
32
  end
30
33
 
31
- def self.run
34
+ def self.run(_puppetdb_session = nil)
32
35
  # return an array of hashes representing the data to be merged into the combined checkin
33
36
  [
34
- :environment_count => Puppet.lookup(:environments).list.count,
37
+ environment_count: Puppet.lookup(:environments).list.count,
35
38
  ]
36
39
  end
37
40
 
@@ -40,7 +43,7 @@ class Dropsonde::Metrics::Environments
40
43
  # make it easier to write data aggregation queries without access to the
41
44
  # actual private data that users have submitted.
42
45
  [
43
- :environment_count => rand(1..100),
46
+ environment_count: rand(1..100),
44
47
  ]
45
48
  end
46
49