Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions holmes/plugins/toolsets/coralogix/toolset_coralogix_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ def prerequisites_callable(self, config: dict[str, Any]) -> Tuple[bool, str]:
def coralogix_config(self) -> Optional[CoralogixConfig]:
return self.config

def logger_name(self) -> str:
return "Coralogix"

def fetch_pod_logs(self, params: FetchPodLogsParams) -> StructuredToolResult:
if not self.coralogix_config:
return StructuredToolResult(
Expand Down
3 changes: 3 additions & 0 deletions holmes/plugins/toolsets/datadog/toolset_datadog_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ def __init__(self):
tags=[ToolsetTag.CORE],
)

def logger_name(self) -> str:
return "DataDog"

def fetch_pod_logs(self, params: FetchPodLogsParams) -> StructuredToolResult:
if not self.dd_config:
return StructuredToolResult(
Expand Down
10 changes: 6 additions & 4 deletions holmes/plugins/toolsets/datadog/toolset_datadog_traces.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def get_parameterized_one_liner(self, params: dict) -> str:
filters.append(f"duration>{params['min_duration']}")

filter_str = " AND ".join(filters) if filters else "all traces"
return f"fetch traces matching {filter_str}"
return f"DataDog: fetch traces matching {filter_str}"
Comment thread
aantn marked this conversation as resolved.

def _invoke(self, params: Any) -> StructuredToolResult:
"""Execute the tool to fetch traces."""
Expand Down Expand Up @@ -364,7 +364,9 @@ def __init__(self, toolset: "DatadogTracesToolset"):

def get_parameterized_one_liner(self, params: dict) -> str:
"""Get a one-liner description of the tool invocation."""
return f"fetch trace details for ID {params.get('trace_id', 'unknown')}"
return (
f"DataDog: fetch trace details for ID {params.get('trace_id', 'unknown')}"
)
Comment thread
aantn marked this conversation as resolved.

def _invoke(self, params: Any) -> StructuredToolResult:
"""Execute the tool to fetch trace details."""
Expand Down Expand Up @@ -536,7 +538,7 @@ def __init__(self, toolset: "DatadogTracesToolset"):
def get_parameterized_one_liner(self, params: dict) -> str:
"""Get a one-liner description of the tool invocation."""
if "query" in params:
return f"search spans with query: {params['query']}"
return f"DataDog: search spans with query: {params['query']}"
Comment thread
aantn marked this conversation as resolved.

filters = []
if "service" in params:
Expand All @@ -545,7 +547,7 @@ def get_parameterized_one_liner(self, params: dict) -> str:
filters.append(f"operation={params['operation']}")

filter_str = " AND ".join(filters) if filters else "all spans"
return f"search spans matching {filter_str}"
return f"DataDog: search spans matching {filter_str}"
Comment thread
aantn marked this conversation as resolved.

def _invoke(self, params: Any) -> StructuredToolResult:
"""Execute the tool to search spans."""
Expand Down
3 changes: 3 additions & 0 deletions holmes/plugins/toolsets/grafana/toolset_grafana_loki.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ def get_example_config(self):
def grafana_config(self) -> GrafanaLokiConfig:
return cast(GrafanaLokiConfig, self.config)

def logger_name(self) -> str:
return "Loki"

def fetch_pod_logs(self, params: FetchPodLogsParams) -> StructuredToolResult:
(start, end) = process_timestamps_to_rfc3339(
start_timestamp=params.start_time,
Expand Down
8 changes: 7 additions & 1 deletion holmes/plugins/toolsets/logging_utils/logging_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ class BasePodLoggingToolset(Toolset, ABC):
def fetch_pod_logs(self, params: FetchPodLogsParams) -> StructuredToolResult:
pass

def logger_name(self) -> str:
return ""


class PodLoggingTool(Tool):
"""Common tool for fetching pod logs across different logging backends"""
Expand Down Expand Up @@ -123,7 +126,10 @@ def get_parameterized_one_liner(self, params: dict) -> str:
if limit:
extra_params_str += f" limit={limit}"

return f"Fetching logs for pod {pod_name} in namespace {namespace}.{extra_params_str}"
logger_name = (
f"{self._toolset.logger_name()}: " if self._toolset.logger_name() else ""
)
return f"{logger_name}Fetching logs for pod {pod_name} in namespace {namespace}.{extra_params_str}"
Comment thread
arikalon1 marked this conversation as resolved.


def process_time_parameters(
Expand Down
3 changes: 3 additions & 0 deletions holmes/plugins/toolsets/opensearch/opensearch_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ def prerequisites_callable(self, config: dict[str, Any]) -> Tuple[bool, str]:
def opensearch_config(self) -> Optional[OpenSearchLoggingConfig]:
return self.config

def logger_name(self) -> str:
return "OpenSearch"

def fetch_pod_logs(self, params: FetchPodLogsParams) -> StructuredToolResult:
if not self.opensearch_config:
return StructuredToolResult(
Expand Down
4 changes: 2 additions & 2 deletions tests/plugins/toolsets/datadog/traces/test_datadog_traces.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ def test_get_parameterized_one_liner(self):
"""Test one-liner generation."""
params = {"trace_id": "abc123"}
one_liner = self.tool.get_parameterized_one_liner(params)
assert "fetch trace details for ID abc123" == one_liner
assert "DataDog: fetch trace details for ID abc123" == one_liner

def test_invoke_missing_trace_id(self):
"""Test invocation without trace_id parameter."""
Expand Down Expand Up @@ -339,7 +339,7 @@ def test_get_parameterized_one_liner(self):
# Test with query
params = {"query": "@http.status_code:500"}
one_liner = self.tool.get_parameterized_one_liner(params)
assert "search spans with query: @http.status_code:500" == one_liner
assert "DataDog: search spans with query: @http.status_code:500" == one_liner

# Test with filters
params = {"service": "web-api", "operation": "GET /users"}
Expand Down