holmesgpt 0.13.3a0__py3-none-any.whl → 0.14.1a0__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.
- holmes/__init__.py +1 -1
- holmes/clients/robusta_client.py +10 -2
- holmes/common/env_vars.py +8 -1
- holmes/config.py +66 -139
- holmes/core/investigation.py +1 -2
- holmes/core/llm.py +256 -51
- holmes/core/models.py +2 -0
- holmes/core/safeguards.py +4 -4
- holmes/core/supabase_dal.py +14 -8
- holmes/core/tool_calling_llm.py +193 -176
- holmes/core/tools.py +260 -25
- holmes/core/tools_utils/data_types.py +81 -0
- holmes/core/tools_utils/tool_context_window_limiter.py +33 -0
- holmes/core/tools_utils/tool_executor.py +2 -2
- holmes/core/toolset_manager.py +150 -3
- holmes/core/tracing.py +6 -1
- holmes/core/transformers/__init__.py +23 -0
- holmes/core/transformers/base.py +62 -0
- holmes/core/transformers/llm_summarize.py +174 -0
- holmes/core/transformers/registry.py +122 -0
- holmes/core/transformers/transformer.py +31 -0
- holmes/main.py +5 -0
- holmes/plugins/toolsets/aks-node-health.yaml +46 -0
- holmes/plugins/toolsets/aks.yaml +64 -0
- holmes/plugins/toolsets/atlas_mongodb/mongodb_atlas.py +17 -15
- holmes/plugins/toolsets/azure_sql/tools/analyze_connection_failures.py +8 -4
- holmes/plugins/toolsets/azure_sql/tools/analyze_database_connections.py +7 -3
- holmes/plugins/toolsets/azure_sql/tools/analyze_database_health_status.py +3 -3
- holmes/plugins/toolsets/azure_sql/tools/analyze_database_performance.py +3 -3
- holmes/plugins/toolsets/azure_sql/tools/analyze_database_storage.py +7 -3
- holmes/plugins/toolsets/azure_sql/tools/get_active_alerts.py +4 -4
- holmes/plugins/toolsets/azure_sql/tools/get_slow_queries.py +7 -3
- holmes/plugins/toolsets/azure_sql/tools/get_top_cpu_queries.py +7 -3
- holmes/plugins/toolsets/azure_sql/tools/get_top_data_io_queries.py +7 -3
- holmes/plugins/toolsets/azure_sql/tools/get_top_log_io_queries.py +7 -3
- holmes/plugins/toolsets/bash/bash_toolset.py +6 -6
- holmes/plugins/toolsets/bash/common/bash.py +7 -7
- holmes/plugins/toolsets/coralogix/toolset_coralogix_logs.py +5 -3
- holmes/plugins/toolsets/datadog/toolset_datadog_general.py +16 -17
- holmes/plugins/toolsets/datadog/toolset_datadog_logs.py +9 -10
- holmes/plugins/toolsets/datadog/toolset_datadog_metrics.py +21 -22
- holmes/plugins/toolsets/datadog/toolset_datadog_rds.py +8 -8
- holmes/plugins/toolsets/datadog/toolset_datadog_traces.py +18 -19
- holmes/plugins/toolsets/git.py +22 -22
- holmes/plugins/toolsets/grafana/common.py +14 -2
- holmes/plugins/toolsets/grafana/grafana_tempo_api.py +473 -0
- holmes/plugins/toolsets/grafana/toolset_grafana.py +4 -4
- holmes/plugins/toolsets/grafana/toolset_grafana_loki.py +3 -3
- holmes/plugins/toolsets/grafana/toolset_grafana_tempo.jinja2 +246 -11
- holmes/plugins/toolsets/grafana/toolset_grafana_tempo.py +662 -290
- holmes/plugins/toolsets/grafana/trace_parser.py +1 -1
- holmes/plugins/toolsets/internet/internet.py +3 -3
- holmes/plugins/toolsets/internet/notion.py +3 -3
- holmes/plugins/toolsets/investigator/core_investigation.py +3 -3
- holmes/plugins/toolsets/kafka.py +18 -18
- holmes/plugins/toolsets/kubernetes.yaml +58 -0
- holmes/plugins/toolsets/kubernetes_logs.py +6 -6
- holmes/plugins/toolsets/kubernetes_logs.yaml +32 -0
- holmes/plugins/toolsets/mcp/toolset_mcp.py +4 -4
- holmes/plugins/toolsets/newrelic.py +8 -8
- holmes/plugins/toolsets/opensearch/opensearch.py +5 -5
- holmes/plugins/toolsets/opensearch/opensearch_logs.py +7 -7
- holmes/plugins/toolsets/opensearch/opensearch_traces.py +10 -10
- holmes/plugins/toolsets/prometheus/prometheus.py +172 -39
- holmes/plugins/toolsets/prometheus/prometheus_instructions.jinja2 +25 -0
- holmes/plugins/toolsets/prometheus/utils.py +28 -0
- holmes/plugins/toolsets/rabbitmq/toolset_rabbitmq.py +6 -4
- holmes/plugins/toolsets/robusta/robusta.py +10 -10
- holmes/plugins/toolsets/runbook/runbook_fetcher.py +4 -4
- holmes/plugins/toolsets/servicenow/servicenow.py +6 -6
- holmes/plugins/toolsets/utils.py +88 -0
- holmes/utils/config_utils.py +91 -0
- holmes/utils/env.py +7 -0
- holmes/utils/holmes_status.py +2 -1
- holmes/utils/sentry_helper.py +41 -0
- holmes/utils/stream.py +9 -0
- {holmesgpt-0.13.3a0.dist-info → holmesgpt-0.14.1a0.dist-info}/METADATA +10 -14
- {holmesgpt-0.13.3a0.dist-info → holmesgpt-0.14.1a0.dist-info}/RECORD +81 -71
- holmes/plugins/toolsets/grafana/tempo_api.py +0 -124
- {holmesgpt-0.13.3a0.dist-info → holmesgpt-0.14.1a0.dist-info}/LICENSE.txt +0 -0
- {holmesgpt-0.13.3a0.dist-info → holmesgpt-0.14.1a0.dist-info}/WHEEL +0 -0
- {holmesgpt-0.13.3a0.dist-info → holmesgpt-0.14.1a0.dist-info}/entry_points.txt +0 -0
|
@@ -7,17 +7,49 @@ toolsets:
|
|
|
7
7
|
- command: "az account show"
|
|
8
8
|
- command: "az aks --help"
|
|
9
9
|
- command: "kubectl version --client"
|
|
10
|
+
|
|
11
|
+
# Note: Tools in this toolset use transformers with llm_summarize
|
|
12
|
+
# to automatically summarize large outputs from Azure CLI and kubectl commands
|
|
13
|
+
# when a fast model is configured, focusing on health issues and troubleshooting.
|
|
10
14
|
tools:
|
|
11
15
|
- name: "check_node_status"
|
|
12
16
|
description: "Checks the status of all nodes in the AKS cluster."
|
|
13
17
|
user_description: "get the status of all nodes in the AKS cluster"
|
|
14
18
|
command: |
|
|
15
19
|
kubectl get nodes
|
|
20
|
+
transformers:
|
|
21
|
+
- name: llm_summarize
|
|
22
|
+
config:
|
|
23
|
+
input_threshold: 800
|
|
24
|
+
prompt: |
|
|
25
|
+
Summarize this node status output focusing on:
|
|
26
|
+
- Any nodes that are NotReady or in error states
|
|
27
|
+
- Node health patterns and issues requiring attention
|
|
28
|
+
- Group healthy nodes together with aggregate counts
|
|
29
|
+
- Highlight nodes with concerning conditions or ages
|
|
30
|
+
- When possible, mention exact node names for follow-up investigation
|
|
31
|
+
- Be concise: aim for ≤ 50% of the original length; avoid repeating defaults/healthy/unchanged details
|
|
32
|
+
- Prefer aggregates and counts; list only outliers and actionable items
|
|
33
|
+
- Keep grep-friendly: include exact field names/values that matter
|
|
16
34
|
- name: "describe_node"
|
|
17
35
|
description: "Describes a specific node in the AKS cluster to inspect its conditions."
|
|
18
36
|
user_description: "describe node {{ NODE_NAME }} in the AKS cluster"
|
|
19
37
|
command: |
|
|
20
38
|
kubectl describe node {{ NODE_NAME }}
|
|
39
|
+
transformers:
|
|
40
|
+
- name: llm_summarize
|
|
41
|
+
config:
|
|
42
|
+
input_threshold: 1200
|
|
43
|
+
prompt: |
|
|
44
|
+
Summarize this node description focusing on:
|
|
45
|
+
- Node conditions and health status (Ready, MemoryPressure, DiskPressure, etc.)
|
|
46
|
+
- Resource capacity vs allocatable vs current usage
|
|
47
|
+
- Any taints, labels, or annotations indicating issues
|
|
48
|
+
- Recent events that show problems or state changes
|
|
49
|
+
- System information relevant to troubleshooting
|
|
50
|
+
- When possible, highlight specific condition reasons for investigation
|
|
51
|
+
- Strive for ≤ 50% of the original size; keep results compact and grep-friendly (one line per aggregate)
|
|
52
|
+
- Prioritize aggregates and actionable outliers over comprehensive details
|
|
21
53
|
- name: "get_node_events"
|
|
22
54
|
description: "Fetches recent events for a specific node to surface warnings and errors."
|
|
23
55
|
user_description: "get events for node {{ NODE_NAME }}"
|
|
@@ -33,6 +65,20 @@ toolsets:
|
|
|
33
65
|
user_description: "review Azure Activity Log for resource group {{ RESOURCE_GROUP_NAME }}"
|
|
34
66
|
command: |
|
|
35
67
|
az monitor activity-log list --resource-group {{ RESOURCE_GROUP_NAME }}
|
|
68
|
+
transformers:
|
|
69
|
+
- name: llm_summarize
|
|
70
|
+
config:
|
|
71
|
+
input_threshold: 1500
|
|
72
|
+
prompt: |
|
|
73
|
+
Summarize this Azure Activity Log focusing on:
|
|
74
|
+
- Recent administrative actions or configuration changes
|
|
75
|
+
- Any failed operations or errors that could impact node health
|
|
76
|
+
- Resource scaling, updates, or maintenance activities
|
|
77
|
+
- Network security group, load balancer, or VM-related changes
|
|
78
|
+
- Group similar activities and highlight time patterns
|
|
79
|
+
- When possible, mention specific operation names and correlation IDs
|
|
80
|
+
- Be concise and avoid expansion: target ≤ 50% of input size; prefer counts + outliers over full listings
|
|
81
|
+
- Include grep-ready keys/values; avoid repeating entire objects or unchanged defaults
|
|
36
82
|
- name: "check_top_resource_consuming_pods"
|
|
37
83
|
description: "Checks for the top resource-consuming pods on a specific node."
|
|
38
84
|
user_description: "get the top resource-consuming pods on node {{ NODE_NAME }}"
|
holmes/plugins/toolsets/aks.yaml
CHANGED
|
@@ -7,6 +7,10 @@ toolsets:
|
|
|
7
7
|
- command: "az account show"
|
|
8
8
|
- command: "az aks --help"
|
|
9
9
|
- command: "kubectl version --client"
|
|
10
|
+
|
|
11
|
+
# Note: Tools in this toolset use transformers with llm_summarize
|
|
12
|
+
# to automatically summarize large JSON outputs from Azure CLI commands
|
|
13
|
+
# when a fast model is configured, focusing on key configuration and status information.
|
|
10
14
|
tools:
|
|
11
15
|
- name: "cloud_provider"
|
|
12
16
|
description: "Fetches the cloud provider of the kubernetes cluster, determined by the providerID of the nodes"
|
|
@@ -18,16 +22,61 @@ toolsets:
|
|
|
18
22
|
user_description: "get AKS cluster {{ CLUSTER_NAME }} under resource group {{ RESOURCE_GROUP_NAME }} in subscription {{ SUBSCRIPTION_ID }}"
|
|
19
23
|
command: |
|
|
20
24
|
az aks show --resource-group {{ RESOURCE_GROUP_NAME }} --name {{ CLUSTER_NAME }} --subscription {{ SUBSCRIPTION_ID }}
|
|
25
|
+
transformers:
|
|
26
|
+
- name: llm_summarize
|
|
27
|
+
config:
|
|
28
|
+
input_threshold: 1500
|
|
29
|
+
prompt: |
|
|
30
|
+
Summarize this AKS cluster configuration focusing on:
|
|
31
|
+
- Cluster status, health state, and version information
|
|
32
|
+
- Node pool configuration and scaling settings
|
|
33
|
+
- Network configuration (subnet, load balancer, network policy)
|
|
34
|
+
- Add-ons and features enabled (monitoring, auto-scaling, etc.)
|
|
35
|
+
- Security settings (RBAC, managed identity, private cluster)
|
|
36
|
+
- Any warnings or deprecated configurations
|
|
37
|
+
- When possible, highlight settings that might impact performance or security
|
|
38
|
+
- Be concise: aim for ≤ 50% of the original length; avoid repeating defaults/healthy/unchanged details
|
|
39
|
+
- Prefer aggregates and counts; list only outliers and actionable items
|
|
40
|
+
- Keep grep-friendly: include exact field names/values that matter
|
|
21
41
|
- name: "aks_list_clusters_by_rg"
|
|
22
42
|
description: "Lists all AKS clusters under a specific resource group. Only run this tool when you need to get all clusters in a resource group, rather than a specific one."
|
|
23
43
|
user_description: "list AKS clusters in resource group {{ RESOURCE_GROUP_NAME }} under subscription {{ SUBSCRIPTION_ID }}"
|
|
24
44
|
command: |
|
|
25
45
|
az aks list --resource-group {{ RESOURCE_GROUP_NAME }} --subscription {{ SUBSCRIPTION_ID }}
|
|
46
|
+
transformers:
|
|
47
|
+
- name: llm_summarize
|
|
48
|
+
config:
|
|
49
|
+
input_threshold: 1000
|
|
50
|
+
prompt: |
|
|
51
|
+
Summarize this AKS clusters list focusing on:
|
|
52
|
+
- Cluster names, locations, and current status
|
|
53
|
+
- Kubernetes versions and any version skew issues
|
|
54
|
+
- Node pool counts and VM SKUs
|
|
55
|
+
- Key configuration differences between clusters
|
|
56
|
+
- Any clusters in error or unusual states
|
|
57
|
+
- When possible, group clusters by similar configurations
|
|
58
|
+
- Be concise and avoid expansion: target ≤ 50% of input size; prefer counts + outliers over full listings
|
|
59
|
+
- Include grep-ready keys/values; avoid repeating entire objects or unchanged defaults
|
|
26
60
|
- name: "aks_list_node_pools"
|
|
27
61
|
description: "Lists node pools in an AKS cluster"
|
|
28
62
|
user_description: "list node pools for AKS cluster {{ CLUSTER_NAME }} under resource group {{ RESOURCE_GROUP_NAME }}"
|
|
29
63
|
command: |
|
|
30
64
|
az aks nodepool list --resource-group {{ RESOURCE_GROUP_NAME }} --cluster-name {{ CLUSTER_NAME }} --subscription {{ SUBSCRIPTION_ID }}
|
|
65
|
+
transformers:
|
|
66
|
+
- name: llm_summarize
|
|
67
|
+
config:
|
|
68
|
+
input_threshold: 1200
|
|
69
|
+
prompt: |
|
|
70
|
+
Summarize this AKS node pools list focusing on:
|
|
71
|
+
- Node pool names, VM sizes, and current node counts
|
|
72
|
+
- Scaling configuration (min/max nodes, auto-scaling enabled)
|
|
73
|
+
- Node pool status and provisioning state
|
|
74
|
+
- OS types, Kubernetes versions, and any upgrade patterns
|
|
75
|
+
- Taints, labels, and specialized configurations
|
|
76
|
+
- Any node pools in error states or with scaling issues
|
|
77
|
+
- When possible, identify resource allocation patterns
|
|
78
|
+
- Strive for ≤ 50% of the original size; keep results compact and grep-friendly (one line per aggregate)
|
|
79
|
+
- Prioritize aggregates and actionable outliers over comprehensive details
|
|
31
80
|
- name: "aks_show_node_pool"
|
|
32
81
|
description: "Shows details of a specific node pool in an AKS cluster"
|
|
33
82
|
user_description: "get node pool {{ NODE_POOL_NAME }} in AKS cluster {{ CLUSTER_NAME }} under resource group {{ RESOURCE_GROUP_NAME }}"
|
|
@@ -84,3 +133,18 @@ toolsets:
|
|
|
84
133
|
user_description: "list NSG rules for NSG {{ NSG_NAME }} in resource group {{ RESOURCE_GROUP_NAME }} under subscription {{ SUBSCRIPTION_ID }}"
|
|
85
134
|
command: |
|
|
86
135
|
az network nsg rule list --resource-group {{ RESOURCE_GROUP_NAME }} --nsg-name {{ NSG_NAME }} --subscription {{ SUBSCRIPTION_ID }} --include-default -o table
|
|
136
|
+
transformers:
|
|
137
|
+
- name: llm_summarize
|
|
138
|
+
config:
|
|
139
|
+
input_threshold: 1000
|
|
140
|
+
prompt: |
|
|
141
|
+
Summarize these NSG rules focusing on:
|
|
142
|
+
- Allow vs deny rules and their priority order
|
|
143
|
+
- Inbound vs outbound traffic rules
|
|
144
|
+
- Port ranges and protocols affected
|
|
145
|
+
- Source and destination configurations
|
|
146
|
+
- Any overly permissive or potentially insecure rules
|
|
147
|
+
- Default rules vs custom rules
|
|
148
|
+
- When possible, highlight rules that might impact AKS connectivity
|
|
149
|
+
- Be concise: aim for ≤ 50% of the original text; prioritize aggregates and actionable outliers
|
|
150
|
+
- Include grep-ready keys/values; avoid repeating entire rules or unchanged defaults
|
|
@@ -10,7 +10,7 @@ from holmes.core.tools import (
|
|
|
10
10
|
)
|
|
11
11
|
|
|
12
12
|
from pydantic import BaseModel, PrivateAttr
|
|
13
|
-
from holmes.core.tools import StructuredToolResult,
|
|
13
|
+
from holmes.core.tools import StructuredToolResult, StructuredToolResultStatus
|
|
14
14
|
from requests.auth import HTTPDigestAuth # type: ignore
|
|
15
15
|
import gzip
|
|
16
16
|
import io
|
|
@@ -90,15 +90,15 @@ class MongoDBAtlasBaseTool(Tool):
|
|
|
90
90
|
if response.ok:
|
|
91
91
|
res = response.json()
|
|
92
92
|
return StructuredToolResult(
|
|
93
|
-
status=
|
|
93
|
+
status=StructuredToolResultStatus.SUCCESS
|
|
94
94
|
if res.get(field, [])
|
|
95
|
-
else
|
|
95
|
+
else StructuredToolResultStatus.NO_DATA,
|
|
96
96
|
data=res,
|
|
97
97
|
params=params,
|
|
98
98
|
)
|
|
99
99
|
else:
|
|
100
100
|
return StructuredToolResult(
|
|
101
|
-
status=
|
|
101
|
+
status=StructuredToolResultStatus.ERROR,
|
|
102
102
|
error=f"Failed {self.name}.\n{response.text}",
|
|
103
103
|
return_code=response.status_code,
|
|
104
104
|
params=params,
|
|
@@ -130,7 +130,7 @@ class ReturnProjectAlerts(MongoDBAtlasBaseTool):
|
|
|
130
130
|
except Exception as e:
|
|
131
131
|
logging.exception(self.get_parameterized_one_liner(params))
|
|
132
132
|
return StructuredToolResult(
|
|
133
|
-
status=
|
|
133
|
+
status=StructuredToolResultStatus.ERROR,
|
|
134
134
|
data=f"Exception {self.name}: {str(e)}",
|
|
135
135
|
params=params,
|
|
136
136
|
)
|
|
@@ -157,7 +157,7 @@ class ReturnProjectProcesses(MongoDBAtlasBaseTool):
|
|
|
157
157
|
except Exception as e:
|
|
158
158
|
logging.exception(self.get_parameterized_one_liner(params))
|
|
159
159
|
return StructuredToolResult(
|
|
160
|
-
status=
|
|
160
|
+
status=StructuredToolResultStatus.ERROR,
|
|
161
161
|
error=f"Exception {self.name}: {str(e)}",
|
|
162
162
|
params=params,
|
|
163
163
|
)
|
|
@@ -193,7 +193,7 @@ class ReturnProjectSlowQueries(MongoDBAtlasBaseTool):
|
|
|
193
193
|
except Exception as e:
|
|
194
194
|
logging.exception(self.get_parameterized_one_liner(params))
|
|
195
195
|
return StructuredToolResult(
|
|
196
|
-
status=
|
|
196
|
+
status=StructuredToolResultStatus.ERROR,
|
|
197
197
|
error=f"Exception {self.name}: {str(e)}",
|
|
198
198
|
params=params,
|
|
199
199
|
)
|
|
@@ -230,14 +230,14 @@ class ReturnEventsFromProject(MongoDBAtlasBaseTool):
|
|
|
230
230
|
)
|
|
231
231
|
data = f"last 4 hours eventTypeName and # of occurrences list: {events_counter} \n to get more information about a given eventTypeName call atlas_return_events_type_from_project"
|
|
232
232
|
status = (
|
|
233
|
-
|
|
233
|
+
StructuredToolResultStatus.SUCCESS
|
|
234
234
|
if events_counter
|
|
235
|
-
else
|
|
235
|
+
else StructuredToolResultStatus.NO_DATA
|
|
236
236
|
)
|
|
237
237
|
return StructuredToolResult(status=status, data=data, params=params)
|
|
238
238
|
else:
|
|
239
239
|
return StructuredToolResult(
|
|
240
|
-
status=
|
|
240
|
+
status=StructuredToolResultStatus.ERROR,
|
|
241
241
|
error=f"Failed {self.name}. \n{response.text}",
|
|
242
242
|
return_code=response.status_code,
|
|
243
243
|
params=params,
|
|
@@ -245,7 +245,7 @@ class ReturnEventsFromProject(MongoDBAtlasBaseTool):
|
|
|
245
245
|
except Exception as e:
|
|
246
246
|
logging.exception(self.get_parameterized_one_liner(params))
|
|
247
247
|
return StructuredToolResult(
|
|
248
|
-
status=
|
|
248
|
+
status=StructuredToolResultStatus.ERROR,
|
|
249
249
|
error=f"Exception {self.name}: {str(e)}",
|
|
250
250
|
params=params,
|
|
251
251
|
)
|
|
@@ -287,11 +287,13 @@ class ReturnLogsForProcessInProject(MongoDBAtlasBaseTool):
|
|
|
287
287
|
with gzip.GzipFile(fileobj=io.BytesIO(response.content)) as gz:
|
|
288
288
|
text_data = gz.read().decode("utf-8")
|
|
289
289
|
return StructuredToolResult(
|
|
290
|
-
status=
|
|
290
|
+
status=StructuredToolResultStatus.SUCCESS,
|
|
291
|
+
data=text_data,
|
|
292
|
+
params=params,
|
|
291
293
|
)
|
|
292
294
|
else:
|
|
293
295
|
return StructuredToolResult(
|
|
294
|
-
status=
|
|
296
|
+
status=StructuredToolResultStatus.ERROR,
|
|
295
297
|
error=f"Failed {self.name}. \n{response.text}",
|
|
296
298
|
return_code=response.status_code,
|
|
297
299
|
params=params,
|
|
@@ -299,7 +301,7 @@ class ReturnLogsForProcessInProject(MongoDBAtlasBaseTool):
|
|
|
299
301
|
except Exception as e:
|
|
300
302
|
logging.exception(self.get_parameterized_one_liner(params))
|
|
301
303
|
return StructuredToolResult(
|
|
302
|
-
status=
|
|
304
|
+
status=StructuredToolResultStatus.ERROR,
|
|
303
305
|
error=f"Exception {self.name}: {str(e)}",
|
|
304
306
|
params=params,
|
|
305
307
|
)
|
|
@@ -340,7 +342,7 @@ class ReturnEventTypeFromProject(MongoDBAtlasBaseTool):
|
|
|
340
342
|
except Exception as e:
|
|
341
343
|
logging.exception(self.get_parameterized_one_liner(params))
|
|
342
344
|
return StructuredToolResult(
|
|
343
|
-
status=
|
|
345
|
+
status=StructuredToolResultStatus.ERROR,
|
|
344
346
|
error=f"Exception {self.name}: {str(e)}",
|
|
345
347
|
params=params,
|
|
346
348
|
)
|
|
@@ -2,7 +2,11 @@ import logging
|
|
|
2
2
|
from typing import Dict, Tuple
|
|
3
3
|
from datetime import datetime, timezone
|
|
4
4
|
|
|
5
|
-
from holmes.core.tools import
|
|
5
|
+
from holmes.core.tools import (
|
|
6
|
+
StructuredToolResult,
|
|
7
|
+
ToolParameter,
|
|
8
|
+
StructuredToolResultStatus,
|
|
9
|
+
)
|
|
6
10
|
from holmes.plugins.toolsets.azure_sql.azure_base_toolset import (
|
|
7
11
|
BaseAzureSQLTool,
|
|
8
12
|
BaseAzureSQLToolset,
|
|
@@ -242,7 +246,7 @@ class AnalyzeConnectionFailures(BaseAzureSQLTool):
|
|
|
242
246
|
# Check for errors
|
|
243
247
|
if "error" in analysis_data:
|
|
244
248
|
return StructuredToolResult(
|
|
245
|
-
status=
|
|
249
|
+
status=StructuredToolResultStatus.ERROR,
|
|
246
250
|
error=analysis_data["error"],
|
|
247
251
|
params=params,
|
|
248
252
|
)
|
|
@@ -253,7 +257,7 @@ class AnalyzeConnectionFailures(BaseAzureSQLTool):
|
|
|
253
257
|
)
|
|
254
258
|
|
|
255
259
|
return StructuredToolResult(
|
|
256
|
-
status=
|
|
260
|
+
status=StructuredToolResultStatus.SUCCESS,
|
|
257
261
|
data=report_text,
|
|
258
262
|
params=params,
|
|
259
263
|
)
|
|
@@ -263,7 +267,7 @@ class AnalyzeConnectionFailures(BaseAzureSQLTool):
|
|
|
263
267
|
f"Error in analyze_connection_failures: {str(e)}", exc_info=True
|
|
264
268
|
)
|
|
265
269
|
return StructuredToolResult(
|
|
266
|
-
status=
|
|
270
|
+
status=StructuredToolResultStatus.ERROR,
|
|
267
271
|
error=f"Failed to analyze connection failures: {str(e)}",
|
|
268
272
|
params=params,
|
|
269
273
|
)
|
|
@@ -2,7 +2,11 @@ import logging
|
|
|
2
2
|
from typing import Any, Dict, Tuple
|
|
3
3
|
from datetime import datetime, timezone
|
|
4
4
|
|
|
5
|
-
from holmes.core.tools import
|
|
5
|
+
from holmes.core.tools import (
|
|
6
|
+
StructuredToolResult,
|
|
7
|
+
ToolParameter,
|
|
8
|
+
StructuredToolResultStatus,
|
|
9
|
+
)
|
|
6
10
|
from holmes.plugins.toolsets.azure_sql.azure_base_toolset import (
|
|
7
11
|
BaseAzureSQLTool,
|
|
8
12
|
BaseAzureSQLToolset,
|
|
@@ -200,7 +204,7 @@ class AnalyzeDatabaseConnections(BaseAzureSQLTool):
|
|
|
200
204
|
)
|
|
201
205
|
|
|
202
206
|
return StructuredToolResult(
|
|
203
|
-
status=
|
|
207
|
+
status=StructuredToolResultStatus.SUCCESS,
|
|
204
208
|
data=report_text,
|
|
205
209
|
params=params,
|
|
206
210
|
)
|
|
@@ -208,7 +212,7 @@ class AnalyzeDatabaseConnections(BaseAzureSQLTool):
|
|
|
208
212
|
error_msg = f"Failed to generate connection report: {str(e)}"
|
|
209
213
|
logging.error(error_msg)
|
|
210
214
|
return StructuredToolResult(
|
|
211
|
-
status=
|
|
215
|
+
status=StructuredToolResultStatus.ERROR,
|
|
212
216
|
error=error_msg,
|
|
213
217
|
params=params,
|
|
214
218
|
)
|
|
@@ -2,7 +2,7 @@ import logging
|
|
|
2
2
|
from typing import Dict
|
|
3
3
|
from datetime import datetime, timezone
|
|
4
4
|
|
|
5
|
-
from holmes.core.tools import StructuredToolResult,
|
|
5
|
+
from holmes.core.tools import StructuredToolResult, StructuredToolResultStatus
|
|
6
6
|
from holmes.plugins.toolsets.azure_sql.azure_base_toolset import (
|
|
7
7
|
BaseAzureSQLTool,
|
|
8
8
|
BaseAzureSQLToolset,
|
|
@@ -145,7 +145,7 @@ class AnalyzeDatabaseHealthStatus(BaseAzureSQLTool):
|
|
|
145
145
|
report_text = self._build_health_report(health_data, db_config)
|
|
146
146
|
|
|
147
147
|
return StructuredToolResult(
|
|
148
|
-
status=
|
|
148
|
+
status=StructuredToolResultStatus.SUCCESS,
|
|
149
149
|
data=report_text,
|
|
150
150
|
params=params,
|
|
151
151
|
)
|
|
@@ -153,7 +153,7 @@ class AnalyzeDatabaseHealthStatus(BaseAzureSQLTool):
|
|
|
153
153
|
error_msg = f"Failed to generate health report: {str(e)}"
|
|
154
154
|
logging.error(error_msg)
|
|
155
155
|
return StructuredToolResult(
|
|
156
|
-
status=
|
|
156
|
+
status=StructuredToolResultStatus.ERROR,
|
|
157
157
|
error=error_msg,
|
|
158
158
|
params=params,
|
|
159
159
|
)
|
|
@@ -2,7 +2,7 @@ import logging
|
|
|
2
2
|
from typing import Any, Dict, List, Tuple, cast
|
|
3
3
|
from datetime import datetime, timezone
|
|
4
4
|
|
|
5
|
-
from holmes.core.tools import StructuredToolResult,
|
|
5
|
+
from holmes.core.tools import StructuredToolResult, StructuredToolResultStatus
|
|
6
6
|
from holmes.plugins.toolsets.azure_sql.azure_base_toolset import (
|
|
7
7
|
BaseAzureSQLTool,
|
|
8
8
|
BaseAzureSQLToolset,
|
|
@@ -206,7 +206,7 @@ class AnalyzeDatabasePerformance(BaseAzureSQLTool):
|
|
|
206
206
|
report_text = self._build_performance_report(performance_data, db_config)
|
|
207
207
|
|
|
208
208
|
return StructuredToolResult(
|
|
209
|
-
status=
|
|
209
|
+
status=StructuredToolResultStatus.SUCCESS,
|
|
210
210
|
data=report_text,
|
|
211
211
|
params=params,
|
|
212
212
|
)
|
|
@@ -214,7 +214,7 @@ class AnalyzeDatabasePerformance(BaseAzureSQLTool):
|
|
|
214
214
|
error_msg = f"Failed to generate performance report: {str(e)}"
|
|
215
215
|
logging.error(error_msg)
|
|
216
216
|
return StructuredToolResult(
|
|
217
|
-
status=
|
|
217
|
+
status=StructuredToolResultStatus.ERROR,
|
|
218
218
|
error=error_msg,
|
|
219
219
|
params=params,
|
|
220
220
|
)
|
|
@@ -2,7 +2,11 @@ import logging
|
|
|
2
2
|
from typing import Any, Dict, Tuple
|
|
3
3
|
from datetime import datetime, timezone
|
|
4
4
|
|
|
5
|
-
from holmes.core.tools import
|
|
5
|
+
from holmes.core.tools import (
|
|
6
|
+
StructuredToolResult,
|
|
7
|
+
ToolParameter,
|
|
8
|
+
StructuredToolResultStatus,
|
|
9
|
+
)
|
|
6
10
|
from holmes.plugins.toolsets.azure_sql.azure_base_toolset import (
|
|
7
11
|
BaseAzureSQLTool,
|
|
8
12
|
BaseAzureSQLToolset,
|
|
@@ -307,7 +311,7 @@ class AnalyzeDatabaseStorage(BaseAzureSQLTool):
|
|
|
307
311
|
)
|
|
308
312
|
|
|
309
313
|
return StructuredToolResult(
|
|
310
|
-
status=
|
|
314
|
+
status=StructuredToolResultStatus.SUCCESS,
|
|
311
315
|
data=report_text,
|
|
312
316
|
params=params,
|
|
313
317
|
)
|
|
@@ -315,7 +319,7 @@ class AnalyzeDatabaseStorage(BaseAzureSQLTool):
|
|
|
315
319
|
error_msg = f"Failed to generate storage report: {str(e)}"
|
|
316
320
|
logging.error(error_msg)
|
|
317
321
|
return StructuredToolResult(
|
|
318
|
-
status=
|
|
322
|
+
status=StructuredToolResultStatus.ERROR,
|
|
319
323
|
error=error_msg,
|
|
320
324
|
params=params,
|
|
321
325
|
)
|
|
@@ -2,7 +2,7 @@ import logging
|
|
|
2
2
|
from typing import Dict
|
|
3
3
|
from datetime import datetime, timezone
|
|
4
4
|
|
|
5
|
-
from holmes.core.tools import StructuredToolResult,
|
|
5
|
+
from holmes.core.tools import StructuredToolResult, StructuredToolResultStatus
|
|
6
6
|
from holmes.plugins.toolsets.azure_sql.azure_base_toolset import (
|
|
7
7
|
BaseAzureSQLTool,
|
|
8
8
|
BaseAzureSQLToolset,
|
|
@@ -170,7 +170,7 @@ class GetActiveAlerts(BaseAzureSQLTool):
|
|
|
170
170
|
# Check for errors
|
|
171
171
|
if "error" in alerts_data:
|
|
172
172
|
return StructuredToolResult(
|
|
173
|
-
status=
|
|
173
|
+
status=StructuredToolResultStatus.ERROR,
|
|
174
174
|
error=alerts_data["error"],
|
|
175
175
|
params=params,
|
|
176
176
|
)
|
|
@@ -179,7 +179,7 @@ class GetActiveAlerts(BaseAzureSQLTool):
|
|
|
179
179
|
report_text = self._build_alerts_report(db_config, alerts_data, "active")
|
|
180
180
|
|
|
181
181
|
return StructuredToolResult(
|
|
182
|
-
status=
|
|
182
|
+
status=StructuredToolResultStatus.SUCCESS,
|
|
183
183
|
data=report_text,
|
|
184
184
|
params=params,
|
|
185
185
|
)
|
|
@@ -187,7 +187,7 @@ class GetActiveAlerts(BaseAzureSQLTool):
|
|
|
187
187
|
error_msg = f"Failed to retrieve active alerts: {str(e)}"
|
|
188
188
|
logging.error(error_msg)
|
|
189
189
|
return StructuredToolResult(
|
|
190
|
-
status=
|
|
190
|
+
status=StructuredToolResultStatus.ERROR,
|
|
191
191
|
error=error_msg,
|
|
192
192
|
params=params,
|
|
193
193
|
)
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
from typing import Dict, List, Tuple
|
|
3
3
|
|
|
4
|
-
from holmes.core.tools import
|
|
4
|
+
from holmes.core.tools import (
|
|
5
|
+
StructuredToolResult,
|
|
6
|
+
ToolParameter,
|
|
7
|
+
StructuredToolResultStatus,
|
|
8
|
+
)
|
|
5
9
|
from holmes.plugins.toolsets.azure_sql.azure_base_toolset import (
|
|
6
10
|
BaseAzureSQLTool,
|
|
7
11
|
BaseAzureSQLToolset,
|
|
@@ -125,7 +129,7 @@ class GetSlowQueries(BaseAzureSQLTool):
|
|
|
125
129
|
)
|
|
126
130
|
|
|
127
131
|
return StructuredToolResult(
|
|
128
|
-
status=
|
|
132
|
+
status=StructuredToolResultStatus.SUCCESS,
|
|
129
133
|
data=report_text,
|
|
130
134
|
params=params,
|
|
131
135
|
)
|
|
@@ -133,7 +137,7 @@ class GetSlowQueries(BaseAzureSQLTool):
|
|
|
133
137
|
error_msg = f"Failed to get slow queries: {str(e)}"
|
|
134
138
|
logging.error(error_msg)
|
|
135
139
|
return StructuredToolResult(
|
|
136
|
-
status=
|
|
140
|
+
status=StructuredToolResultStatus.ERROR,
|
|
137
141
|
error=error_msg,
|
|
138
142
|
params=params,
|
|
139
143
|
)
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
from typing import Dict, List, Tuple
|
|
3
3
|
|
|
4
|
-
from holmes.core.tools import
|
|
4
|
+
from holmes.core.tools import (
|
|
5
|
+
StructuredToolResult,
|
|
6
|
+
ToolParameter,
|
|
7
|
+
StructuredToolResultStatus,
|
|
8
|
+
)
|
|
5
9
|
from holmes.plugins.toolsets.azure_sql.azure_base_toolset import (
|
|
6
10
|
BaseAzureSQLTool,
|
|
7
11
|
BaseAzureSQLToolset,
|
|
@@ -123,7 +127,7 @@ class GetTopCPUQueries(BaseAzureSQLTool):
|
|
|
123
127
|
)
|
|
124
128
|
|
|
125
129
|
return StructuredToolResult(
|
|
126
|
-
status=
|
|
130
|
+
status=StructuredToolResultStatus.SUCCESS,
|
|
127
131
|
data=report_text,
|
|
128
132
|
params=params,
|
|
129
133
|
)
|
|
@@ -131,7 +135,7 @@ class GetTopCPUQueries(BaseAzureSQLTool):
|
|
|
131
135
|
error_msg = f"Failed to get top CPU queries: {str(e)}"
|
|
132
136
|
logging.error(error_msg)
|
|
133
137
|
return StructuredToolResult(
|
|
134
|
-
status=
|
|
138
|
+
status=StructuredToolResultStatus.ERROR,
|
|
135
139
|
error=error_msg,
|
|
136
140
|
params=params,
|
|
137
141
|
)
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
from typing import Dict, List, Tuple
|
|
3
3
|
|
|
4
|
-
from holmes.core.tools import
|
|
4
|
+
from holmes.core.tools import (
|
|
5
|
+
StructuredToolResult,
|
|
6
|
+
ToolParameter,
|
|
7
|
+
StructuredToolResultStatus,
|
|
8
|
+
)
|
|
5
9
|
from holmes.plugins.toolsets.azure_sql.azure_base_toolset import (
|
|
6
10
|
BaseAzureSQLTool,
|
|
7
11
|
BaseAzureSQLToolset,
|
|
@@ -141,7 +145,7 @@ class GetTopDataIOQueries(BaseAzureSQLTool):
|
|
|
141
145
|
)
|
|
142
146
|
|
|
143
147
|
return StructuredToolResult(
|
|
144
|
-
status=
|
|
148
|
+
status=StructuredToolResultStatus.SUCCESS,
|
|
145
149
|
data=report_text,
|
|
146
150
|
params=params,
|
|
147
151
|
)
|
|
@@ -149,7 +153,7 @@ class GetTopDataIOQueries(BaseAzureSQLTool):
|
|
|
149
153
|
error_msg = f"Failed to get top data I/O queries: {str(e)}"
|
|
150
154
|
logging.error(error_msg)
|
|
151
155
|
return StructuredToolResult(
|
|
152
|
-
status=
|
|
156
|
+
status=StructuredToolResultStatus.ERROR,
|
|
153
157
|
error=error_msg,
|
|
154
158
|
params=params,
|
|
155
159
|
)
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
from typing import Dict, List, Tuple
|
|
3
3
|
|
|
4
|
-
from holmes.core.tools import
|
|
4
|
+
from holmes.core.tools import (
|
|
5
|
+
StructuredToolResult,
|
|
6
|
+
ToolParameter,
|
|
7
|
+
StructuredToolResultStatus,
|
|
8
|
+
)
|
|
5
9
|
from holmes.plugins.toolsets.azure_sql.azure_base_toolset import (
|
|
6
10
|
BaseAzureSQLTool,
|
|
7
11
|
BaseAzureSQLToolset,
|
|
@@ -133,7 +137,7 @@ class GetTopLogIOQueries(BaseAzureSQLTool):
|
|
|
133
137
|
)
|
|
134
138
|
|
|
135
139
|
return StructuredToolResult(
|
|
136
|
-
status=
|
|
140
|
+
status=StructuredToolResultStatus.SUCCESS,
|
|
137
141
|
data=report_text,
|
|
138
142
|
params=params,
|
|
139
143
|
)
|
|
@@ -141,7 +145,7 @@ class GetTopLogIOQueries(BaseAzureSQLTool):
|
|
|
141
145
|
error_msg = f"Failed to get top log I/O queries: {str(e)}"
|
|
142
146
|
logging.error(error_msg)
|
|
143
147
|
return StructuredToolResult(
|
|
144
|
-
status=
|
|
148
|
+
status=StructuredToolResultStatus.ERROR,
|
|
145
149
|
error=error_msg,
|
|
146
150
|
params=params,
|
|
147
151
|
)
|
|
@@ -17,7 +17,7 @@ from holmes.core.tools import (
|
|
|
17
17
|
StructuredToolResult,
|
|
18
18
|
Tool,
|
|
19
19
|
ToolParameter,
|
|
20
|
-
|
|
20
|
+
StructuredToolResultStatus,
|
|
21
21
|
Toolset,
|
|
22
22
|
ToolsetTag,
|
|
23
23
|
)
|
|
@@ -94,7 +94,7 @@ class KubectlRunImageCommand(BaseBashTool):
|
|
|
94
94
|
|
|
95
95
|
if namespace and not re.match(SAFE_NAMESPACE_PATTERN, namespace):
|
|
96
96
|
return StructuredToolResult(
|
|
97
|
-
status=
|
|
97
|
+
status=StructuredToolResultStatus.ERROR,
|
|
98
98
|
error=f"Error: The namespace is invalid. Valid namespaces must match the following regexp: {SAFE_NAMESPACE_PATTERN}",
|
|
99
99
|
params=params,
|
|
100
100
|
)
|
|
@@ -118,7 +118,7 @@ class KubectlRunImageCommand(BaseBashTool):
|
|
|
118
118
|
}
|
|
119
119
|
)
|
|
120
120
|
return StructuredToolResult(
|
|
121
|
-
status=
|
|
121
|
+
status=StructuredToolResultStatus.ERROR,
|
|
122
122
|
error=str(e),
|
|
123
123
|
params=params,
|
|
124
124
|
)
|
|
@@ -172,14 +172,14 @@ class RunBashCommand(BaseBashTool):
|
|
|
172
172
|
|
|
173
173
|
if not command_str:
|
|
174
174
|
return StructuredToolResult(
|
|
175
|
-
status=
|
|
175
|
+
status=StructuredToolResultStatus.ERROR,
|
|
176
176
|
error="The 'command' parameter is required and was not provided.",
|
|
177
177
|
params=params,
|
|
178
178
|
)
|
|
179
179
|
|
|
180
180
|
if not isinstance(command_str, str):
|
|
181
181
|
return StructuredToolResult(
|
|
182
|
-
status=
|
|
182
|
+
status=StructuredToolResultStatus.ERROR,
|
|
183
183
|
error=f"The 'command' parameter must be a string, got {type(command_str).__name__}.",
|
|
184
184
|
params=params,
|
|
185
185
|
)
|
|
@@ -202,7 +202,7 @@ class RunBashCommand(BaseBashTool):
|
|
|
202
202
|
logging.info(f"Refusing LLM tool call {command_str}")
|
|
203
203
|
|
|
204
204
|
return StructuredToolResult(
|
|
205
|
-
status=
|
|
205
|
+
status=StructuredToolResultStatus.APPROVAL_REQUIRED,
|
|
206
206
|
error=f"Refusing to execute bash command. {str(e)}",
|
|
207
207
|
params=params,
|
|
208
208
|
invocation=command_str,
|