holmesgpt 0.14.0a0__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 +101 -101
- 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/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 +15 -15
- holmes/plugins/toolsets/datadog/toolset_datadog_logs.py +8 -8
- holmes/plugins/toolsets/datadog/toolset_datadog_metrics.py +20 -20
- holmes/plugins/toolsets/datadog/toolset_datadog_rds.py +8 -8
- holmes/plugins/toolsets/datadog/toolset_datadog_traces.py +17 -17
- holmes/plugins/toolsets/git.py +21 -21
- holmes/plugins/toolsets/grafana/common.py +2 -2
- 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 +123 -23
- holmes/plugins/toolsets/grafana/toolset_grafana_tempo.py +165 -307
- 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 +5 -5
- 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.14.0a0.dist-info → holmesgpt-0.14.1a0.dist-info}/METADATA +9 -13
- {holmesgpt-0.14.0a0.dist-info → holmesgpt-0.14.1a0.dist-info}/RECORD +78 -68
- {holmesgpt-0.14.0a0.dist-info → holmesgpt-0.14.1a0.dist-info}/LICENSE.txt +0 -0
- {holmesgpt-0.14.0a0.dist-info → holmesgpt-0.14.1a0.dist-info}/WHEEL +0 -0
- {holmesgpt-0.14.0a0.dist-info → holmesgpt-0.14.1a0.dist-info}/entry_points.txt +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import subprocess
|
|
2
|
-
from holmes.core.tools import StructuredToolResult,
|
|
2
|
+
from holmes.core.tools import StructuredToolResult, StructuredToolResultStatus
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
def execute_bash_command(cmd: str, timeout: int, params: dict) -> StructuredToolResult:
|
|
@@ -18,11 +18,11 @@ def execute_bash_command(cmd: str, timeout: int, params: dict) -> StructuredTool
|
|
|
18
18
|
stdout = process.stdout.strip() if process.stdout else ""
|
|
19
19
|
result_data = f"{cmd}\n" f"{stdout}"
|
|
20
20
|
|
|
21
|
-
status =
|
|
21
|
+
status = StructuredToolResultStatus.ERROR
|
|
22
22
|
if process.returncode == 0 and stdout:
|
|
23
|
-
status =
|
|
23
|
+
status = StructuredToolResultStatus.SUCCESS
|
|
24
24
|
elif not stdout:
|
|
25
|
-
status =
|
|
25
|
+
status = StructuredToolResultStatus.NO_DATA
|
|
26
26
|
|
|
27
27
|
return StructuredToolResult(
|
|
28
28
|
status=status,
|
|
@@ -33,20 +33,20 @@ def execute_bash_command(cmd: str, timeout: int, params: dict) -> StructuredTool
|
|
|
33
33
|
)
|
|
34
34
|
except subprocess.TimeoutExpired:
|
|
35
35
|
return StructuredToolResult(
|
|
36
|
-
status=
|
|
36
|
+
status=StructuredToolResultStatus.ERROR,
|
|
37
37
|
error=f"Error: Command '{cmd}' timed out after {timeout} seconds.",
|
|
38
38
|
params=params,
|
|
39
39
|
)
|
|
40
40
|
except FileNotFoundError:
|
|
41
41
|
# This might occur if /bin/bash is not found, or if shell=False and command is not found
|
|
42
42
|
return StructuredToolResult(
|
|
43
|
-
status=
|
|
43
|
+
status=StructuredToolResultStatus.ERROR,
|
|
44
44
|
error="Error: Bash executable or command not found. Ensure bash is installed and the command is valid.",
|
|
45
45
|
params=params,
|
|
46
46
|
)
|
|
47
47
|
except Exception as e:
|
|
48
48
|
return StructuredToolResult(
|
|
49
|
-
status=
|
|
49
|
+
status=StructuredToolResultStatus.ERROR,
|
|
50
50
|
error=f"Error executing command '{cmd}': {str(e)}",
|
|
51
51
|
params=params,
|
|
52
52
|
)
|
|
@@ -3,7 +3,7 @@ from typing import Any, Optional, Tuple, Set
|
|
|
3
3
|
from holmes.core.tools import (
|
|
4
4
|
CallablePrerequisite,
|
|
5
5
|
StructuredToolResult,
|
|
6
|
-
|
|
6
|
+
StructuredToolResultStatus,
|
|
7
7
|
ToolsetTag,
|
|
8
8
|
)
|
|
9
9
|
from holmes.plugins.toolsets.consts import (
|
|
@@ -74,7 +74,7 @@ class CoralogixLogsToolset(BasePodLoggingToolset):
|
|
|
74
74
|
def fetch_pod_logs(self, params: FetchPodLogsParams) -> StructuredToolResult:
|
|
75
75
|
if not self.coralogix_config:
|
|
76
76
|
return StructuredToolResult(
|
|
77
|
-
status=
|
|
77
|
+
status=StructuredToolResultStatus.ERROR,
|
|
78
78
|
error=f"The {self.name} toolset is not configured",
|
|
79
79
|
params=params.model_dump(),
|
|
80
80
|
)
|
|
@@ -102,7 +102,9 @@ class CoralogixLogsToolset(BasePodLoggingToolset):
|
|
|
102
102
|
|
|
103
103
|
return StructuredToolResult(
|
|
104
104
|
status=(
|
|
105
|
-
|
|
105
|
+
StructuredToolResultStatus.ERROR
|
|
106
|
+
if logs_data.error
|
|
107
|
+
else StructuredToolResultStatus.SUCCESS
|
|
106
108
|
),
|
|
107
109
|
error=logs_data.error,
|
|
108
110
|
data=data,
|
|
@@ -13,7 +13,7 @@ from holmes.core.tools import (
|
|
|
13
13
|
ToolParameter,
|
|
14
14
|
Toolset,
|
|
15
15
|
StructuredToolResult,
|
|
16
|
-
|
|
16
|
+
StructuredToolResultStatus,
|
|
17
17
|
ToolsetTag,
|
|
18
18
|
)
|
|
19
19
|
from holmes.plugins.toolsets.consts import TOOLSET_CONFIG_MISSING_ERROR
|
|
@@ -333,7 +333,7 @@ class DatadogAPIGet(BaseDatadogGeneralTool):
|
|
|
333
333
|
|
|
334
334
|
if not self.toolset.dd_config:
|
|
335
335
|
return StructuredToolResult(
|
|
336
|
-
status=
|
|
336
|
+
status=StructuredToolResultStatus.ERROR,
|
|
337
337
|
error=TOOLSET_CONFIG_MISSING_ERROR,
|
|
338
338
|
params=params,
|
|
339
339
|
)
|
|
@@ -350,7 +350,7 @@ class DatadogAPIGet(BaseDatadogGeneralTool):
|
|
|
350
350
|
if not is_allowed:
|
|
351
351
|
logging.error(f"Endpoint validation failed: {error_msg}")
|
|
352
352
|
return StructuredToolResult(
|
|
353
|
-
status=
|
|
353
|
+
status=StructuredToolResultStatus.ERROR,
|
|
354
354
|
error=f"Endpoint validation failed: {error_msg}",
|
|
355
355
|
params=params,
|
|
356
356
|
)
|
|
@@ -381,13 +381,13 @@ class DatadogAPIGet(BaseDatadogGeneralTool):
|
|
|
381
381
|
> self.toolset.dd_config.max_response_size
|
|
382
382
|
):
|
|
383
383
|
return StructuredToolResult(
|
|
384
|
-
status=
|
|
384
|
+
status=StructuredToolResultStatus.ERROR,
|
|
385
385
|
error=f"Response too large (>{self.toolset.dd_config.max_response_size} bytes)",
|
|
386
386
|
params=params,
|
|
387
387
|
)
|
|
388
388
|
|
|
389
389
|
return StructuredToolResult(
|
|
390
|
-
status=
|
|
390
|
+
status=StructuredToolResultStatus.SUCCESS,
|
|
391
391
|
data=response_str,
|
|
392
392
|
params=params,
|
|
393
393
|
)
|
|
@@ -407,7 +407,7 @@ class DatadogAPIGet(BaseDatadogGeneralTool):
|
|
|
407
407
|
error_msg = f"API error {e.status_code}: {str(e)}"
|
|
408
408
|
|
|
409
409
|
return StructuredToolResult(
|
|
410
|
-
status=
|
|
410
|
+
status=StructuredToolResultStatus.ERROR,
|
|
411
411
|
error=error_msg,
|
|
412
412
|
params=params,
|
|
413
413
|
invocation=json.dumps({"url": url, "params": query_params})
|
|
@@ -418,7 +418,7 @@ class DatadogAPIGet(BaseDatadogGeneralTool):
|
|
|
418
418
|
except Exception as e:
|
|
419
419
|
logging.exception(f"Failed to query Datadog API: {params}", exc_info=True)
|
|
420
420
|
return StructuredToolResult(
|
|
421
|
-
status=
|
|
421
|
+
status=StructuredToolResultStatus.ERROR,
|
|
422
422
|
error=f"Unexpected error: {str(e)}",
|
|
423
423
|
params=params,
|
|
424
424
|
)
|
|
@@ -469,7 +469,7 @@ class DatadogAPIPostSearch(BaseDatadogGeneralTool):
|
|
|
469
469
|
|
|
470
470
|
if not self.toolset.dd_config:
|
|
471
471
|
return StructuredToolResult(
|
|
472
|
-
status=
|
|
472
|
+
status=StructuredToolResultStatus.ERROR,
|
|
473
473
|
error=TOOLSET_CONFIG_MISSING_ERROR,
|
|
474
474
|
params=params,
|
|
475
475
|
)
|
|
@@ -486,7 +486,7 @@ class DatadogAPIPostSearch(BaseDatadogGeneralTool):
|
|
|
486
486
|
if not is_allowed:
|
|
487
487
|
logging.error(f"Endpoint validation failed: {error_msg}")
|
|
488
488
|
return StructuredToolResult(
|
|
489
|
-
status=
|
|
489
|
+
status=StructuredToolResultStatus.ERROR,
|
|
490
490
|
error=f"Endpoint validation failed: {error_msg}",
|
|
491
491
|
params=params,
|
|
492
492
|
)
|
|
@@ -517,13 +517,13 @@ class DatadogAPIPostSearch(BaseDatadogGeneralTool):
|
|
|
517
517
|
> self.toolset.dd_config.max_response_size
|
|
518
518
|
):
|
|
519
519
|
return StructuredToolResult(
|
|
520
|
-
status=
|
|
520
|
+
status=StructuredToolResultStatus.ERROR,
|
|
521
521
|
error=f"Response too large (>{self.toolset.dd_config.max_response_size} bytes)",
|
|
522
522
|
params=params,
|
|
523
523
|
)
|
|
524
524
|
|
|
525
525
|
return StructuredToolResult(
|
|
526
|
-
status=
|
|
526
|
+
status=StructuredToolResultStatus.SUCCESS,
|
|
527
527
|
data=response_str,
|
|
528
528
|
params=params,
|
|
529
529
|
)
|
|
@@ -543,7 +543,7 @@ class DatadogAPIPostSearch(BaseDatadogGeneralTool):
|
|
|
543
543
|
error_msg = f"API error {e.status_code}: {str(e)}"
|
|
544
544
|
|
|
545
545
|
return StructuredToolResult(
|
|
546
|
-
status=
|
|
546
|
+
status=StructuredToolResultStatus.ERROR,
|
|
547
547
|
error=error_msg,
|
|
548
548
|
params=params,
|
|
549
549
|
invocation=json.dumps({"url": url, "body": body}) if url else None,
|
|
@@ -552,7 +552,7 @@ class DatadogAPIPostSearch(BaseDatadogGeneralTool):
|
|
|
552
552
|
except Exception as e:
|
|
553
553
|
logging.exception(f"Failed to query Datadog API: {params}", exc_info=True)
|
|
554
554
|
return StructuredToolResult(
|
|
555
|
-
status=
|
|
555
|
+
status=StructuredToolResultStatus.ERROR,
|
|
556
556
|
error=f"Unexpected error: {str(e)}",
|
|
557
557
|
params=params,
|
|
558
558
|
)
|
|
@@ -691,7 +691,7 @@ class ListDatadogAPIResources(BaseDatadogGeneralTool):
|
|
|
691
691
|
matching_categories = {k: v for k, v in resources.items() if category in k}
|
|
692
692
|
if not matching_categories:
|
|
693
693
|
return StructuredToolResult(
|
|
694
|
-
status=
|
|
694
|
+
status=StructuredToolResultStatus.ERROR,
|
|
695
695
|
error=f"Unknown category: {category}. Available: {', '.join(resources.keys())}",
|
|
696
696
|
params=params,
|
|
697
697
|
)
|
|
@@ -715,7 +715,7 @@ class ListDatadogAPIResources(BaseDatadogGeneralTool):
|
|
|
715
715
|
output.append("Example: datadog_api_get with endpoint='/api/v1/monitors'")
|
|
716
716
|
|
|
717
717
|
return StructuredToolResult(
|
|
718
|
-
status=
|
|
718
|
+
status=StructuredToolResultStatus.SUCCESS,
|
|
719
719
|
data="\n".join(output),
|
|
720
720
|
params=params,
|
|
721
721
|
)
|
|
@@ -8,7 +8,7 @@ from holmes.core.tools import (
|
|
|
8
8
|
ToolsetTag,
|
|
9
9
|
)
|
|
10
10
|
from pydantic import BaseModel, Field
|
|
11
|
-
from holmes.core.tools import StructuredToolResult,
|
|
11
|
+
from holmes.core.tools import StructuredToolResult, StructuredToolResultStatus
|
|
12
12
|
from holmes.plugins.toolsets.consts import TOOLSET_CONFIG_MISSING_ERROR
|
|
13
13
|
from holmes.plugins.toolsets.datadog.datadog_api import (
|
|
14
14
|
DatadogBaseConfig,
|
|
@@ -167,7 +167,7 @@ class DatadogLogsToolset(BasePodLoggingToolset):
|
|
|
167
167
|
def fetch_pod_logs(self, params: FetchPodLogsParams) -> StructuredToolResult:
|
|
168
168
|
if not self.dd_config:
|
|
169
169
|
return StructuredToolResult(
|
|
170
|
-
status=
|
|
170
|
+
status=StructuredToolResultStatus.ERROR,
|
|
171
171
|
data=TOOLSET_CONFIG_MISSING_ERROR,
|
|
172
172
|
params=params.model_dump(),
|
|
173
173
|
)
|
|
@@ -182,13 +182,13 @@ class DatadogLogsToolset(BasePodLoggingToolset):
|
|
|
182
182
|
if raw_logs:
|
|
183
183
|
logs_str = format_logs(raw_logs)
|
|
184
184
|
return StructuredToolResult(
|
|
185
|
-
status=
|
|
185
|
+
status=StructuredToolResultStatus.SUCCESS,
|
|
186
186
|
data=logs_str,
|
|
187
187
|
params=params.model_dump(),
|
|
188
188
|
)
|
|
189
189
|
|
|
190
190
|
return StructuredToolResult(
|
|
191
|
-
status=
|
|
191
|
+
status=StructuredToolResultStatus.NO_DATA,
|
|
192
192
|
params=params.model_dump(),
|
|
193
193
|
)
|
|
194
194
|
|
|
@@ -202,7 +202,7 @@ class DatadogLogsToolset(BasePodLoggingToolset):
|
|
|
202
202
|
error_msg = f"Exception while querying Datadog: {str(e)}"
|
|
203
203
|
|
|
204
204
|
return StructuredToolResult(
|
|
205
|
-
status=
|
|
205
|
+
status=StructuredToolResultStatus.ERROR,
|
|
206
206
|
error=error_msg,
|
|
207
207
|
params=params.model_dump(),
|
|
208
208
|
invocation=json.dumps(e.payload),
|
|
@@ -213,7 +213,7 @@ class DatadogLogsToolset(BasePodLoggingToolset):
|
|
|
213
213
|
f"Failed to query Datadog logs for params: {params}", exc_info=True
|
|
214
214
|
)
|
|
215
215
|
return StructuredToolResult(
|
|
216
|
-
status=
|
|
216
|
+
status=StructuredToolResultStatus.ERROR,
|
|
217
217
|
error=f"Exception while querying Datadog: {str(e)}",
|
|
218
218
|
params=params.model_dump(),
|
|
219
219
|
)
|
|
@@ -234,11 +234,11 @@ class DatadogLogsToolset(BasePodLoggingToolset):
|
|
|
234
234
|
|
|
235
235
|
result = self.fetch_pod_logs(healthcheck_params)
|
|
236
236
|
|
|
237
|
-
if result.status ==
|
|
237
|
+
if result.status == StructuredToolResultStatus.ERROR:
|
|
238
238
|
error_msg = result.error or "Unknown error during healthcheck"
|
|
239
239
|
logging.error(f"Datadog healthcheck failed: {error_msg}")
|
|
240
240
|
return False, f"Datadog healthcheck failed: {error_msg}"
|
|
241
|
-
elif result.status ==
|
|
241
|
+
elif result.status == StructuredToolResultStatus.NO_DATA:
|
|
242
242
|
error_msg = "No logs were found in the last 48 hours using wildcards for pod and namespace. Is the configuration correct?"
|
|
243
243
|
logging.error(f"Datadog healthcheck failed: {error_msg}")
|
|
244
244
|
return False, f"Datadog healthcheck failed: {error_msg}"
|
|
@@ -7,7 +7,7 @@ from holmes.core.tools import (
|
|
|
7
7
|
StructuredToolResult,
|
|
8
8
|
Tool,
|
|
9
9
|
ToolParameter,
|
|
10
|
-
|
|
10
|
+
StructuredToolResultStatus,
|
|
11
11
|
Toolset,
|
|
12
12
|
ToolsetTag,
|
|
13
13
|
)
|
|
@@ -80,7 +80,7 @@ class ListActiveMetrics(BaseDatadogMetricsTool):
|
|
|
80
80
|
) -> StructuredToolResult:
|
|
81
81
|
if not self.toolset.dd_config:
|
|
82
82
|
return StructuredToolResult(
|
|
83
|
-
status=
|
|
83
|
+
status=StructuredToolResultStatus.ERROR,
|
|
84
84
|
error=TOOLSET_CONFIG_MISSING_ERROR,
|
|
85
85
|
params=params,
|
|
86
86
|
)
|
|
@@ -121,7 +121,7 @@ class ListActiveMetrics(BaseDatadogMetricsTool):
|
|
|
121
121
|
metrics = data.get("metrics", [])
|
|
122
122
|
if not metrics:
|
|
123
123
|
return StructuredToolResult(
|
|
124
|
-
status=
|
|
124
|
+
status=StructuredToolResultStatus.ERROR,
|
|
125
125
|
data="Your filter returned no metrics. Change your filter and try again",
|
|
126
126
|
params=params,
|
|
127
127
|
)
|
|
@@ -133,7 +133,7 @@ class ListActiveMetrics(BaseDatadogMetricsTool):
|
|
|
133
133
|
output.append(metric)
|
|
134
134
|
|
|
135
135
|
return StructuredToolResult(
|
|
136
|
-
status=
|
|
136
|
+
status=StructuredToolResultStatus.SUCCESS,
|
|
137
137
|
data="\n".join(output),
|
|
138
138
|
params=params,
|
|
139
139
|
)
|
|
@@ -152,7 +152,7 @@ class ListActiveMetrics(BaseDatadogMetricsTool):
|
|
|
152
152
|
error_msg = f"Exception while querying Datadog: {str(e)}"
|
|
153
153
|
|
|
154
154
|
return StructuredToolResult(
|
|
155
|
-
status=
|
|
155
|
+
status=StructuredToolResultStatus.ERROR,
|
|
156
156
|
error=error_msg,
|
|
157
157
|
params=params,
|
|
158
158
|
invocation=json.dumps({"url": url, "params": query_params})
|
|
@@ -165,7 +165,7 @@ class ListActiveMetrics(BaseDatadogMetricsTool):
|
|
|
165
165
|
f"Failed to query Datadog metrics for params: {params}", exc_info=True
|
|
166
166
|
)
|
|
167
167
|
return StructuredToolResult(
|
|
168
|
-
status=
|
|
168
|
+
status=StructuredToolResultStatus.ERROR,
|
|
169
169
|
error=f"Exception while querying Datadog: {str(e)}",
|
|
170
170
|
params=params,
|
|
171
171
|
)
|
|
@@ -222,7 +222,7 @@ class QueryMetrics(BaseDatadogMetricsTool):
|
|
|
222
222
|
) -> StructuredToolResult:
|
|
223
223
|
if not self.toolset.dd_config:
|
|
224
224
|
return StructuredToolResult(
|
|
225
|
-
status=
|
|
225
|
+
status=StructuredToolResultStatus.ERROR,
|
|
226
226
|
error=TOOLSET_CONFIG_MISSING_ERROR,
|
|
227
227
|
params=params,
|
|
228
228
|
)
|
|
@@ -262,7 +262,7 @@ class QueryMetrics(BaseDatadogMetricsTool):
|
|
|
262
262
|
|
|
263
263
|
if not series:
|
|
264
264
|
return StructuredToolResult(
|
|
265
|
-
status=
|
|
265
|
+
status=StructuredToolResultStatus.NO_DATA,
|
|
266
266
|
error="The query returned no data. Please check your query syntax and time range.",
|
|
267
267
|
params=params,
|
|
268
268
|
)
|
|
@@ -317,7 +317,7 @@ class QueryMetrics(BaseDatadogMetricsTool):
|
|
|
317
317
|
|
|
318
318
|
data_str = json.dumps(response_data, indent=2)
|
|
319
319
|
return StructuredToolResult(
|
|
320
|
-
status=
|
|
320
|
+
status=StructuredToolResultStatus.SUCCESS,
|
|
321
321
|
data=data_str,
|
|
322
322
|
params=params,
|
|
323
323
|
)
|
|
@@ -336,7 +336,7 @@ class QueryMetrics(BaseDatadogMetricsTool):
|
|
|
336
336
|
error_msg = f"Exception while querying Datadog: {str(e)}"
|
|
337
337
|
|
|
338
338
|
return StructuredToolResult(
|
|
339
|
-
status=
|
|
339
|
+
status=StructuredToolResultStatus.ERROR,
|
|
340
340
|
error=error_msg,
|
|
341
341
|
params=params,
|
|
342
342
|
invocation=json.dumps({"url": url, "params": query_params})
|
|
@@ -350,7 +350,7 @@ class QueryMetrics(BaseDatadogMetricsTool):
|
|
|
350
350
|
)
|
|
351
351
|
|
|
352
352
|
return StructuredToolResult(
|
|
353
|
-
status=
|
|
353
|
+
status=StructuredToolResultStatus.ERROR,
|
|
354
354
|
error=f"Exception while querying Datadog: {str(e)}",
|
|
355
355
|
params=params,
|
|
356
356
|
)
|
|
@@ -380,7 +380,7 @@ class QueryMetricsMetadata(BaseDatadogMetricsTool):
|
|
|
380
380
|
) -> StructuredToolResult:
|
|
381
381
|
if not self.toolset.dd_config:
|
|
382
382
|
return StructuredToolResult(
|
|
383
|
-
status=
|
|
383
|
+
status=StructuredToolResultStatus.ERROR,
|
|
384
384
|
error=TOOLSET_CONFIG_MISSING_ERROR,
|
|
385
385
|
params=params,
|
|
386
386
|
)
|
|
@@ -396,7 +396,7 @@ class QueryMetricsMetadata(BaseDatadogMetricsTool):
|
|
|
396
396
|
|
|
397
397
|
if not metric_names:
|
|
398
398
|
return StructuredToolResult(
|
|
399
|
-
status=
|
|
399
|
+
status=StructuredToolResultStatus.ERROR,
|
|
400
400
|
error="metric_names cannot be empty",
|
|
401
401
|
params=params,
|
|
402
402
|
)
|
|
@@ -442,14 +442,14 @@ class QueryMetricsMetadata(BaseDatadogMetricsTool):
|
|
|
442
442
|
|
|
443
443
|
if not results and errors:
|
|
444
444
|
return StructuredToolResult(
|
|
445
|
-
status=
|
|
445
|
+
status=StructuredToolResultStatus.ERROR,
|
|
446
446
|
error="Failed to retrieve metadata for all metrics",
|
|
447
447
|
data=json.dumps(response_data, indent=2),
|
|
448
448
|
params=params,
|
|
449
449
|
)
|
|
450
450
|
|
|
451
451
|
return StructuredToolResult(
|
|
452
|
-
status=
|
|
452
|
+
status=StructuredToolResultStatus.SUCCESS,
|
|
453
453
|
data=json.dumps(response_data, indent=2),
|
|
454
454
|
params=params,
|
|
455
455
|
)
|
|
@@ -461,7 +461,7 @@ class QueryMetricsMetadata(BaseDatadogMetricsTool):
|
|
|
461
461
|
)
|
|
462
462
|
|
|
463
463
|
return StructuredToolResult(
|
|
464
|
-
status=
|
|
464
|
+
status=StructuredToolResultStatus.ERROR,
|
|
465
465
|
error=f"Exception while querying Datadog: {str(e)}",
|
|
466
466
|
params=params,
|
|
467
467
|
)
|
|
@@ -496,7 +496,7 @@ class ListMetricTags(BaseDatadogMetricsTool):
|
|
|
496
496
|
) -> StructuredToolResult:
|
|
497
497
|
if not self.toolset.dd_config:
|
|
498
498
|
return StructuredToolResult(
|
|
499
|
-
status=
|
|
499
|
+
status=StructuredToolResultStatus.ERROR,
|
|
500
500
|
error=TOOLSET_CONFIG_MISSING_ERROR,
|
|
501
501
|
params=params,
|
|
502
502
|
)
|
|
@@ -519,7 +519,7 @@ class ListMetricTags(BaseDatadogMetricsTool):
|
|
|
519
519
|
)
|
|
520
520
|
|
|
521
521
|
return StructuredToolResult(
|
|
522
|
-
status=
|
|
522
|
+
status=StructuredToolResultStatus.SUCCESS,
|
|
523
523
|
data=data,
|
|
524
524
|
params=params,
|
|
525
525
|
)
|
|
@@ -540,7 +540,7 @@ class ListMetricTags(BaseDatadogMetricsTool):
|
|
|
540
540
|
error_msg = f"Exception while querying Datadog: {str(e)}"
|
|
541
541
|
|
|
542
542
|
return StructuredToolResult(
|
|
543
|
-
status=
|
|
543
|
+
status=StructuredToolResultStatus.ERROR,
|
|
544
544
|
error=error_msg,
|
|
545
545
|
params=params,
|
|
546
546
|
invocation=json.dumps({"url": url, "params": query_params})
|
|
@@ -554,7 +554,7 @@ class ListMetricTags(BaseDatadogMetricsTool):
|
|
|
554
554
|
exc_info=True,
|
|
555
555
|
)
|
|
556
556
|
return StructuredToolResult(
|
|
557
|
-
status=
|
|
557
|
+
status=StructuredToolResultStatus.ERROR,
|
|
558
558
|
error=f"Exception while querying Datadog: {str(e)}",
|
|
559
559
|
params=params,
|
|
560
560
|
)
|
|
@@ -10,7 +10,7 @@ from holmes.core.tools import (
|
|
|
10
10
|
StructuredToolResult,
|
|
11
11
|
Tool,
|
|
12
12
|
ToolParameter,
|
|
13
|
-
|
|
13
|
+
StructuredToolResultStatus,
|
|
14
14
|
Toolset,
|
|
15
15
|
ToolsetTag,
|
|
16
16
|
)
|
|
@@ -97,7 +97,7 @@ class GenerateRDSPerformanceReport(BaseDatadogRDSTool):
|
|
|
97
97
|
) -> StructuredToolResult:
|
|
98
98
|
if not self.toolset.dd_config:
|
|
99
99
|
return StructuredToolResult(
|
|
100
|
-
status=
|
|
100
|
+
status=StructuredToolResultStatus.ERROR,
|
|
101
101
|
error=TOOLSET_CONFIG_MISSING_ERROR,
|
|
102
102
|
params=params,
|
|
103
103
|
)
|
|
@@ -150,7 +150,7 @@ class GenerateRDSPerformanceReport(BaseDatadogRDSTool):
|
|
|
150
150
|
formatted_report = self._format_report(report)
|
|
151
151
|
|
|
152
152
|
return StructuredToolResult(
|
|
153
|
-
status=
|
|
153
|
+
status=StructuredToolResultStatus.SUCCESS,
|
|
154
154
|
data=formatted_report,
|
|
155
155
|
params=params,
|
|
156
156
|
)
|
|
@@ -158,7 +158,7 @@ class GenerateRDSPerformanceReport(BaseDatadogRDSTool):
|
|
|
158
158
|
except Exception as e:
|
|
159
159
|
logging.error(f"Error generating RDS performance report: {str(e)}")
|
|
160
160
|
return StructuredToolResult(
|
|
161
|
-
status=
|
|
161
|
+
status=StructuredToolResultStatus.ERROR,
|
|
162
162
|
error=f"Failed to generate RDS performance report: {str(e)}",
|
|
163
163
|
params=params,
|
|
164
164
|
)
|
|
@@ -397,7 +397,7 @@ class GetTopWorstPerformingRDSInstances(BaseDatadogRDSTool):
|
|
|
397
397
|
) -> StructuredToolResult:
|
|
398
398
|
if not self.toolset.dd_config:
|
|
399
399
|
return StructuredToolResult(
|
|
400
|
-
status=
|
|
400
|
+
status=StructuredToolResultStatus.ERROR,
|
|
401
401
|
error=TOOLSET_CONFIG_MISSING_ERROR,
|
|
402
402
|
params=params,
|
|
403
403
|
)
|
|
@@ -416,7 +416,7 @@ class GetTopWorstPerformingRDSInstances(BaseDatadogRDSTool):
|
|
|
416
416
|
|
|
417
417
|
if not instances:
|
|
418
418
|
return StructuredToolResult(
|
|
419
|
-
status=
|
|
419
|
+
status=StructuredToolResultStatus.NO_DATA,
|
|
420
420
|
data="No RDS instances found with metrics in the specified time range",
|
|
421
421
|
params=params,
|
|
422
422
|
)
|
|
@@ -443,7 +443,7 @@ class GetTopWorstPerformingRDSInstances(BaseDatadogRDSTool):
|
|
|
443
443
|
report += f"\n\nInstances:\n{json.dumps(worst_performers, indent=2)}"
|
|
444
444
|
|
|
445
445
|
return StructuredToolResult(
|
|
446
|
-
status=
|
|
446
|
+
status=StructuredToolResultStatus.SUCCESS,
|
|
447
447
|
data=report,
|
|
448
448
|
params=params,
|
|
449
449
|
)
|
|
@@ -451,7 +451,7 @@ class GetTopWorstPerformingRDSInstances(BaseDatadogRDSTool):
|
|
|
451
451
|
except Exception as e:
|
|
452
452
|
logging.error(f"Error getting top worst performing RDS instances: {str(e)}")
|
|
453
453
|
return StructuredToolResult(
|
|
454
|
-
status=
|
|
454
|
+
status=StructuredToolResultStatus.ERROR,
|
|
455
455
|
error=f"Failed to get top worst performing RDS instances: {str(e)}",
|
|
456
456
|
params=params,
|
|
457
457
|
)
|
|
@@ -12,7 +12,7 @@ from holmes.core.tools import (
|
|
|
12
12
|
ToolParameter,
|
|
13
13
|
Toolset,
|
|
14
14
|
StructuredToolResult,
|
|
15
|
-
|
|
15
|
+
StructuredToolResultStatus,
|
|
16
16
|
ToolsetTag,
|
|
17
17
|
)
|
|
18
18
|
from holmes.plugins.toolsets.datadog.datadog_api import (
|
|
@@ -216,7 +216,7 @@ class FetchDatadogTracesList(BaseDatadogTracesTool):
|
|
|
216
216
|
"""Execute the tool to fetch traces."""
|
|
217
217
|
if not self.toolset.dd_config:
|
|
218
218
|
return StructuredToolResult(
|
|
219
|
-
status=
|
|
219
|
+
status=StructuredToolResultStatus.ERROR,
|
|
220
220
|
error="Datadog configuration not initialized",
|
|
221
221
|
params=params,
|
|
222
222
|
)
|
|
@@ -305,13 +305,13 @@ class FetchDatadogTracesList(BaseDatadogTracesTool):
|
|
|
305
305
|
formatted_output = format_traces_list(spans, limit=params.get("limit", 50))
|
|
306
306
|
if not formatted_output:
|
|
307
307
|
return StructuredToolResult(
|
|
308
|
-
status=
|
|
308
|
+
status=StructuredToolResultStatus.NO_DATA,
|
|
309
309
|
params=params,
|
|
310
310
|
data="No matching traces found.",
|
|
311
311
|
)
|
|
312
312
|
|
|
313
313
|
return StructuredToolResult(
|
|
314
|
-
status=
|
|
314
|
+
status=StructuredToolResultStatus.SUCCESS,
|
|
315
315
|
data=formatted_output,
|
|
316
316
|
params=params,
|
|
317
317
|
)
|
|
@@ -330,7 +330,7 @@ class FetchDatadogTracesList(BaseDatadogTracesTool):
|
|
|
330
330
|
error_msg = f"Exception while querying Datadog: {str(e)}"
|
|
331
331
|
|
|
332
332
|
return StructuredToolResult(
|
|
333
|
-
status=
|
|
333
|
+
status=StructuredToolResultStatus.ERROR,
|
|
334
334
|
error=error_msg,
|
|
335
335
|
params=params,
|
|
336
336
|
invocation=(
|
|
@@ -343,7 +343,7 @@ class FetchDatadogTracesList(BaseDatadogTracesTool):
|
|
|
343
343
|
except Exception as e:
|
|
344
344
|
logging.exception(e, exc_info=True)
|
|
345
345
|
return StructuredToolResult(
|
|
346
|
-
status=
|
|
346
|
+
status=StructuredToolResultStatus.ERROR,
|
|
347
347
|
error=f"Unexpected error: {str(e)}",
|
|
348
348
|
params=params,
|
|
349
349
|
invocation=(
|
|
@@ -382,7 +382,7 @@ class FetchDatadogTraceById(BaseDatadogTracesTool):
|
|
|
382
382
|
"""Execute the tool to fetch trace details."""
|
|
383
383
|
if not self.toolset.dd_config:
|
|
384
384
|
return StructuredToolResult(
|
|
385
|
-
status=
|
|
385
|
+
status=StructuredToolResultStatus.ERROR,
|
|
386
386
|
error="Datadog configuration not initialized",
|
|
387
387
|
params=params,
|
|
388
388
|
)
|
|
@@ -390,7 +390,7 @@ class FetchDatadogTraceById(BaseDatadogTracesTool):
|
|
|
390
390
|
trace_id = params.get("trace_id")
|
|
391
391
|
if not trace_id:
|
|
392
392
|
return StructuredToolResult(
|
|
393
|
-
status=
|
|
393
|
+
status=StructuredToolResultStatus.ERROR,
|
|
394
394
|
error="trace_id parameter is required",
|
|
395
395
|
params=params,
|
|
396
396
|
)
|
|
@@ -444,13 +444,13 @@ class FetchDatadogTraceById(BaseDatadogTracesTool):
|
|
|
444
444
|
formatted_output = format_trace_hierarchy(trace_id, spans)
|
|
445
445
|
if not formatted_output:
|
|
446
446
|
return StructuredToolResult(
|
|
447
|
-
status=
|
|
447
|
+
status=StructuredToolResultStatus.NO_DATA,
|
|
448
448
|
params=params,
|
|
449
449
|
data=f"No trace found for trace_id: {trace_id}",
|
|
450
450
|
)
|
|
451
451
|
|
|
452
452
|
return StructuredToolResult(
|
|
453
|
-
status=
|
|
453
|
+
status=StructuredToolResultStatus.SUCCESS,
|
|
454
454
|
data=formatted_output,
|
|
455
455
|
params=params,
|
|
456
456
|
)
|
|
@@ -469,7 +469,7 @@ class FetchDatadogTraceById(BaseDatadogTracesTool):
|
|
|
469
469
|
error_msg = f"Exception while querying Datadog: {str(e)}"
|
|
470
470
|
|
|
471
471
|
return StructuredToolResult(
|
|
472
|
-
status=
|
|
472
|
+
status=StructuredToolResultStatus.ERROR,
|
|
473
473
|
error=error_msg,
|
|
474
474
|
params=params,
|
|
475
475
|
invocation=(
|
|
@@ -482,7 +482,7 @@ class FetchDatadogTraceById(BaseDatadogTracesTool):
|
|
|
482
482
|
except Exception as e:
|
|
483
483
|
logging.exception(e, exc_info=True)
|
|
484
484
|
return StructuredToolResult(
|
|
485
|
-
status=
|
|
485
|
+
status=StructuredToolResultStatus.ERROR,
|
|
486
486
|
error=f"Unexpected error: {str(e)}",
|
|
487
487
|
params=params,
|
|
488
488
|
invocation=(
|
|
@@ -565,7 +565,7 @@ class FetchDatadogSpansByFilter(BaseDatadogTracesTool):
|
|
|
565
565
|
"""Execute the tool to search spans."""
|
|
566
566
|
if not self.toolset.dd_config:
|
|
567
567
|
return StructuredToolResult(
|
|
568
|
-
status=
|
|
568
|
+
status=StructuredToolResultStatus.ERROR,
|
|
569
569
|
error="Datadog configuration not initialized",
|
|
570
570
|
params=params,
|
|
571
571
|
)
|
|
@@ -653,13 +653,13 @@ class FetchDatadogSpansByFilter(BaseDatadogTracesTool):
|
|
|
653
653
|
formatted_output = format_spans_search(spans)
|
|
654
654
|
if not formatted_output:
|
|
655
655
|
return StructuredToolResult(
|
|
656
|
-
status=
|
|
656
|
+
status=StructuredToolResultStatus.NO_DATA,
|
|
657
657
|
params=params,
|
|
658
658
|
data="No matching spans found.",
|
|
659
659
|
)
|
|
660
660
|
|
|
661
661
|
return StructuredToolResult(
|
|
662
|
-
status=
|
|
662
|
+
status=StructuredToolResultStatus.SUCCESS,
|
|
663
663
|
data=formatted_output,
|
|
664
664
|
params=params,
|
|
665
665
|
)
|
|
@@ -677,7 +677,7 @@ class FetchDatadogSpansByFilter(BaseDatadogTracesTool):
|
|
|
677
677
|
error_msg = f"Exception while querying Datadog: {str(e)}"
|
|
678
678
|
|
|
679
679
|
return StructuredToolResult(
|
|
680
|
-
status=
|
|
680
|
+
status=StructuredToolResultStatus.ERROR,
|
|
681
681
|
error=error_msg,
|
|
682
682
|
params=params,
|
|
683
683
|
invocation=(
|
|
@@ -690,7 +690,7 @@ class FetchDatadogSpansByFilter(BaseDatadogTracesTool):
|
|
|
690
690
|
except Exception as e:
|
|
691
691
|
logging.exception(e, exc_info=True)
|
|
692
692
|
return StructuredToolResult(
|
|
693
|
-
status=
|
|
693
|
+
status=StructuredToolResultStatus.ERROR,
|
|
694
694
|
error=f"Unexpected error: {str(e)}",
|
|
695
695
|
params=params,
|
|
696
696
|
invocation=(
|