commons-metrics 0.0.27__tar.gz → 0.0.29__tar.gz
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.
- {commons_metrics-0.0.27 → commons_metrics-0.0.29}/PKG-INFO +1 -1
- {commons_metrics-0.0.27 → commons_metrics-0.0.29}/commons_metrics/__init__.py +1 -1
- {commons_metrics-0.0.27 → commons_metrics-0.0.29}/commons_metrics/github_api_client.py +7 -4
- {commons_metrics-0.0.27 → commons_metrics-0.0.29}/commons_metrics/util.py +1 -11
- {commons_metrics-0.0.27 → commons_metrics-0.0.29}/commons_metrics.egg-info/PKG-INFO +1 -1
- {commons_metrics-0.0.27 → commons_metrics-0.0.29}/setup.py +1 -1
- {commons_metrics-0.0.27 → commons_metrics-0.0.29}/LICENSE +0 -0
- {commons_metrics-0.0.27 → commons_metrics-0.0.29}/README.md +0 -0
- {commons_metrics-0.0.27 → commons_metrics-0.0.29}/commons_metrics/azure_devops_client.py +0 -0
- {commons_metrics-0.0.27 → commons_metrics-0.0.29}/commons_metrics/cache_manager.py +0 -0
- {commons_metrics-0.0.27 → commons_metrics-0.0.29}/commons_metrics/commons_repos_client.py +0 -0
- {commons_metrics-0.0.27 → commons_metrics-0.0.29}/commons_metrics/database.py +0 -0
- {commons_metrics-0.0.27 → commons_metrics-0.0.29}/commons_metrics/date_utils.py +0 -0
- {commons_metrics-0.0.27 → commons_metrics-0.0.29}/commons_metrics/repositories.py +0 -0
- {commons_metrics-0.0.27 → commons_metrics-0.0.29}/commons_metrics/s3_file_manager.py +0 -0
- {commons_metrics-0.0.27 → commons_metrics-0.0.29}/commons_metrics/text_simplifier.py +0 -0
- {commons_metrics-0.0.27 → commons_metrics-0.0.29}/commons_metrics/update_design_components.py +0 -0
- {commons_metrics-0.0.27 → commons_metrics-0.0.29}/commons_metrics/variable_finder.py +0 -0
- {commons_metrics-0.0.27 → commons_metrics-0.0.29}/commons_metrics.egg-info/SOURCES.txt +0 -0
- {commons_metrics-0.0.27 → commons_metrics-0.0.29}/commons_metrics.egg-info/dependency_links.txt +0 -0
- {commons_metrics-0.0.27 → commons_metrics-0.0.29}/commons_metrics.egg-info/requires.txt +0 -0
- {commons_metrics-0.0.27 → commons_metrics-0.0.29}/commons_metrics.egg-info/top_level.txt +0 -0
- {commons_metrics-0.0.27 → commons_metrics-0.0.29}/setup.cfg +0 -0
|
@@ -12,4 +12,4 @@ from .text_simplifier import TextSimplifier
|
|
|
12
12
|
from .variable_finder import VariableFinder
|
|
13
13
|
|
|
14
14
|
__all__ = ['Util', 'DatabaseConnection', 'ComponentRepository', 'UpdateDesignSystemComponents', 'GitHubAPIClient', 'AzureDevOpsClient', 'S3FileManager', 'CacheManager', 'CommonsReposClient', 'DateUtils', 'TextSimplifier', 'VariableFinder']
|
|
15
|
-
__version__ = '0.0.
|
|
15
|
+
__version__ = '0.0.29'
|
|
@@ -10,14 +10,15 @@ from .commons_repos_client import CommonsReposClient
|
|
|
10
10
|
class RateLimiter:
|
|
11
11
|
"""
|
|
12
12
|
Controla el rate limiting para respetar los límites de API de GitHub.
|
|
13
|
-
GitHub permite
|
|
13
|
+
GitHub App permite 15000 requests/hora autenticados = ~4.17 TPS.
|
|
14
|
+
Personal Access Token: 5000 requests/hora = ~1.4 TPS.
|
|
14
15
|
|
|
15
16
|
Estrategia adaptativa:
|
|
16
17
|
1. Cuando está cerca del límite (>90%), aumenta delays si falta >10min para reset
|
|
17
18
|
2. Si faltan <10min para reset, reduce delay a 10ms para usar toda la cuota
|
|
18
19
|
3. Exponential backoff solo para errores 403/429 de rate limit
|
|
19
20
|
"""
|
|
20
|
-
def __init__(self, delay: float = 0.
|
|
21
|
+
def __init__(self, delay: float = 0.24, token: str = None):
|
|
21
22
|
self.base_delay = delay
|
|
22
23
|
self.current_delay = delay
|
|
23
24
|
self.last_request_time = 0
|
|
@@ -104,7 +105,9 @@ class RateLimiter:
|
|
|
104
105
|
class GitHubAPIClient:
|
|
105
106
|
"""
|
|
106
107
|
Cliente para interactuar con la API de GitHub con rate limiting integrado.
|
|
107
|
-
Controla automáticamente el TPS para no exceder los límites de GitHub
|
|
108
|
+
Controla automáticamente el TPS para no exceder los límites de GitHub:
|
|
109
|
+
- GitHub App: 15000 req/hora (~4.17 TPS)
|
|
110
|
+
- Personal Token: 5000 req/hora (~1.4 TPS)
|
|
108
111
|
|
|
109
112
|
Incluye:
|
|
110
113
|
- Rate limiting adaptativo (ajusta delays según uso)
|
|
@@ -137,7 +140,7 @@ class GitHubAPIClient:
|
|
|
137
140
|
|
|
138
141
|
# Inicializar rate limiter compartido con token
|
|
139
142
|
if GitHubAPIClient._rate_limiter is None:
|
|
140
|
-
GitHubAPIClient._rate_limiter = RateLimiter(delay=0.
|
|
143
|
+
GitHubAPIClient._rate_limiter = RateLimiter(delay=0.24, token=token)
|
|
141
144
|
|
|
142
145
|
def _request_with_backoff(self, method: str, url: str, max_retries: int = 5, **kwargs):
|
|
143
146
|
"""
|
|
@@ -6,9 +6,7 @@ class Util:
|
|
|
6
6
|
|
|
7
7
|
@staticmethod
|
|
8
8
|
def get_secret_aws(secret_name: str, logger, region_name: str):
|
|
9
|
-
"""
|
|
10
|
-
Retrieves AWS Secrets Manager secret and returns database credentials
|
|
11
|
-
"""
|
|
9
|
+
"""Retrieves a secret from AWS Secrets Manager"""
|
|
12
10
|
try:
|
|
13
11
|
session = boto3.session.Session()
|
|
14
12
|
client = session.client(
|
|
@@ -20,14 +18,6 @@ class Util:
|
|
|
20
18
|
secret_string = get_secret_value_response['SecretString']
|
|
21
19
|
secret_json = json.loads(secret_string)
|
|
22
20
|
|
|
23
|
-
required_keys = ["password", "host", "port", "username", "dbname"]
|
|
24
|
-
missing_keys = [key for key in required_keys if key not in secret_json]
|
|
25
|
-
|
|
26
|
-
if missing_keys:
|
|
27
|
-
msg = f"Missing required keys in AWS secret: {missing_keys}"
|
|
28
|
-
logger.error(msg)
|
|
29
|
-
raise KeyError(msg)
|
|
30
|
-
|
|
31
21
|
return secret_json
|
|
32
22
|
|
|
33
23
|
except Exception as e:
|
|
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
|
|
2
2
|
|
|
3
3
|
setup(
|
|
4
4
|
name='commons_metrics',
|
|
5
|
-
version='0.0.
|
|
5
|
+
version='0.0.29',
|
|
6
6
|
description='A simple library for basic statistical calculations',
|
|
7
7
|
#long_description=open('USAGE.md').read(),
|
|
8
8
|
#long_description_content_type='text/markdown',
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{commons_metrics-0.0.27 → commons_metrics-0.0.29}/commons_metrics/update_design_components.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{commons_metrics-0.0.27 → commons_metrics-0.0.29}/commons_metrics.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|