holmesgpt 0.11.5__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.

Potentially problematic release.


This version of holmesgpt might be problematic. Click here for more details.

Files changed (183) hide show
  1. holmes/.git_archival.json +7 -0
  2. holmes/__init__.py +76 -0
  3. holmes/__init__.py.bak +76 -0
  4. holmes/clients/robusta_client.py +24 -0
  5. holmes/common/env_vars.py +47 -0
  6. holmes/config.py +526 -0
  7. holmes/core/__init__.py +0 -0
  8. holmes/core/conversations.py +578 -0
  9. holmes/core/investigation.py +152 -0
  10. holmes/core/investigation_structured_output.py +264 -0
  11. holmes/core/issue.py +54 -0
  12. holmes/core/llm.py +250 -0
  13. holmes/core/models.py +157 -0
  14. holmes/core/openai_formatting.py +51 -0
  15. holmes/core/performance_timing.py +72 -0
  16. holmes/core/prompt.py +42 -0
  17. holmes/core/resource_instruction.py +17 -0
  18. holmes/core/runbooks.py +26 -0
  19. holmes/core/safeguards.py +120 -0
  20. holmes/core/supabase_dal.py +540 -0
  21. holmes/core/tool_calling_llm.py +798 -0
  22. holmes/core/tools.py +566 -0
  23. holmes/core/tools_utils/__init__.py +0 -0
  24. holmes/core/tools_utils/tool_executor.py +65 -0
  25. holmes/core/tools_utils/toolset_utils.py +52 -0
  26. holmes/core/toolset_manager.py +418 -0
  27. holmes/interactive.py +229 -0
  28. holmes/main.py +1041 -0
  29. holmes/plugins/__init__.py +0 -0
  30. holmes/plugins/destinations/__init__.py +6 -0
  31. holmes/plugins/destinations/slack/__init__.py +2 -0
  32. holmes/plugins/destinations/slack/plugin.py +163 -0
  33. holmes/plugins/interfaces.py +32 -0
  34. holmes/plugins/prompts/__init__.py +48 -0
  35. holmes/plugins/prompts/_current_date_time.jinja2 +1 -0
  36. holmes/plugins/prompts/_default_log_prompt.jinja2 +11 -0
  37. holmes/plugins/prompts/_fetch_logs.jinja2 +36 -0
  38. holmes/plugins/prompts/_general_instructions.jinja2 +86 -0
  39. holmes/plugins/prompts/_global_instructions.jinja2 +12 -0
  40. holmes/plugins/prompts/_runbook_instructions.jinja2 +13 -0
  41. holmes/plugins/prompts/_toolsets_instructions.jinja2 +56 -0
  42. holmes/plugins/prompts/generic_ask.jinja2 +36 -0
  43. holmes/plugins/prompts/generic_ask_conversation.jinja2 +32 -0
  44. holmes/plugins/prompts/generic_ask_for_issue_conversation.jinja2 +50 -0
  45. holmes/plugins/prompts/generic_investigation.jinja2 +42 -0
  46. holmes/plugins/prompts/generic_post_processing.jinja2 +13 -0
  47. holmes/plugins/prompts/generic_ticket.jinja2 +12 -0
  48. holmes/plugins/prompts/investigation_output_format.jinja2 +32 -0
  49. holmes/plugins/prompts/kubernetes_workload_ask.jinja2 +84 -0
  50. holmes/plugins/prompts/kubernetes_workload_chat.jinja2 +39 -0
  51. holmes/plugins/runbooks/README.md +22 -0
  52. holmes/plugins/runbooks/__init__.py +100 -0
  53. holmes/plugins/runbooks/catalog.json +14 -0
  54. holmes/plugins/runbooks/jira.yaml +12 -0
  55. holmes/plugins/runbooks/kube-prometheus-stack.yaml +10 -0
  56. holmes/plugins/runbooks/networking/dns_troubleshooting_instructions.md +66 -0
  57. holmes/plugins/runbooks/upgrade/upgrade_troubleshooting_instructions.md +44 -0
  58. holmes/plugins/sources/github/__init__.py +77 -0
  59. holmes/plugins/sources/jira/__init__.py +123 -0
  60. holmes/plugins/sources/opsgenie/__init__.py +93 -0
  61. holmes/plugins/sources/pagerduty/__init__.py +147 -0
  62. holmes/plugins/sources/prometheus/__init__.py +0 -0
  63. holmes/plugins/sources/prometheus/models.py +104 -0
  64. holmes/plugins/sources/prometheus/plugin.py +154 -0
  65. holmes/plugins/toolsets/__init__.py +171 -0
  66. holmes/plugins/toolsets/aks-node-health.yaml +65 -0
  67. holmes/plugins/toolsets/aks.yaml +86 -0
  68. holmes/plugins/toolsets/argocd.yaml +70 -0
  69. holmes/plugins/toolsets/atlas_mongodb/instructions.jinja2 +8 -0
  70. holmes/plugins/toolsets/atlas_mongodb/mongodb_atlas.py +307 -0
  71. holmes/plugins/toolsets/aws.yaml +76 -0
  72. holmes/plugins/toolsets/azure_sql/__init__.py +0 -0
  73. holmes/plugins/toolsets/azure_sql/apis/alert_monitoring_api.py +600 -0
  74. holmes/plugins/toolsets/azure_sql/apis/azure_sql_api.py +309 -0
  75. holmes/plugins/toolsets/azure_sql/apis/connection_failure_api.py +445 -0
  76. holmes/plugins/toolsets/azure_sql/apis/connection_monitoring_api.py +251 -0
  77. holmes/plugins/toolsets/azure_sql/apis/storage_analysis_api.py +317 -0
  78. holmes/plugins/toolsets/azure_sql/azure_base_toolset.py +55 -0
  79. holmes/plugins/toolsets/azure_sql/azure_sql_instructions.jinja2 +137 -0
  80. holmes/plugins/toolsets/azure_sql/azure_sql_toolset.py +183 -0
  81. holmes/plugins/toolsets/azure_sql/install.md +66 -0
  82. holmes/plugins/toolsets/azure_sql/tools/__init__.py +1 -0
  83. holmes/plugins/toolsets/azure_sql/tools/analyze_connection_failures.py +324 -0
  84. holmes/plugins/toolsets/azure_sql/tools/analyze_database_connections.py +243 -0
  85. holmes/plugins/toolsets/azure_sql/tools/analyze_database_health_status.py +205 -0
  86. holmes/plugins/toolsets/azure_sql/tools/analyze_database_performance.py +249 -0
  87. holmes/plugins/toolsets/azure_sql/tools/analyze_database_storage.py +373 -0
  88. holmes/plugins/toolsets/azure_sql/tools/get_active_alerts.py +237 -0
  89. holmes/plugins/toolsets/azure_sql/tools/get_slow_queries.py +172 -0
  90. holmes/plugins/toolsets/azure_sql/tools/get_top_cpu_queries.py +170 -0
  91. holmes/plugins/toolsets/azure_sql/tools/get_top_data_io_queries.py +188 -0
  92. holmes/plugins/toolsets/azure_sql/tools/get_top_log_io_queries.py +180 -0
  93. holmes/plugins/toolsets/azure_sql/utils.py +83 -0
  94. holmes/plugins/toolsets/bash/__init__.py +0 -0
  95. holmes/plugins/toolsets/bash/bash_instructions.jinja2 +14 -0
  96. holmes/plugins/toolsets/bash/bash_toolset.py +208 -0
  97. holmes/plugins/toolsets/bash/common/bash.py +52 -0
  98. holmes/plugins/toolsets/bash/common/config.py +14 -0
  99. holmes/plugins/toolsets/bash/common/stringify.py +25 -0
  100. holmes/plugins/toolsets/bash/common/validators.py +24 -0
  101. holmes/plugins/toolsets/bash/grep/__init__.py +52 -0
  102. holmes/plugins/toolsets/bash/kubectl/__init__.py +100 -0
  103. holmes/plugins/toolsets/bash/kubectl/constants.py +96 -0
  104. holmes/plugins/toolsets/bash/kubectl/kubectl_describe.py +66 -0
  105. holmes/plugins/toolsets/bash/kubectl/kubectl_events.py +88 -0
  106. holmes/plugins/toolsets/bash/kubectl/kubectl_get.py +108 -0
  107. holmes/plugins/toolsets/bash/kubectl/kubectl_logs.py +20 -0
  108. holmes/plugins/toolsets/bash/kubectl/kubectl_run.py +46 -0
  109. holmes/plugins/toolsets/bash/kubectl/kubectl_top.py +81 -0
  110. holmes/plugins/toolsets/bash/parse_command.py +103 -0
  111. holmes/plugins/toolsets/confluence.yaml +19 -0
  112. holmes/plugins/toolsets/consts.py +5 -0
  113. holmes/plugins/toolsets/coralogix/api.py +158 -0
  114. holmes/plugins/toolsets/coralogix/toolset_coralogix_logs.py +103 -0
  115. holmes/plugins/toolsets/coralogix/utils.py +181 -0
  116. holmes/plugins/toolsets/datadog.py +153 -0
  117. holmes/plugins/toolsets/docker.yaml +46 -0
  118. holmes/plugins/toolsets/git.py +756 -0
  119. holmes/plugins/toolsets/grafana/__init__.py +0 -0
  120. holmes/plugins/toolsets/grafana/base_grafana_toolset.py +54 -0
  121. holmes/plugins/toolsets/grafana/common.py +68 -0
  122. holmes/plugins/toolsets/grafana/grafana_api.py +31 -0
  123. holmes/plugins/toolsets/grafana/loki_api.py +89 -0
  124. holmes/plugins/toolsets/grafana/tempo_api.py +124 -0
  125. holmes/plugins/toolsets/grafana/toolset_grafana.py +102 -0
  126. holmes/plugins/toolsets/grafana/toolset_grafana_loki.py +102 -0
  127. holmes/plugins/toolsets/grafana/toolset_grafana_tempo.jinja2 +10 -0
  128. holmes/plugins/toolsets/grafana/toolset_grafana_tempo.py +299 -0
  129. holmes/plugins/toolsets/grafana/trace_parser.py +195 -0
  130. holmes/plugins/toolsets/helm.yaml +42 -0
  131. holmes/plugins/toolsets/internet/internet.py +275 -0
  132. holmes/plugins/toolsets/internet/notion.py +137 -0
  133. holmes/plugins/toolsets/kafka.py +638 -0
  134. holmes/plugins/toolsets/kubernetes.yaml +255 -0
  135. holmes/plugins/toolsets/kubernetes_logs.py +426 -0
  136. holmes/plugins/toolsets/kubernetes_logs.yaml +42 -0
  137. holmes/plugins/toolsets/logging_utils/__init__.py +0 -0
  138. holmes/plugins/toolsets/logging_utils/logging_api.py +217 -0
  139. holmes/plugins/toolsets/logging_utils/types.py +0 -0
  140. holmes/plugins/toolsets/mcp/toolset_mcp.py +135 -0
  141. holmes/plugins/toolsets/newrelic.py +222 -0
  142. holmes/plugins/toolsets/opensearch/__init__.py +0 -0
  143. holmes/plugins/toolsets/opensearch/opensearch.py +245 -0
  144. holmes/plugins/toolsets/opensearch/opensearch_logs.py +151 -0
  145. holmes/plugins/toolsets/opensearch/opensearch_traces.py +211 -0
  146. holmes/plugins/toolsets/opensearch/opensearch_traces_instructions.jinja2 +12 -0
  147. holmes/plugins/toolsets/opensearch/opensearch_utils.py +166 -0
  148. holmes/plugins/toolsets/prometheus/prometheus.py +818 -0
  149. holmes/plugins/toolsets/prometheus/prometheus_instructions.jinja2 +38 -0
  150. holmes/plugins/toolsets/rabbitmq/api.py +398 -0
  151. holmes/plugins/toolsets/rabbitmq/rabbitmq_instructions.jinja2 +37 -0
  152. holmes/plugins/toolsets/rabbitmq/toolset_rabbitmq.py +222 -0
  153. holmes/plugins/toolsets/robusta/__init__.py +0 -0
  154. holmes/plugins/toolsets/robusta/robusta.py +235 -0
  155. holmes/plugins/toolsets/robusta/robusta_instructions.jinja2 +24 -0
  156. holmes/plugins/toolsets/runbook/__init__.py +0 -0
  157. holmes/plugins/toolsets/runbook/runbook_fetcher.py +78 -0
  158. holmes/plugins/toolsets/service_discovery.py +92 -0
  159. holmes/plugins/toolsets/servicenow/install.md +37 -0
  160. holmes/plugins/toolsets/servicenow/instructions.jinja2 +3 -0
  161. holmes/plugins/toolsets/servicenow/servicenow.py +198 -0
  162. holmes/plugins/toolsets/slab.yaml +20 -0
  163. holmes/plugins/toolsets/utils.py +137 -0
  164. holmes/plugins/utils.py +14 -0
  165. holmes/utils/__init__.py +0 -0
  166. holmes/utils/cache.py +84 -0
  167. holmes/utils/cert_utils.py +40 -0
  168. holmes/utils/default_toolset_installation_guide.jinja2 +44 -0
  169. holmes/utils/definitions.py +13 -0
  170. holmes/utils/env.py +53 -0
  171. holmes/utils/file_utils.py +56 -0
  172. holmes/utils/global_instructions.py +20 -0
  173. holmes/utils/holmes_status.py +22 -0
  174. holmes/utils/holmes_sync_toolsets.py +80 -0
  175. holmes/utils/markdown_utils.py +55 -0
  176. holmes/utils/pydantic_utils.py +54 -0
  177. holmes/utils/robusta.py +10 -0
  178. holmes/utils/tags.py +97 -0
  179. holmesgpt-0.11.5.dist-info/LICENSE.txt +21 -0
  180. holmesgpt-0.11.5.dist-info/METADATA +400 -0
  181. holmesgpt-0.11.5.dist-info/RECORD +183 -0
  182. holmesgpt-0.11.5.dist-info/WHEEL +4 -0
  183. holmesgpt-0.11.5.dist-info/entry_points.txt +3 -0
