qontract-reconcile 0.10.2.dev2__py3-none-any.whl → 0.10.2.dev4__py3-none-any.whl

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: qontract-reconcile
3
- Version: 0.10.2.dev2
3
+ Version: 0.10.2.dev4
4
4
  Summary: Collection of tools to reconcile services with their desired state as defined in the app-interface DB.
5
5
  Project-URL: homepage, https://github.com/app-sre/qontract-reconcile
6
6
  Project-URL: repository, https://github.com/app-sre/qontract-reconcile
@@ -546,6 +546,7 @@ reconcile/typed_queries/users.py,sha256=UXlaxeZAoNIugMEndfcjbkHYowUURE72aWcdmxfb
546
546
  reconcile/typed_queries/vault.py,sha256=lkRsmobykorof3fcrIPLz-NgvAiSOWSOZc_jXBlnl1w,274
547
547
  reconcile/typed_queries/app_interface_metrics_exporter/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
548
548
  reconcile/typed_queries/app_interface_metrics_exporter/onboarding_status.py,sha256=X-N1WJGOL6OR9940P0_K4-YJzkL5Vg4favhYrBxXD9A,327
549
+ reconcile/typed_queries/app_interface_metrics_exporter/terraform_repo.py,sha256=r-nJ5CucAOE_cwxnbVp5lmAAfHBG8t1h2tVmhviVYls,290
549
550
  reconcile/typed_queries/cost_report/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
550
551
  reconcile/typed_queries/cost_report/app_names.py,sha256=HMEMIqAbMyVQfoQ5YXTXE4xDt7FaXBRz0QIHnsIZC1c,478
551
552
  reconcile/typed_queries/cost_report/cost_namespaces.py,sha256=1GUjWXQj7U2djVHBPYcd8Cy2-enKXf0-GaplLi8JZw4,1178
@@ -734,7 +735,7 @@ reconcile/utils/unleash/__init__.py,sha256=2PsN3GlLU8DOyWSvv5q9uzwuFn_vYtfEo-mmV
734
735
  reconcile/utils/unleash/client.py,sha256=YrJnauxjcy1ml7W2AHg7dzIH_fVK_GugoRu7IFmk6e0,3505
735
736
  reconcile/utils/unleash/server.py,sha256=907gDh9Ee8UxLqusnfpzE-7LUnttB38D4xhVJ0vMf_M,4439
736
737
  tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
737
- tools/app_interface_metrics_exporter.py,sha256=zkwkxdAUAxjdc-pzx2_oJXG25fo0Fnyd5JXPk-iPcOQ,1619
738
+ tools/app_interface_metrics_exporter.py,sha256=f1qwTmQfEcs98uBVRyBa0k7GQXdiSwd7w1hDVjhdGcQ,2303
738
739
  tools/app_interface_reporter.py,sha256=oZPib4HPq0aZ2Zui1QGJGk6qQdfpeihujGDBnSdKyGE,17627
739
740
  tools/glitchtip_access_reporter.py,sha256=oPBnk_YoDuljU3v0FaChzOwwnk4vap1xEE67QEjzdqs,2948
740
741
  tools/glitchtip_access_revalidation.py,sha256=8kbBJk04mkq28kWoRDDkfCGIF3GRg3pJrFAh1sW0dbk,2821
@@ -765,7 +766,7 @@ tools/saas_promotion_state/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJ
765
766
  tools/saas_promotion_state/saas_promotion_state.py,sha256=5LJ9rygZ304vxfsIuRfuxueoYRb72EZNKKITEcJ4Mtk,3908
766
767
  tools/sre_checkpoints/__init__.py,sha256=CDaDaywJnmRCLyl_NCcvxi-Zc0hTi_3OdwKiFOyS39I,145
767
768
  tools/sre_checkpoints/util.py,sha256=zEDbGr18ZeHNQwW8pUsr2JRjuXIPz--WAGJxZo9sv_Y,894
768
- qontract_reconcile-0.10.2.dev2.dist-info/METADATA,sha256=Sd_sWOWszVoWRNfKQMtEI9V6mQACj4uB8xJVVhLuRBs,24664
769
- qontract_reconcile-0.10.2.dev2.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
770
- qontract_reconcile-0.10.2.dev2.dist-info/entry_points.txt,sha256=JniHZPadNOILPyfSl0LF2YSp3Db7K2_W2CN7i9f3Gos,540
771
- qontract_reconcile-0.10.2.dev2.dist-info/RECORD,,
769
+ qontract_reconcile-0.10.2.dev4.dist-info/METADATA,sha256=6JpcVbuj12UW0J2qULhvWfnkkqmj2WD_nDux7q1Ig2c,24664
770
+ qontract_reconcile-0.10.2.dev4.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
771
+ qontract_reconcile-0.10.2.dev4.dist-info/entry_points.txt,sha256=JniHZPadNOILPyfSl0LF2YSp3Db7K2_W2CN7i9f3Gos,540
772
+ qontract_reconcile-0.10.2.dev4.dist-info/RECORD,,
@@ -0,0 +1,9 @@
1
+ from collections import Counter
2
+
3
+ from reconcile.gql_definitions.terraform_repo.terraform_repo import query
4
+ from reconcile.utils.gql import GqlApi
5
+
6
+
7
+ def get_tf_repo_inventory(gql: GqlApi) -> Counter:
8
+ repos = query(gql.query).repos or []
9
+ return Counter(r.account.name for r in repos)
@@ -12,6 +12,9 @@ from reconcile.cli import (
12
12
  from reconcile.typed_queries.app_interface_metrics_exporter.onboarding_status import (
13
13
  get_onboarding_status,
14
14
  )
15
+ from reconcile.typed_queries.app_interface_metrics_exporter.terraform_repo import (
16
+ get_tf_repo_inventory,
17
+ )
15
18
  from reconcile.utils import (
16
19
  gql,
17
20
  metrics,
@@ -38,6 +41,16 @@ class OverviewOnboardingStatus(OverviewBaseMetric, GaugeMetric):
38
41
  return "qontract_reconcile_onboarding_status"
39
42
 
40
43
 
44
+ class TerraformRepoInventory(OverviewBaseMetric, GaugeMetric):
45
+ """Overview of deployed Terraform Repos"""
46
+
47
+ aws_account: str
48
+
49
+ @classmethod
50
+ def name(cls) -> str:
51
+ return "qontract_reconcile_terraform_repo_inventory"
52
+
53
+
41
54
  def publish_onboarding_status_metrics(
42
55
  onboarding_status: Mapping[str, int],
43
56
  ) -> None:
@@ -52,6 +65,14 @@ def publish_onboarding_status_metrics(
52
65
  )
53
66
 
54
67
 
68
+ def publish_tf_repo_inventory(repos: Mapping[str, int]) -> None:
69
+ for account, count in repos.items():
70
+ metrics.set_gauge(
71
+ TerraformRepoInventory(integration=INTEGRATION, aws_account=account),
72
+ count,
73
+ )
74
+
75
+
55
76
  @click.command()
56
77
  @config_file
57
78
  @dry_run
@@ -62,6 +83,8 @@ def main(
62
83
  log_level: str,
63
84
  ) -> None:
64
85
  init_env(log_level=log_level, config_file=configfile)
86
+ repos = get_tf_repo_inventory(gql.get_api())
87
+ publish_tf_repo_inventory(repos)
65
88
  onboarding_status = get_onboarding_status(gql.get_api())
66
89
  publish_onboarding_status_metrics(onboarding_status)
67
90