Skip to content

Commit 308098b

Browse files
Deprecating python tools (#1596)
* fully depricating python functions * deprecating in docs --------- Co-authored-by: arik <alon.arik@gmail.com>
1 parent 46612f9 commit 308098b

File tree

3 files changed

+48
-4
lines changed

3 files changed

+48
-4
lines changed

docs/playbook-reference/actions/python-troubleshooting.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,24 @@ These actions can be triggered automatically on Prometheus alerts, or :ref:`manu
1111

1212
.. robusta-action:: playbooks.robusta_playbooks.pod_troubleshooting.python_debugger
1313

14+
This action has been deprecated. To enable it add the following to your generated_values.yaml
15+
16+
.. code-block:: bash
17+
runner:
18+
additional_env_vars:
19+
- name: PYTHON_DEBUGGER_IMAGE
20+
value: debug-toolkit:v6.0
21+
1422
.. robusta-action:: playbooks.robusta_playbooks.pod_troubleshooting.python_profiler
1523

24+
This action has been deprecated. To enable it add the following to your generated_values.yaml
25+
26+
.. code-block:: bash
27+
runner:
28+
additional_env_vars:
29+
- name: PYTHON_DEBUGGER_IMAGE
30+
value: debug-toolkit:v6.0
31+
1632
Manually trigger with:
1733

1834
.. code-block:: bash
@@ -21,6 +37,14 @@ These actions can be triggered automatically on Prometheus alerts, or :ref:`manu
2137
2238
.. robusta-action:: playbooks.robusta_playbooks.pod_troubleshooting.python_memory
2339

40+
This action has been deprecated. To enable it add the following to your generated_values.yaml
41+
42+
.. code-block:: bash
43+
runner:
44+
additional_env_vars:
45+
- name: PYTHON_DEBUGGER_IMAGE
46+
value: debug-toolkit:v6.0
47+
2448
Manually trigger with:
2549

2650
.. code-block:: bash

playbooks/robusta_playbooks/pod_troubleshooting.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
TableBlock,
2828
action,
2929
)
30+
from robusta.integrations.kubernetes.custom_models import PYTHON_DEBUGGER_IMAGE
3031
from robusta.utils.parsing import load_json
3132

3233

@@ -68,6 +69,10 @@ def python_profiler(event: PodEvent, action_params: StartProfilingParams):
6869
# This should use ephemeral containers, but they aren't in GA yet. To enable them on GCP for example,
6970
# you need to create a brand new cluster. Therefore we're sticking with regular containers for now
7071
pod = event.get_pod()
72+
if "debug-toolkit:v6.0" not in PYTHON_DEBUGGER_IMAGE:
73+
logging.error(f"The python_profiler action is deprecated "
74+
f"to run set the PYTHON_DEBUGGER_IMAGE environment variable to debug-toolkit:v6.0.")
75+
return
7176
logging.warning(f"The python_profiler action is deprecated and might not work on all platforms.")
7277
if not pod:
7378
logging.info(f"python_profiler - pod not found for event: {event}")
@@ -179,8 +184,11 @@ def python_memory(event: PodEvent, params: MemoryTraceParams):
179184
180185
Use this to track memory leaks in your Python application on Kubernetes.
181186
"""
187+
if "debug-toolkit:v6.0" not in PYTHON_DEBUGGER_IMAGE:
188+
logging.error(f"The python_memory action is deprecated and might not work on all platforms. "
189+
f"to enable it set the PYTHON_DEBUGGER_IMAGE environment variable to debug-toolkit:v6.0.")
190+
return
182191
pod = event.get_pod()
183-
logging.warning(f"The python_memory action is deprecated and might not work on all platforms.")
184192
if not pod:
185193
logging.info(f"python_memory - pod not found for event: {event}")
186194
return
@@ -296,7 +304,10 @@ def debugger_stack_trace(event: PodEvent, params: StackTraceParams):
296304
Create a finding with the stack trace results.
297305
"""
298306
pod = event.get_pod()
299-
logging.warning(f"The debugger_stack_trace action is deprecated and might not work on all platforms.")
307+
if "debug-toolkit:v6.0" not in PYTHON_DEBUGGER_IMAGE:
308+
logging.error(f"The debugger_stack_trace action is deprecated and might not work on all platforms. "
309+
f"to enable it set the PYTHON_DEBUGGER_IMAGE environment variable to debug-toolkit:v6.0.")
310+
return
300311
if not pod:
301312
logging.info(f"debugger_stack_trace - pod not found for event: {event}")
302313
return
@@ -381,6 +392,10 @@ def python_process_inspector(event: PodEvent, params: DebuggerParams):
381392
Create a finding with alternative debugging options for received processes ; i.e. Stack-trace or Memory-trace.
382393
383394
"""
395+
if "debug-toolkit:v6.0" not in PYTHON_DEBUGGER_IMAGE:
396+
logging.error(f"The python_process_inspector action is deprecated and might not work on all platforms. "
397+
f"to enable it set the PYTHON_DEBUGGER_IMAGE environment variable to debug-toolkit:v6.0.")
398+
return
384399
pod = event.get_pod()
385400
logging.warning(f"The python_process_inspector action is deprecated and might not work on all platforms.")
386401
if not pod:
@@ -440,6 +455,10 @@ def python_debugger(event: PodEvent, params: DebuggerParams):
440455
441456
Now you can use break points and log points in VSCode.
442457
"""
458+
if "debug-toolkit:v6.0" not in PYTHON_DEBUGGER_IMAGE:
459+
logging.error(f"The python_debugger action is deprecated and might not work on all platforms. "
460+
f"to enable it set the PYTHON_DEBUGGER_IMAGE environment variable to debug-toolkit:v6.0.")
461+
return
443462
pod = event.get_pod()
444463
logging.warning(f"The python_debugger action is deprecated and might not work on all platforms.")
445464
if not pod:

src/robusta/integrations/kubernetes/custom_models.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import logging
2+
import os
23
import re
34
import time
45
from dataclasses import dataclass, field
@@ -39,9 +40,9 @@
3940
S = TypeVar("S")
4041
T = TypeVar("T")
4142

42-
43+
PYTHON_DEBUGGER_IMAGE_OVERRIDE = os.getenv("PYTHON_DEBUGGER_IMAGE", "debug-toolkit:v8.0")
4344
# TODO: import these from the python-tools project
44-
PYTHON_DEBUGGER_IMAGE = f"{IMAGE_REGISTRY}/debug-toolkit:v6.0"
45+
PYTHON_DEBUGGER_IMAGE = f"{IMAGE_REGISTRY}/{PYTHON_DEBUGGER_IMAGE_OVERRIDE}"
4546
JAVA_DEBUGGER_IMAGE = f"{IMAGE_REGISTRY}/java-toolkit:v1.0.2"
4647

4748

0 commit comments

Comments
 (0)