Skip to content

Commit 0f79aa6

Browse files
author
Alex Evanczuk
authored
Stop emitting pack group metrics (#32)
* Remove nested pack stats * bump version
1 parent 5509292 commit 0f79aa6

File tree

6 files changed

+2
-389
lines changed

6 files changed

+2
-389
lines changed

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
pack_stats (0.0.5)
4+
pack_stats (0.0.6)
55
code_ownership
66
code_teams
77
dogapi

lib/pack_stats/private/datadog_reporter.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
require 'pack_stats/private/metrics/rubocop_usage'
1010
require 'pack_stats/private/metrics/packages'
1111
require 'pack_stats/private/metrics/packages_by_team'
12-
require 'pack_stats/private/metrics/nested_packs'
1312

1413
module PackStats
1514
module Private
@@ -29,7 +28,6 @@ def self.get_metrics(source_code_files:, app_name:)
2928
*Metrics::Files.get_metrics(source_code_files, app_name),
3029
*Metrics::Packages.get_package_metrics(packages, app_name),
3130
*Metrics::PackagesByTeam.get_package_metrics_by_team(packages, app_name),
32-
*Metrics::NestedPacks.get_nested_package_metrics(packages, app_name)
3331
]
3432
end
3533

lib/pack_stats/private/metrics/nested_packs.rb

Lines changed: 0 additions & 137 deletions
This file was deleted.

pack_stats.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Gem::Specification.new do |spec|
22
spec.name = 'pack_stats'
3-
spec.version = '0.0.5'
3+
spec.version = '0.0.6'
44
spec.authors = ['Gusto Engineers']
55
spec.email = ['dev@gusto.com']
66

spec/pack_stats_legacy_api_spec.rb

Lines changed: 0 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -910,130 +910,6 @@ module PackStats # rubocop:disable RSpec/DescribedClassModuleWrapping
910910
end
911911
end
912912

