diff --git a/poetry.lock b/poetry.lock index dff01df4..71fbc3a4 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 2.1.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 2.1.4 and should not be changed by hand. [[package]] name = "about-time" @@ -407,7 +407,7 @@ description = "Backport of PEP 654 (exception groups)" optional = false python-versions = ">=3.7" groups = ["dev"] -markers = "python_version <= \"3.10\"" +markers = "python_version < \"3.11\"" files = [ {file = "exceptiongroup-1.2.0-py3-none-any.whl", hash = "sha256:4bfd3996ac73b41e9b9628b04e079f193850720ea5945fc96a08633c66912f14"}, {file = "exceptiongroup-1.2.0.tar.gz", hash = "sha256:91f5c769735f051a4290d52edd0858999b57e5876e9f85937691bd4c9fa3ed68"}, @@ -571,7 +571,7 @@ description = "Read metadata from Python packages" optional = false python-versions = ">=3.8" groups = ["dev"] -markers = "python_version < \"3.10\"" +markers = "python_version == \"3.9\"" files = [ {file = "importlib_metadata-7.0.2-py3-none-any.whl", hash = "sha256:f4bc4c0c070c490abf4ce96d715f68e95923320370efb66143df00199bb6c100"}, {file = "importlib_metadata-7.0.2.tar.gz", hash = "sha256:198f568f3230878cb1b44fbd7975f87906c22336dba2e4a7f05278c281fbd792"}, @@ -592,7 +592,7 @@ description = "Read resources from Python packages" optional = false python-versions = ">=3.8" groups = ["main"] -markers = "python_version < \"3.10\"" +markers = "python_version == \"3.9\"" files = [ {file = "importlib_resources-6.3.0-py3-none-any.whl", hash = "sha256:783407aa1cd05550e3aa123e8f7cfaebee35ffa9cb0242919e2d1e4172222705"}, {file = "importlib_resources-6.3.0.tar.gz", hash = "sha256:166072a97e86917a9025876f34286f549b9caf1d10b35a1b372bffa1600c6569"}, @@ -1238,14 +1238,14 @@ requests = "*" [[package]] name = "prometrix" -version = "0.2.1" +version = "0.2.2" description = "A Python Prometheus client for all Prometheus instances." optional = false python-versions = "<4.0,>=3.8" groups = ["main"] files = [ - {file = "prometrix-0.2.1-py3-none-any.whl", hash = "sha256:55108ddfe396b49a074c27fbfb3e12264f9d5d1fc05a8b3989ec993b5ba5eab4"}, - {file = "prometrix-0.2.1.tar.gz", hash = "sha256:4bd07eac7a1a51d0fb2050648e0faefb91e541cc71131db15f1dddfd6e096fcf"}, + {file = "prometrix-0.2.2-py3-none-any.whl", hash = "sha256:5a32983a95e6c77fa120f00877e64df6da06a2428eef1ab9bdf3c02a4ea9767d"}, + {file = "prometrix-0.2.2.tar.gz", hash = "sha256:f51d08c9d6e910de43a10c965f354949beecddf47dd34aa91698fe46fb47c9f5"}, ] [package.dependencies] @@ -1849,7 +1849,7 @@ description = "A lil' TOML parser" optional = false python-versions = ">=3.7" groups = ["dev"] -markers = "python_version <= \"3.10\"" +markers = "python_version < \"3.11\"" files = [ {file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"}, {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, @@ -2017,7 +2017,7 @@ files = [ {file = "zipp-3.20.2-py3-none-any.whl", hash = "sha256:a817ac80d6cf4b23bf7f2828b7cabf326f15a001bea8b1f9b49631780ba28350"}, {file = "zipp-3.20.2.tar.gz", hash = "sha256:bc9eb26f4506fda01b81bcde0ca78103b6e62f991b381fec825435c836edbc29"}, ] -markers = {dev = "python_version < \"3.10\""} +markers = {dev = "python_version == \"3.9\""} [package.extras] check = ["pytest-checkdocs (>=2.4)", "pytest-ruff (>=0.2.1) ; sys_platform != \"cygwin\""] @@ -2030,4 +2030,4 @@ type = ["pytest-mypy"] [metadata] lock-version = "2.1" python-versions = ">=3.9,<=3.12.9" -content-hash = "1332dc9ef46998d740d5804475f876d75530179c34fe623017b120edd0f94088" +content-hash = "130cc5c1113661b1f7f01236df40d4c174e4aba968d32e1bcc1ee1d3e04f8db0" diff --git a/pyproject.toml b/pyproject.toml index 3618ff8a..0013e1de 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,7 +30,7 @@ kubernetes = "^26.1.0" prometheus-api-client = "0.5.3" numpy = ">=1.26.4,<1.27.0" alive-progress = "^3.1.2" -prometrix = "0.2.1" +prometrix = "0.2.2" slack-sdk = "^3.21.3" pandas = "2.2.2" requests = "2.32.0" diff --git a/requirements.txt b/requirements.txt index f7b3d948..d51569b3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -16,7 +16,7 @@ google-auth==2.28.2 ; python_version >= "3.9" and python_full_version < "3.13" grapheme==0.6.0 ; python_version >= "3.9" and python_full_version < "3.13" httmock==1.4.0 ; python_version >= "3.9" and python_full_version < "3.13" idna==3.7 ; python_version >= "3.9" and python_full_version < "3.13" -importlib-resources==6.3.0 ; python_version >= "3.9" and python_version < "3.10" +importlib-resources==6.3.0 ; python_version == "3.9" jmespath==1.0.1 ; python_version >= "3.9" and python_full_version < "3.13" kiwisolver==1.4.5 ; python_version >= "3.9" and python_full_version < "3.13" kubernetes==26.1.0 ; python_version >= "3.9" and python_full_version < "3.13" @@ -27,7 +27,7 @@ packaging==24.0 ; python_version >= "3.9" and python_full_version < "3.13" pandas==2.2.2 ; python_version >= "3.9" and python_full_version < "3.13" pillow==10.3.0 ; python_version >= "3.9" and python_full_version < "3.13" prometheus-api-client==0.5.3 ; python_version >= "3.9" and python_full_version < "3.13" -prometrix==0.1.17 ; python_version >= "3.9" and python_full_version < "3.13" +prometrix==0.2.2 ; python_version >= "3.9" and python_full_version < "3.13" pyasn1-modules==0.3.0 ; python_version >= "3.9" and python_full_version < "3.13" pyasn1==0.5.1 ; python_version >= "3.9" and python_full_version < "3.13" pydantic==1.10.15 ; python_version >= "3.9" and python_full_version < "3.13" @@ -42,15 +42,15 @@ requests==2.32.0 ; python_version >= "3.9" and python_full_version < "3.13" rich==12.6.0 ; python_version >= "3.9" and python_full_version < "3.13" rsa==4.9 ; python_version >= "3.9" and python_full_version < "3.13" s3transfer==0.10.0 ; python_version >= "3.9" and python_full_version < "3.13" -setuptools==78.1.1 ; python_version >= "3.9" and python_full_version < "3.13" +setuptools==80.9.0 ; python_version >= "3.9" and python_full_version < "3.13" shellingham==1.5.4 ; python_version >= "3.9" and python_full_version < "3.13" six==1.16.0 ; python_version >= "3.9" and python_full_version < "3.13" slack-sdk==3.27.1 ; python_version >= "3.9" and python_full_version < "3.13" -typer[all]==0.7.0 ; python_version >= "3.9" and python_full_version < "3.13" +tenacity==9.0.0 ; python_version >= "3.9" and python_full_version < "3.13" +typer==0.7.0 ; python_version >= "3.9" and python_full_version < "3.13" typing-extensions==4.6.0 ; python_version >= "3.9" and python_full_version < "3.13" tzdata==2024.1 ; python_version >= "3.9" and python_full_version < "3.13" tzlocal==5.2 ; python_version >= "3.9" and python_full_version < "3.13" -urllib3==1.26.19 ; python_version >= "3.9" and python_full_version < "3.13" +urllib3==1.26.20 ; python_version >= "3.9" and python_full_version < "3.13" websocket-client==1.7.0 ; python_version >= "3.9" and python_full_version < "3.13" -zipp==3.19.2 ; python_version >= "3.9" and python_version < "3.13" -tenacity==9.0.0 ; python_version >= "3.9" and python_version < "3.13" \ No newline at end of file +zipp==3.20.2 ; python_version >= "3.9" and python_full_version < "3.13" diff --git a/robusta_krr/core/integrations/prometheus/metrics_service/prometheus_metrics_service.py b/robusta_krr/core/integrations/prometheus/metrics_service/prometheus_metrics_service.py index aab7a3fc..d795add6 100644 --- a/robusta_krr/core/integrations/prometheus/metrics_service/prometheus_metrics_service.py +++ b/robusta_krr/core/integrations/prometheus/metrics_service/prometheus_metrics_service.py @@ -216,7 +216,7 @@ async def gather_data( async def query_and_validate(self, prom_query) -> Any: result = await self.query(prom_query) if len(result) != 1: - logger.warning(f"Error: Expected exactly one result from Prometheus query. {prom_query}") + logger.warning(f"Error: Expected exactly one result from Prometheus query but instead got {len(result)}. {prom_query}") return None result_value = result[0].get("value") diff --git a/robusta_krr/core/integrations/prometheus/prometheus_utils.py b/robusta_krr/core/integrations/prometheus/prometheus_utils.py index 5d6d80ea..41fafba0 100644 --- a/robusta_krr/core/integrations/prometheus/prometheus_utils.py +++ b/robusta_krr/core/integrations/prometheus/prometheus_utils.py @@ -37,6 +37,7 @@ def generate_prometheus_config( session = boto3.Session(profile_name=settings.eks_managed_prom_profile_name) credentials = session.get_credentials() region = settings.eks_managed_prom_region if settings.eks_managed_prom_region else session.region_name + token = None if settings.eks_access_key and settings.eks_secret_key: # when we have both access key and secret key, don't try to read credentials which can fail @@ -47,7 +48,8 @@ def generate_prometheus_config( credentials = credentials.get_frozen_credentials() access_key = settings.eks_access_key if settings.eks_access_key else credentials.access_key secret_key = settings.eks_secret_key.get_secret_value() if settings.eks_secret_key else credentials.secret_key - + token = credentials.token + service_name = settings.eks_service_name if settings.eks_secret_key else "aps" if not region: raise Exception("No eks region specified") @@ -56,6 +58,7 @@ def generate_prometheus_config( access_key=access_key, secret_access_key=secret_key, aws_region=region, + token=token, service_name=service_name, **baseconfig, )