@@ -0,0 +1,7 @@
1
+ {
2
+ "hash-full": "$Format:%H$",
3
+ "hash-short": "$Format:%h$",
4
+ "timestamp": "$Format:%cI$",
5
+ "refs": "$Format:%D$",
6
+ "describe": "$Format:%(describe:tags=true,match=v[0-9]*)$"
7
+ }
holmes/__init__.py ADDED
@@ -0,0 +1,76 @@
1
+ import json
2
+ import os
3
+ import subprocess
4
+ import sys
5
+ from cachetools import cached # type: ignore
6
+
7
+ # For relative imports to work in Python 3.6 - see https://stackoverflow.com/a/49375740
8
+ this_path = os.path.dirname(os.path.realpath(__file__))
9
+ sys.path.append(this_path)
10
+
11
+ # This is patched by github actions during release
12
+ __version__ = "0.11.5"
13
+
14
+
15
+ def is_official_release() -> bool:
16
+ return not __version__.startswith("0.0.0")
17
+
18
+
19
+ @cached(cache=dict())
20
+ def get_version() -> str:
21
+ # the version string was patched by a release - return __version__ which will be correct
22
+ if is_official_release():
23
+ return __version__
24
+
25
+ # we are running from an unreleased dev version
26
+ try:
27
+ # Get the latest git tag
28
+ tag = (
29
+ subprocess.check_output(
30
+ ["git", "describe", "--tags"], stderr=subprocess.STDOUT, cwd=this_path
31
+ )
32
+ .decode()
33
+ .strip()
34
+ )
35
+
36
+ # Get the current branch name
37
+ branch = (
38
+ subprocess.check_output(
39
+ ["git", "rev-parse", "--abbrev-ref", "HEAD"],
40
+ stderr=subprocess.STDOUT,
41
+ cwd=this_path,
42
+ )
43
+ .decode()
44
+ .strip()
45
+ )
46
+
47
+ # Check if there are uncommitted changes
48
+ status = (
49
+ subprocess.check_output(
50
+ ["git", "status", "--porcelain"],
51
+ stderr=subprocess.STDOUT,
52
+ cwd=this_path,
53
+ )
54
+ .decode()
55
+ .strip()
56
+ )
57
+ dirty = "-dirty" if status else ""
58
+
59
+ return f"{tag}-{branch}{dirty}"
60
+
61
+ except Exception:
62
+ pass
63
+
64
+ # we are running without git history, but we still might have git archival data (e.g. if we were pip installed)
65
+ archival_file_path = os.path.join(this_path, ".git_archival.json")
66
+ if os.path.exists(archival_file_path):
67
+ try:
68
+ with open(archival_file_path, "r") as f:
69
+ archival_data = json.load(f)
70
+ return f"dev-{archival_data['refs']}-{archival_data['hash-short']}"
71
+ except Exception:
72
+ pass
73
+
74
+ return "dev-version"
75
+
76
+ return "unknown-version"
holmes/__init__.py.bak ADDED
@@ -0,0 +1,76 @@
1
+ import json
2
+ import os
3
+ import subprocess
4
+ import sys
5
+ from cachetools import cached # type: ignore
6
+
7
+ # For relative imports to work in Python 3.6 - see https://stackoverflow.com/a/49375740
8
+ this_path = os.path.dirname(os.path.realpath(__file__))
9
+ sys.path.append(this_path)
10
+
11
+ # This is patched by github actions during release
12
+ __version__ = "0.0.0"
13
+
14
+
15
+ def is_official_release() -> bool:
16
+ return not __version__.startswith("0.0.0")
17
+
18
+
19
+ @cached(cache=dict())
20
+ def get_version() -> str:
21
+ # the version string was patched by a release - return __version__ which will be correct
22
+ if is_official_release():
23
+ return __version__
24
+
25
+ # we are running from an unreleased dev version
26
+ try:
27
+ # Get the latest git tag
28
+ tag = (
29
+ subprocess.check_output(
30
+ ["git", "describe", "--tags"], stderr=subprocess.STDOUT, cwd=this_path
31
+ )
32
+ .decode()
33
+ .strip()
34
+ )
35
+
36
+ # Get the current branch name
37
+ branch = (
38
+ subprocess.check_output(
39
+ ["git", "rev-parse", "--abbrev-ref", "HEAD"],
40
+ stderr=subprocess.STDOUT,
41
+ cwd=this_path,
42
+ )
43
+ .decode()
44
+ .strip()
45
+ )
46
+
47
+ # Check if there are uncommitted changes
48
+ status = (
49
+ subprocess.check_output(
50
+ ["git", "status", "--porcelain"],
51
+ stderr=subprocess.STDOUT,
52
+ cwd=this_path,
53
+ )
54
+ .decode()
55
+ .strip()
56
+ )
57
+ dirty = "-dirty" if status else ""
58
+
59
+ return f"{tag}-{branch}{dirty}"
60
+
61
+ except Exception:
62
+ pass
63
+
64
+ # we are running without git history, but we still might have git archival data (e.g. if we were pip installed)
65
+ archival_file_path = os.path.join(this_path, ".git_archival.json")
66
+ if os.path.exists(archival_file_path):
67
+ try:
68
+ with open(archival_file_path, "r") as f:
69
+ archival_data = json.load(f)
70
+ return f"dev-{archival_data['refs']}-{archival_data['hash-short']}"
71
+ except Exception:
72
+ pass
73
+
74
+ return "dev-version"
75
+
76
+ return "unknown-version"
@@ -0,0 +1,24 @@
1
+ from typing import Optional
2
+ import requests # type: ignore
3
+ from functools import cache
4
+ from pydantic import BaseModel, ConfigDict
5
+ from holmes.common.env_vars import ROBUSTA_API_ENDPOINT
6
+
7
+ HOLMES_GET_INFO_URL = f"{ROBUSTA_API_ENDPOINT}/api/holmes/get_info"
8
+ TIMEOUT = 0.3
9
+
10
+
11
+ class HolmesInfo(BaseModel):
12
+ model_config = ConfigDict(extra="ignore")
13
+ latest_version: Optional[str] = None
14
+
15
+
16
+ @cache
17
+ def fetch_holmes_info() -> Optional[HolmesInfo]:
18
+ try:
19
+ response = requests.get(HOLMES_GET_INFO_URL, timeout=TIMEOUT)
20
+ response.raise_for_status()
21
+ result = response.json()
22
+ return HolmesInfo(**result)
23
+ except Exception:
24
+ return None
@@ -0,0 +1,47 @@
1
+ import os
2
+ import json
3
+
4
+
5
+ def load_bool(env_var, default: bool):
6
+ s = os.environ.get(env_var, str(default))
7
+ return json.loads(s.lower())
8
+
9
+
10
+ ENABLED_BY_DEFAULT_TOOLSETS = os.environ.get(
11
+ "ENABLED_BY_DEFAULT_TOOLSETS", "kubernetes/core,kubernetes/logs,robusta,internet"
12
+ )
13
+ HOLMES_HOST = os.environ.get("HOLMES_HOST", "0.0.0.0")
14
+ HOLMES_PORT = int(os.environ.get("HOLMES_PORT", 5050))
15
+ ROBUSTA_CONFIG_PATH = os.environ.get(
16
+ "ROBUSTA_CONFIG_PATH", "/etc/robusta/config/active_playbooks.yaml"
17
+ )
18
+
19
+ ROBUSTA_ACCOUNT_ID = os.environ.get("ROBUSTA_ACCOUNT_ID", "")
20
+ STORE_URL = os.environ.get("STORE_URL", "")
21
+ STORE_API_KEY = os.environ.get("STORE_API_KEY", "")
22
+ STORE_EMAIL = os.environ.get("STORE_EMAIL", "")
23
+ STORE_PASSWORD = os.environ.get("STORE_PASSWORD", "")
24
+ HOLMES_POST_PROCESSING_PROMPT = os.environ.get("HOLMES_POST_PROCESSING_PROMPT", "")
25
+ ROBUSTA_AI = load_bool("ROBUSTA_AI", False)
26
+ ROBUSTA_API_ENDPOINT = os.environ.get("ROBUSTA_API_ENDPOINT", "https://api.robusta.dev")
27
+
28
+ LOG_PERFORMANCE = os.environ.get("LOG_PERFORMANCE", None)
29
+
30
+
31
+ ENABLE_TELEMETRY = load_bool("ENABLE_TELEMETRY", False)
32
+ SENTRY_DSN = os.environ.get("SENTRY_DSN", "")
33
+ SENTRY_TRACES_SAMPLE_RATE = float(os.environ.get("SENTRY_TRACES_SAMPLE_RATE", "0.0"))
34
+
35
+ THINKING = os.environ.get("THINKING", "")
36
+ TEMPERATURE = float(os.environ.get("TEMPERATURE", "0.00000001"))
37
+
38
+ STREAM_CHUNKS_PER_PARSE = int(
39
+ os.environ.get("STREAM_CHUNKS_PER_PARSE", 80)
40
+ ) # Empirical value with 6~ parsing calls. Consider using larger value if LLM response is long as to reduce markdown to section calls.
41
+
42
+ USE_LEGACY_KUBERNETES_LOGS = load_bool("USE_LEGACY_KUBERNETES_LOGS", False)
43
+ KUBERNETES_LOGS_TIMEOUT_SECONDS = int(
44
+ os.environ.get("KUBERNETES_LOGS_TIMEOUT_SECONDS", 60)
45
+ )
46
+
47
+ TOOL_CALL_SAFEGUARDS_ENABLED = load_bool("TOOL_CALL_SAFEGUARDS_ENABLED", True)