913-
context 'in an app with nested packs' do
914-
before do
915-
write_package_yml('.')
916-
write_package_yml('packs/fruits')
917-
write_package_yml('packs/fruits/apples')
918-
write_package_yml('packs/fruits/pears')
919-
920-
write_package_yml('packs/vegetables')
921-
write_package_yml('packs/vegetables/broccoli')
922-
923-
write_package_yml('packs/peanuts')
924-
write_package_yml('packs/cashews')
925-
926-
# Represents TWO privacy and TWO dependency violations across pack groups
927-
write_file('package_todo.yml', <<~CONTENTS)
928-
# This file contains a list of dependencies that are not part of the long term plan for ..
929-
# We should generally work to reduce this list, but not at the expense of actually getting work done.
930-
#
931-
# You can regenerate this file using the following command:
932-
#
933-
# bundle exec packwerk update-deprecations .
934-
---
935-
packs/fruits:
936-
"FruitsConstant":
937-
violations:
938-
- dependency
939-
- privacy
940-
files:
941-
- some_file1.rb
942-
- some_file2.rb
943-
CONTENTS
944-
945-
# Represents ONE privacy and ZERO dependency violations across pack groups
946-
write_file('packs/fruits/package_todo.yml', <<~CONTENTS)
947-
# This file contains a list of dependencies that are not part of the long term plan for ..
948-
# We should generally work to reduce this list, but not at the expense of actually getting work done.
949-
#
950-
# You can regenerate this file using the following command:
951-
#
952-
# bundle exec packwerk update-deprecations .
953-
---
954-
packs/fruits/apples:
955-
"ApplesConstant":
956-
violations:
957-
- dependency
958-
- privacy
959-
files:
960-
- some_file1.rb
961-
- some_file2.rb
962-
packs/peanuts:
963-
"PeanutsConstant":
964-
violations:
965-
- privacy
966-
files:
967-
- some_file1.rb
968-
CONTENTS
969-
970-
# Represents ZERO violations across pack groups
971-
write_file('packs/fruits/apples/package_todo.yml', <<~CONTENTS)
972-
# This file contains a list of dependencies that are not part of the long term plan for ..
973-
# We should generally work to reduce this list, but not at the expense of actually getting work done.
974-
#
975-
# You can regenerate this file using the following command:
976-
#
977-
# bundle exec packwerk update-deprecations .
978-
---
979-
packs/fruits:
980-
"FruitsConstant":
981-
violations:
982-
- dependency
983-
- privacy
984-
files:
985-
- packs/fruits/apples/some_file1.rb
986-
- packs/fruits/apples/some_file2.rb
987-
- packs/fruits/apples/some_file3.rb
988-
- packs/fruits/apples/some_file4.rb
989-
packs/fruits/pears:
990-
"PearsConstant":
991-
violations:
992-
- dependency
993-
- privacy
994-
files:
995-
- packs/fruits/apples/some_file1.rb
996-
- packs/fruits/apples/some_file2.rb
997-
- packs/fruits/apples/some_file3.rb
998-
- packs/fruits/apples/some_file4.rb
999-
packs/peanuts:
1000-
"PeanutsConstant":
1001-
violations:
1002-
- dependency
1003-
files:
1004-
- packs/fruits/apples/some_file1.rb
1005-
CONTENTS
1006-
end
1007-
1008-
it 'emits the right metrics' do
1009-
expect(metrics).to include_metric GaugeMetric.for('all_packages.count', 8, Tags.for(['app:MyApp']))
1010-
expect(metrics).to include_metric GaugeMetric.for('all_pack_groups.count', 5, Tags.for(['app:MyApp']))
1011-
expect(metrics).to include_metric GaugeMetric.for('child_packs.count', 3, Tags.for(['app:MyApp']))
1012-
expect(metrics).to include_metric GaugeMetric.for('parent_packs.count', 2, Tags.for(['app:MyApp']))
1013-
1014-
# Notice that this does not use a tag to specify the pack group -- the metric itself only sends information about cross-pack group violations
1015-
expect(metrics).to include_metric GaugeMetric.for('all_pack_groups.privacy_violations.count', 3, Tags.for(['app:MyApp']))
1016-
expect(metrics).to include_metric GaugeMetric.for('all_pack_groups.dependency_violations.count', 3, Tags.for(['app:MyApp']))
1017-
1018-
expect(metrics).to include_metric GaugeMetric.for('by_pack_group.outbound_dependency_violations.count', 2, Tags.for(['app:MyApp', 'pack_group:root']))
1019-
expect(metrics).to include_metric GaugeMetric.for('by_pack_group.outbound_dependency_violations.count', 1, Tags.for(['app:MyApp', 'pack_group:packs/fruits']))
1020-
expect(metrics).to include_metric GaugeMetric.for('by_pack_group.outbound_dependency_violations.count', 0, Tags.for(['app:MyApp', 'pack_group:packs/vegetables']))
1021-
expect(metrics).to include_metric GaugeMetric.for('by_pack_group.outbound_dependency_violations.count', 0, Tags.for(['app:MyApp', 'pack_group:packs/peanuts']))
1022-
expect(metrics).to include_metric GaugeMetric.for('by_pack_group.outbound_dependency_violations.count', 0, Tags.for(['app:MyApp', 'pack_group:packs/cashews']))
1023-
1024-
expect(metrics).to include_metric GaugeMetric.for('by_pack_group.inbound_privacy_violations.count', 0, Tags.for(['app:MyApp', 'pack_group:root']))
1025-
expect(metrics).to include_metric GaugeMetric.for('by_pack_group.inbound_privacy_violations.count', 2, Tags.for(['app:MyApp', 'pack_group:packs/fruits']))
1026-
expect(metrics).to include_metric GaugeMetric.for('by_pack_group.inbound_privacy_violations.count', 0, Tags.for(['app:MyApp', 'pack_group:packs/vegetables']))
1027-
expect(metrics).to include_metric GaugeMetric.for('by_pack_group.inbound_privacy_violations.count', 1, Tags.for(['app:MyApp', 'pack_group:packs/peanuts']))
1028-
expect(metrics).to include_metric GaugeMetric.for('by_pack_group.inbound_privacy_violations.count', 0, Tags.for(['app:MyApp', 'pack_group:packs/cashews']))
1029-
1030-
# This does have a tag for pack group, but the metric itself also only sends information about cross-pack group violations.
1031-
expect(metrics).to include_metric GaugeMetric.for('by_pack_group.outbound_dependency_violations.per_pack_group.count', 2, Tags.for(['app:MyApp', 'pack_group:root', 'to_pack_group:packs/fruits']))
1032-
expect(metrics).to include_metric GaugeMetric.for('by_pack_group.outbound_privacy_violations.per_pack_group.count', 2, Tags.for(['app:MyApp', 'pack_group:root', 'to_pack_group:packs/fruits']))
1033-
expect(metrics).to include_metric GaugeMetric.for('by_pack_group.outbound_dependency_violations.per_pack_group.count', 1, Tags.for(['app:MyApp', 'pack_group:packs/fruits', 'to_pack_group:packs/peanuts']))
1034-
end
1035-
end
1036-
1037913
context 'in an app with exclusions for rubocop based protections' do
1038914
before do
1039915
write_package_yml('.')

0 commit comments

Comments
 (0)