pack_stats 0.1.0 → 0.1.2

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: fb012a138ad533b84c50a2349e006b2ad0fd4d1a6e4170c8883e17a709051377
4
- data.tar.gz: fd679a7ea57cf9508e9573ea1746fc31b2ac23070eed7f2b9375a6efc7d991c4
3
+ metadata.gz: 751c967ba6a3da1afb345c8b028ba980cd17b4cc9368282b42eb087c1401b298
4
+ data.tar.gz: c2f7d1793f72fff866ecbf384862be4cc03bdc25a6d4320be1455594f45c3dd9
5
5
  SHA512:
6
- metadata.gz: f224241cc9183501c6be5738a4ee61f53a863610ac883587dd7e43f0fa2c409fc2bd52a5ef97e1b840e8699346b79618397caecc937133a8f3f3d2108433e49c
7
- data.tar.gz: 7ebcf204658cf0cfdf96f86de7fb8f4e302eca96d5ecac23f65a07702680e674b2ed7396b499ef50be75143dd3289f34b2d0e1b1e0a8b66c5f9f04f222c77fe5
6
+ metadata.gz: a04690c416b60e9b0bf25c9f5317045cab51f49d4f998ace9c98e6ed66010bc39a3923fb13abbd8bb515dc56210310055f9e6b09ae62d442f885aee32109da98
7
+ data.tar.gz: 773ddba7ab3bd34a6637088d66fbf7157050ea071df8d678878ddf7f606277ec20dda1d53a8ffd39422384d42fe7c83faf29345e71f97b39a9ba5847b0c38699
data/README.md CHANGED
@@ -101,19 +101,6 @@ Right now this tool sends metrics to DataDog only. However, if you want to use t
101
101
 
102
102
  # Setting Up Your Dashboards
103
103
 
104
- Gusto has two dashboards that we've created to view these metrics. We've also exported and released the Dashboard JSON for each of these dashboards. You can create a new dashboard and then click "import dashboard JSON" to get a jump start on tracking your metrics. Note you may want to make some tweaks to these dashboards to better fit your organization's circumstances and goals.
104
+ We recommend the use of the dashboard that is shipped with this gem. You can create a new dashboard and then click "import dashboard JSON" to get a jump start on tracking your metrics. Note you may want to make some tweaks to these dashboards to better fit your organization's circumstances and goals.
105
105
 
106
- ## [Modularization] Executive Summary
107
-
108
- This helps answer questions like:
109
- - How are we doing on reducing dependency and privacy violations in your monolith overall?
110
- - How are we doing overall on adopting packwerk?
111
-
112
- [Dashboard JSON](docs/executive_summary.json)
113
-
114
- ## [Modularization] Per-Package and Per-Team
115
- - How is each team and package doing on reducing dependency and privacy violations in your monolith?
116
- - What is the total count of dependency/privacy violations for each pack/team and what's the change since last month?
117
- - Which pack/team does my pack/team have the most dependency/privacy violations on?
118
-
119
- [Dashboard JSON](docs/per_package_and_per_team.json)
106
+ [Dashboard JSON](docs/dashboard.json)
@@ -59,7 +59,10 @@ module PackStats
59
59
  checker.violation_type_tag
60
60
  ]
61
61
 
62
- all_metrics << GaugeMetric.for("by_package.violations.by_other_package.count", Metrics.file_count(violations), tags)
62
+ count = Metrics.file_count(violations)
63
+ if count > 0
64
+ all_metrics << GaugeMetric.for("by_package.violations.by_other_package.count", Metrics.file_count(violations), tags)
65
+ end
63
66
  end
64
67
  when PackwerkCheckerUsage::Direction::Inbound
65
68
  all_violations_of_type = inbound_violations.select { |v| v.type == checker.violation_type }
@@ -72,7 +75,10 @@ module PackStats
72
75
  checker.violation_type_tag
73
76
  ]
74
77
 
75
- all_metrics << GaugeMetric.for("by_package.violations.by_other_package.count", Metrics.file_count(violations), tags)
78
+ count = Metrics.file_count(violations)
79
+ if count > 0
80
+ all_metrics << GaugeMetric.for("by_package.violations.by_other_package.count", count, tags)
81
+ end
76
82
  end
77
83
  else
78
84
  T.absurd(direction)
@@ -44,7 +44,10 @@ module PackStats
44
44
  all_packages.group_by { |package| Private.package_owner(package) }.each do |other_team_name, other_teams_packages|
45
45
  violations = outbound_violations.select{|v| other_teams_packages.map(&:name).include?(v.to_package_name) && v.type == checker.violation_type}
46
46
  tags = team_tags + Metrics.tags_for_other_team(other_team_name) + [checker.violation_type_tag]
47
- all_metrics << GaugeMetric.for("by_team.violations.by_other_team.count", Metrics.file_count(violations), tags)
47
+ count = Metrics.file_count(violations)
48
+ if count > 0
49
+ all_metrics << GaugeMetric.for("by_team.violations.by_other_team.count", count, tags)
50
+ end
48
51
  end
49
52
  when PackwerkCheckerUsage::Direction::Inbound
50
53
  all_violations_of_type = inbound_violations.select { |v| v.type == checker.violation_type }
@@ -56,7 +59,10 @@ module PackStats
56
59
  all_packages.group_by { |package| Private.package_owner(package) }.each do |other_team_name, other_teams_packages|
57
60
  violations = other_teams_packages.flat_map(&:violations).select{|v| packages_for_team.map(&:name).include?(v.to_package_name) && v.type == checker.violation_type}
58
61
  tags = team_tags + Metrics.tags_for_other_team(other_team_name) + [checker.violation_type_tag]
59
- all_metrics << GaugeMetric.for("by_team.violations.by_other_team.count", Metrics.file_count(violations), tags)
62
+ count = Metrics.file_count(violations)
63
+ if count > 0
64
+ all_metrics << GaugeMetric.for("by_team.violations.by_other_team.count", count, tags)
65
+ end
60
66
  end
61
67
  else
62
68
  T.absurd(direction)
@@ -14,11 +14,19 @@ module PackStats
14
14
 
15
15
  sig { params(package: ParsePackwerk::Package, app_name: String).returns(T::Array[Tag]) }
16
16
  def self.tags_for_package(package, app_name)
17
- [
17
+
18
+ tags = [
18
19
  Tag.new(key: 'package', value: humanized_package_name(package.name)),
19
20
  Tag.new(key: 'app', value: app_name),
20
21
  *Metrics.tags_for_team(Private.package_owner(package)),
21
22
  ]
23
+
24
+ layer = package.config['layer']
25
+ if layer
26
+ tags << Tag.new(key: 'layer', value: layer)
27
+ end
28
+
29
+ tags
22
30
  end
23
31
 
24
32
  sig { params(team_name: T.nilable(String)).returns(T::Array[Tag]) }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pack_stats
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gusto Engineers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-08 00:00:00.000000000 Z
11
+ date: 2023-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: code_teams