Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: dynamic selectors with alert_foreign_logs_enricher #1600

Merged
merged 10 commits into from
Oct 21, 2024

Conversation

nherment
Copy link
Contributor

@nherment nherment commented Oct 17, 2024

This adds support for calling the logs enricher based on the labels of a prometheus alert

image

Documentation

image

image

image

@@ -8,6 +8,7 @@
from hikaru.model.rel_1_26 import Node
from kubernetes import client
from kubernetes.client import V1Pod, V1PodList, exceptions
from playbooks.robusta_playbooks.util import resolve_selectors
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this import looks like the issue with pytest

2024-10-18 12:51:43.140 ERROR    failed to module alerts_integration
Traceback (most recent call last):
  File "/app/src/robusta/runner/config_loader.py", line 1[82](https://github.com/robusta-dev/robusta/actions/runs/11403920443/job/31731978176?pr=1600#step:11:83), in __import_playbooks_package
    m = importlib.reload(importlib.import_module(module_name))
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 6[90](https://github.com/robusta-dev/robusta/actions/runs/11403920443/job/31731978176?pr=1600#step:11:91), in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/venv/lib/python3.11/site-packages/robusta_playbooks/alerts_integration.py", line 11, in <module>
    from playbooks.robusta_playbooks.util import resolve_selectors
ModuleNotFoundError: No module named 'playbooks'

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if it's a code that is common to different playbooks packages, maybe it's better to put in in the core package, and not in the playbooks package

playbooks packages are loaded dynamically, so having dependencies between playbooks file must validate the are loaded in the right order (with the core package, this problem doesn't exist)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arikalon1 As this PR adds no more imports than were already existing I suggest to make that change in another PR if you think it's warranted.

@nherment nherment marked this pull request as ready for review October 21, 2024 13:42
Copy link
Contributor

@arikalon1 arikalon1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice work!

@arikalon1 arikalon1 merged commit 31ccccf into master Oct 21, 2024
7 checks passed
@arikalon1 arikalon1 deleted the main-2342_dynamic_prometheus_foreign_logs_enricher branch October 21, 2024 17:32
@nherment
Copy link
Contributor Author

Fixes #1529

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants