qontract-reconcile 0.10.1rc827__py3-none-any.whl → 0.10.1rc829__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.1
2
2
  Name: qontract-reconcile
3
- Version: 0.10.1rc827
3
+ Version: 0.10.1rc829
4
4
  Summary: Collection of tools to reconcile services with their desired state as defined in the app-interface DB.
5
5
  Home-page: https://github.com/app-sre/qontract-reconcile
6
6
  Author: Red Hat App-SRE Team
@@ -53,7 +53,7 @@ reconcile/mr_client_gateway.py,sha256=WhjMd-sIXDFCV8-rt8CEjurJ5OYB1pOD0K3o0tZRXQ
53
53
  reconcile/ocm_additional_routers.py,sha256=KfcFDVbNoc6n5dHWjYdAf1_DiVqVG6Tw23WLKoV8cdg,3306
54
54
  reconcile/ocm_addons.py,sha256=qqAyqRBRbdZQvAcjb-QlSVyRAyQBZk6iVlgnI4jyi7s,3353
55
55
  reconcile/ocm_addons_upgrade_tests_trigger.py,sha256=L1ktYynIR7pmHiYtdCTdLGJRKX72B54KUAuPLOccXzo,3995
56
- reconcile/ocm_aws_infrastructure_access.py,sha256=kDnJP6aOFO263LSbdCxJMmUwVsM3LgdzebtIUOoIhH8,7130
56
+ reconcile/ocm_aws_infrastructure_access.py,sha256=SghVWdmgliPVo_xHsp-e64_iC3mqDiia2ANSHb-g5G8,6891
57
57
  reconcile/ocm_clusters.py,sha256=ZUW4aqZuRDNzNS_Ojx-sjWIxemdgiJUIJn51YaQa_7k,16733
58
58
  reconcile/ocm_external_configuration_labels.py,sha256=imEpDv1RBpCSj8tHDv0R76hmNCFtcUzVNgS1yOVl8vs,3870
59
59
  reconcile/ocm_github_idp.py,sha256=glwXMsIBcl38-OmDDQCpe0YoLLXfoRgVQmqwXMEXjds,3946
@@ -178,8 +178,8 @@ reconcile/cna/assets/asset.py,sha256=1v51uYSaD1NOc9cI_YxG7h0NOcR1ng-mkmD2UzQ8PXE
178
178
  reconcile/cna/assets/asset_factory.py,sha256=7T7X_J6xIsoGETqBRI45_EyIKEdQcnRPt_GAuVuLQcc,785
179
179
  reconcile/cna/assets/null.py,sha256=Fby1Fbn7oNRIGNasdyhRDvXJ0ktpxv-pUAPN0lZWSzk,1684
180
180
  reconcile/dynatrace_token_provider/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
181
- reconcile/dynatrace_token_provider/integration.py,sha256=d13ulyEYD9U32D6s641o_Oibx1g4f6jr1vHQL_KbZts,16257
182
- reconcile/dynatrace_token_provider/metrics.py,sha256=F92Vh8CQBFs-bCF3pNpd8ZqsBwqgyK-A6pOCu_eAI1s,1074
181
+ reconcile/dynatrace_token_provider/integration.py,sha256=NZOwk6t5X8p5fUo2FNsBgGHhAXq4vXsj3GCowiu0UWk,16531
182
+ reconcile/dynatrace_token_provider/metrics.py,sha256=xiKkl8fTEBQaXJelGCPNTZhHAWdO1M3pCXNr_Tei63c,1285
183
183
  reconcile/external_resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
184
184
  reconcile/external_resources/aws.py,sha256=JvjKaABy2Pg8u8Lq82Acv4zMvpE3_qGKes7OG-zlHOM,2956
185
185
  reconcile/external_resources/factories.py,sha256=bLboXX5Dq0xN60mtDGNjCOLC6HlKofXMWQxVbRwMMwo,4485
@@ -812,8 +812,8 @@ tools/test/test_app_interface_metrics_exporter.py,sha256=SX7qL3D1SIRKFo95FoQztvf
812
812
  tools/test/test_qontract_cli.py,sha256=_D61RFGAN5x44CY1tYbouhlGXXABwYfxKSWSQx3Jrss,4941
813
813
  tools/test/test_sd_app_sre_alert_report.py,sha256=v363r9zM7__0kR5K6mvJoGFcM9BvE33fWAayrqkpojA,2116
814
814
  tools/test/test_sre_checkpoints.py,sha256=SKqPPTl9ua0RFdSSofnoQX-JZE6dFLO3LRhfQzqtfh8,2607
