greenhat 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 98d1acd7b3c698127214711199399e78d7b72f4762d8beb575fb2ac1d3e2ae1b
4
- data.tar.gz: 011d2f2e27b278a06f87605d13809f3472b5223f39937e6fed55ecc28476ea00
3
+ metadata.gz: 80ae7c6dafc44e996d7caba2d749ece00fb6a278d4fc1e948d1b3809f2c00d3f
4
+ data.tar.gz: 1ffeef454c84a4786d443947b772702672a7a91285ac073a2798e6d973006da4
5
5
  SHA512:
6
- metadata.gz: 2b253023196cc698fc9022455e1a43e6add8fae2e63512e946fb207619e7e29c83783e9b9a265e1f77ce3dcbcb81be270b7bb3896a0822c6bad06c51dec8571f
7
- data.tar.gz: 850d05cc4ea5d95e53e289c4781232af8719286c9b3c1165cf9afeac25bf19122a79249bc290ddad9cc4b00767d4c5396052fe5c7e9c43b9b7742f9c15eb1c7f
6
+ metadata.gz: fd728dee64de63c74f9e3505d79d723f67b167063fb6adb57108f1f61433a0f690c2dea4740e5e160520be710c190051318e695f98df1cdac23c6602ed5cf245
7
+ data.tar.gz: 1702b760383da6ee9a390876859fb0c4f9855b839edef562bdc9b4e0e5c97f8a939b25062bfcd8a907d7522b9229c26cbcf1b3886f5cd6057d0ab60656d60d4a
@@ -21,7 +21,7 @@ module GreenHat
21
21
  end
22
22
 
23
23
  def self.df(args = {})
24
- things = Thing.where(name: 'df_h')
24
+ things = Thing.where(name: 'df_hT')
25
25
 
26
26
  # Host / Archive
27
27
  things.select! { |x| x.archive? args.archive } if args.archive
data/lib/greenhat/host.rb CHANGED
@@ -115,7 +115,7 @@ class Host < Teron
115
115
  end
116
116
 
117
117
  def df_h
118
- file = find_thing 'df_h'
118
+ file = find_thing 'df_hT'
119
119
  return nil unless file
120
120
 
121
121
  file.raw
@@ -49,7 +49,7 @@ module GreenHat
49
49
  self.exceptions_log = archive.things.find { |x| x.name == 'gitlab-rails/exceptions_json.log' }
50
50
  self.gitaly_log = archive.things.find { |x| x.name == 'gitaly/current' }
51
51
  self.sidekiq_log = archive.things.find { |x| x.name == 'sidekiq/current' }
52
- self.disk_free = archive.things.find { |x| x.name == 'df_h' }
52
+ self.disk_free = archive.things.find { |x| x.name == 'df_hT' }
53
53
  end
54
54
 
55
55
  def show
@@ -41,7 +41,7 @@ module GreenHat
41
41
 
42
42
  def self.calculate_duration(results)
43
43
  # Skip for Pluck
44
- only_with_time = results.select { |x| x.instance_of?(Hash) && x.key?(:time) }
44
+ only_with_time = results.select { |x| x.instance_of?(Hash) && x.key?(:time) && x[:time].instance_of?(Time) }
45
45
 
46
46
  # If slice is used ignore
47
47
  return nil if only_with_time.empty?
@@ -53,7 +53,7 @@ module GreenHat
53
53
  self.exceptions_log = archive.things.find { |x| x.name == 'gitlab-rails/exceptions_json.log' }
54
54
  self.gitaly_log = archive.things.find { |x| x.name == 'gitaly/current' }
55
55
  self.sidekiq_log = archive.things.find { |x| x.name == 'sidekiq/current' }
56
- self.disk_free = archive.things.find { |x| x.name == 'df_h' }
56
+ self.disk_free = archive.things.find { |x| x.name == 'df_hT' }
57
57
  end
58
58
 
59
59
  def show
@@ -27,7 +27,8 @@ module GreenHat
27
27
  'df_h' => {
28
28
  format: :table,
29
29
  pattern: [
30
- /df_h/
30
+ /df_h/,
31
+ /df_hT/
31
32
  ]
32
33
  },
33
34
  'df_inodes' => {
@@ -151,6 +152,13 @@ module GreenHat
151
152
  %r{mailroom/mail_room_json.log}
152
153
  ]
153
154
  },
155
+ 'gitlab_migrations' => {
156
+ format: :raw,
157
+ log: true,
158
+ pattern: [
159
+ /gitlab_migrations/
160
+ ]
161
+ },
154
162
  'gitlab-rails/git_json.log' => {
155
163
  format: :json,
156
164
  log: true,
@@ -2,10 +2,24 @@
2
2
  module GreenHat
3
3
  # Log
4
4
  module Formatters
5
+ # Looks like this may be different per Type
6
+ def header_count
7
+ case name
8
+ when 'df_hT' then 7
9
+ end
10
+ end
11
+
5
12
  # Table Formatting
6
13
  def format_table
14
+ # Default to split by space unless specifically needed
15
+ headers_raw = if header_count
16
+ raw_full.first.split(' ', header_count)
17
+ else
18
+ raw_full.first.split
19
+ end
20
+
7
21
  # Headers to Readable Symbol
8
- headers = raw_full.first.split(' ', 6).map(&:downcase).map do |x|
22
+ headers = headers_raw.map(&:downcase).map do |x|
9
23
  x.gsub(/\s+/, '_').gsub(/[^0-9A-Za-z_]/, '')
10
24
  end.map(&:to_sym)
11
25
 
@@ -143,6 +143,7 @@ class Thing < Teron
143
143
  self.log = true
144
144
  self.parsed = true
145
145
  self.type = 'json'
146
+ self.kind = :json
146
147
  self.result_fields = field_processing
147
148
  save!
148
149
  end
@@ -1,3 +1,3 @@
1
1
  module GreenHat
2
- VERSION = '0.5.0'.freeze
2
+ VERSION = '0.5.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: greenhat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Davin Walker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-03 00:00:00.000000000 Z
11
+ date: 2022-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: amazing_print