Skip to content
Open
Show file tree
Hide file tree
Changes from 3 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
30 changes: 30 additions & 0 deletions holmes/plugins/toolsets/datadog/datadog_traces_formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,36 @@ def format_spans_search(
if status and status != "ok":
output_lines.append(f" │ status: {status}")

# Check for custom error information
custom = attrs.get("custom", {})
error_info = custom.get("error", {})
if error_info:
output_lines.append(f" │ error:")

# Extract error fields
error_id = error_info.get("id")
error_file = error_info.get("file")
error_stack = error_info.get("stack")
error_message = error_info.get("message")
error_type = error_info.get("type")

if error_id:
output_lines.append(f" │ id: {error_id}")
if error_file:
output_lines.append(f" │ file: {error_file}")
if error_message:
output_lines.append(f" │ message: {error_message}")
if error_type:
output_lines.append(f" │ type: {error_type}")
if error_stack:
# Truncate stack trace for readability
stack_lines = error_stack.split('\n')[:5] # Show first 5 lines
output_lines.append(f" │ stack: {stack_lines[0]}")
for stack_line in stack_lines[1:]:
output_lines.append(f" │ {stack_line}")
if len(error_stack.split('\n')) > 5:
output_lines.append(f" │ ... (truncated)")

# Show important tags
tags = attrs.get("tags", [])
important_tags = {}
Expand Down
13 changes: 13 additions & 0 deletions holmes/plugins/toolsets/datadog/toolset_datadog_traces.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,11 @@ def __init__(self, toolset: "DatadogTracesToolset"):
name="fetch_datadog_traces",
description="Fetch a list of traces from Datadog with optional filters",
parameters={
"query": ToolParameter(
description="Datadog search query (e.g., 'service:web-app @http.status_code:500')",
type="string",
required=False,
),
"service": ToolParameter(
description="Filter by service name",
type="string",
Expand Down Expand Up @@ -200,6 +205,9 @@ 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"{toolset_name_for_one_liner(self.toolset.name)}: Fetch Traces ({params['query']})"

filters = []
if "service" in params:
filters.append(f"service={params['service']}")
Expand Down Expand Up @@ -238,6 +246,11 @@ def _invoke(self, params: Any) -> StructuredToolResult:
# Build search query
query_parts = []

# If a custom query is provided, use it as the base
if params.get("query"):
query_parts.append(params["query"])

# Add additional filters
if params.get("service"):
query_parts.append(f"service:{params['service']}")

Expand Down