815
- qontract_reconcile-0.10.1rc827.dist-info/METADATA,sha256=u5Eopi8oHyBimPZUq-Bc7QvHZttOUWrLGXF2f7raVV4,2314
816
- qontract_reconcile-0.10.1rc827.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
817
- qontract_reconcile-0.10.1rc827.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
818
- qontract_reconcile-0.10.1rc827.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
819
- qontract_reconcile-0.10.1rc827.dist-info/RECORD,,
815
+ qontract_reconcile-0.10.1rc829.dist-info/METADATA,sha256=8jspD3vzw80R29pQxWjY5gVkjY9vOssyh89GY6k4TIE,2314
816
+ qontract_reconcile-0.10.1rc829.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
817
+ qontract_reconcile-0.10.1rc829.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
818
+ qontract_reconcile-0.10.1rc829.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
819
+ qontract_reconcile-0.10.1rc829.dist-info/RECORD,,
@@ -12,6 +12,7 @@ from dynatrace import Dynatrace
12
12
  from dynatrace.environment_v2.tokens_api import ApiTokenCreated
13
13
 
14
14
  from reconcile.dynatrace_token_provider.metrics import (
15
+ DTPClustersManagedGauge,
15
16
  DTPOrganizationErrorRate,
16
17
  )
17
18
  from reconcile.gql_definitions.common.ocm_environments import (
@@ -93,6 +94,13 @@ class DynatraceTokenProviderIntegration(
93
94
  "key", dtp_label_key("%")
94
95
  ),
95
96
  )
97
+ metrics.set_gauge(
98
+ DTPClustersManagedGauge(
99
+ integration=self.name,
100
+ ocm_env=env.name,
101
+ ),
102
+ len(clusters),
103
+ )
96
104
  if not clusters:
97
105
  continue
98
106
  if self.params.ocm_organization_ids:
@@ -3,6 +3,7 @@ from pydantic import BaseModel
3
3
  from reconcile.utils.metrics import (
4
4
  CounterMetric,
5
5
  ErrorRateMetricSet,
6
+ GaugeMetric,
6
7
  )
7
8
 
8
9
 
@@ -41,3 +42,11 @@ class DTPOrganizationErrorRate(ErrorRateMetricSet):
41
42
  org_id=org_id,
42
43
  ),
43
44
  )
45
+
46
+
47
+ class DTPClustersManagedGauge(DTPBaseMetric, GaugeMetric):
48
+ "Gauge for the number of clusters DTP manages"
49
+
50
+ @classmethod
51
+ def name(cls) -> str:
52
+ return "dtp_clusters_managed"
@@ -52,17 +52,9 @@ def fetch_current_state(clusters):
52
52
  return ocm_map, current_state, current_failed, current_deleting
53
53
 
54
54
 
55
- def fetch_desired_state():
55
+ def fetch_desired_state(clusters):
56
56
  desired_state = []
57
57
 
58
- # get desired state defined in awsInfrastructureAccess
59
- # or awsInfrastructureManagementAccounts
60
- # sections of cluster files
61
- clusters = [
62
- c
63
- for c in queries.get_clusters(aws_infrastructure_access=True)
64
- if c.get("ocm") is not None and c["spec"]["product"] in SUPPORTED_OCM_PRODUCTS
65
- ]
66
58
  for cluster_info in clusters:
67
59
  cluster = cluster_info["name"]
68
60
  aws_infra_access_items = cluster_info.get("awsInfrastructureAccess") or []
@@ -181,12 +173,16 @@ def _cluster_is_compatible(cluster: Mapping[str, Any]) -> bool:
181
173
  )
182
174
 
183
175
 
184
- def run(dry_run):
185
- clusters = [
176
+ def get_clusters():
177
+ return [
186
178
  c
187
179
  for c in queries.get_clusters(aws_infrastructure_access=True)
188
180
  if integration_is_enabled(QONTRACT_INTEGRATION, c) and _cluster_is_compatible(c)
189
181
  ]
182
+
183
+
184
+ def run(dry_run):
185
+ clusters = get_clusters()
190
186
  if not clusters:
191
187
  logging.debug(
192
188
  "No OCM Aws infrastructure access definitions found in app-interface"
@@ -196,11 +192,11 @@ def run(dry_run):
196
192
  ocm_map, current_state, current_failed, current_deleting = fetch_current_state(
197
193
  clusters
198
194
  )
199
- desired_state = fetch_desired_state()
195
+ desired_state = fetch_desired_state(clusters)
200
196
  act(
201
197
  dry_run, ocm_map, current_state, current_failed, desired_state, current_deleting
202
198
  )
203
199
 
204
200
 
205
201
  def early_exit_desired_state(*args: Any, **kwargs: Any) -> dict[str, Any]:
206
- return {"state": fetch_desired_state()}
202
+ return {"state": fetch_desired_state(clusters=get_clusters())}