mcp-instana 0.1.0__py3-none-any.whl → 0.2.0__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.
- mcp_instana-0.2.0.dist-info/METADATA +1229 -0
- mcp_instana-0.2.0.dist-info/RECORD +59 -0
- {mcp_instana-0.1.0.dist-info → mcp_instana-0.2.0.dist-info}/WHEEL +1 -1
- mcp_instana-0.2.0.dist-info/entry_points.txt +4 -0
- mcp_instana-0.1.0.dist-info/LICENSE → mcp_instana-0.2.0.dist-info/licenses/LICENSE.md +3 -3
- src/application/__init__.py +1 -0
- src/{client/application_alert_config_mcp_tools.py → application/application_alert_config.py} +251 -273
- src/application/application_analyze.py +628 -0
- src/application/application_catalog.py +155 -0
- src/application/application_global_alert_config.py +653 -0
- src/{client/application_metrics_mcp_tools.py → application/application_metrics.py} +113 -131
- src/{client/application_resources_mcp_tools.py → application/application_resources.py} +131 -151
- src/application/application_settings.py +1731 -0
- src/application/application_topology.py +111 -0
- src/automation/action_catalog.py +416 -0
- src/automation/action_history.py +338 -0
- src/core/__init__.py +1 -0
- src/core/server.py +586 -0
- src/core/utils.py +213 -0
- src/event/__init__.py +1 -0
- src/event/events_tools.py +850 -0
- src/infrastructure/__init__.py +1 -0
- src/{client/infrastructure_analyze_mcp_tools.py → infrastructure/infrastructure_analyze.py} +207 -206
- src/{client/infrastructure_catalog_mcp_tools.py → infrastructure/infrastructure_catalog.py} +197 -265
- src/infrastructure/infrastructure_metrics.py +171 -0
- src/{client/infrastructure_resources_mcp_tools.py → infrastructure/infrastructure_resources.py} +198 -227
- src/{client/infrastructure_topology_mcp_tools.py → infrastructure/infrastructure_topology.py} +110 -109
- src/log/__init__.py +1 -0
- src/log/log_alert_configuration.py +331 -0
- src/prompts/__init__.py +16 -0
- src/prompts/application/__init__.py +1 -0
- src/prompts/application/application_alerts.py +54 -0
- src/prompts/application/application_catalog.py +26 -0
- src/prompts/application/application_metrics.py +57 -0
- src/prompts/application/application_resources.py +26 -0
- src/prompts/application/application_settings.py +75 -0
- src/prompts/application/application_topology.py +30 -0
- src/prompts/events/__init__.py +1 -0
- src/prompts/events/events_tools.py +161 -0
- src/prompts/infrastructure/infrastructure_analyze.py +72 -0
- src/prompts/infrastructure/infrastructure_catalog.py +53 -0
- src/prompts/infrastructure/infrastructure_metrics.py +45 -0
- src/prompts/infrastructure/infrastructure_resources.py +74 -0
- src/prompts/infrastructure/infrastructure_topology.py +38 -0
- src/prompts/settings/__init__.py +0 -0
- src/prompts/settings/custom_dashboard.py +157 -0
- src/prompts/website/__init__.py +1 -0
- src/prompts/website/website_analyze.py +35 -0
- src/prompts/website/website_catalog.py +40 -0
- src/prompts/website/website_configuration.py +105 -0
- src/prompts/website/website_metrics.py +34 -0
- src/settings/__init__.py +1 -0
- src/settings/custom_dashboard_tools.py +417 -0
- src/website/__init__.py +0 -0
- src/website/website_analyze.py +433 -0
- src/website/website_catalog.py +171 -0
- src/website/website_configuration.py +770 -0
- src/website/website_metrics.py +241 -0
- mcp_instana-0.1.0.dist-info/METADATA +0 -649
- mcp_instana-0.1.0.dist-info/RECORD +0 -19
- mcp_instana-0.1.0.dist-info/entry_points.txt +0 -3
- src/client/What is the sum of queue depth for all q +0 -55
- src/client/events_mcp_tools.py +0 -531
- src/client/instana_client_base.py +0 -93
- src/client/log_alert_configuration_mcp_tools.py +0 -316
- src/client/show the top 5 services with the highest +0 -28
- src/mcp_server.py +0 -343
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Base Instana API Client Module
|
|
3
|
-
|
|
4
|
-
This module provides the base client for interacting with the Instana API.
|
|
5
|
-
"""
|
|
6
|
-
|
|
7
|
-
import sys
|
|
8
|
-
import requests
|
|
9
|
-
from typing import Dict, Any, AsyncIterator
|
|
10
|
-
from contextlib import asynccontextmanager
|
|
11
|
-
|
|
12
|
-
# Registry to store all tools
|
|
13
|
-
MCP_TOOLS = {}
|
|
14
|
-
|
|
15
|
-
def register_as_tool(func):
|
|
16
|
-
"""Decorator to register a method as an MCP tool."""
|
|
17
|
-
MCP_TOOLS[func.__name__] = func
|
|
18
|
-
return func
|
|
19
|
-
|
|
20
|
-
class BaseInstanaClient:
|
|
21
|
-
"""Base client for Instana API with common functionality."""
|
|
22
|
-
|
|
23
|
-
def __init__(self, read_token: str, base_url: str):
|
|
24
|
-
self.read_token = read_token
|
|
25
|
-
self.base_url = base_url
|
|
26
|
-
|
|
27
|
-
def get_headers(self):
|
|
28
|
-
"""Get standard headers for Instana API requests."""
|
|
29
|
-
return {
|
|
30
|
-
"Authorization": f"apiToken {self.read_token}",
|
|
31
|
-
"Content-Type": "application/json",
|
|
32
|
-
"Accept": "application/json"
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
async def make_request(self, endpoint: str, params: Dict[str, Any] = None, method: str = "GET", json: Dict[str, Any] = None) -> Dict[str, Any]:
|
|
36
|
-
"""Make a request to the Instana API."""
|
|
37
|
-
url = f"{self.base_url}/{endpoint.lstrip('/')}"
|
|
38
|
-
headers = self.get_headers()
|
|
39
|
-
|
|
40
|
-
try:
|
|
41
|
-
if method.upper() == "GET":
|
|
42
|
-
response = requests.get(url, headers=headers, params=params, verify=False)
|
|
43
|
-
elif method.upper() == "POST":
|
|
44
|
-
# Use the json parameter if provided, otherwise use params
|
|
45
|
-
data_to_send = json if json is not None else params
|
|
46
|
-
response = requests.post(url, headers=headers, json=data_to_send, verify=False)
|
|
47
|
-
elif method.upper() == "PUT":
|
|
48
|
-
data_to_send = json if json is not None else params
|
|
49
|
-
response = requests.put(url, headers=headers, json=data_to_send, verify=False)
|
|
50
|
-
elif method.upper() == "DELETE":
|
|
51
|
-
response = requests.delete(url, headers=headers, params=params, verify=False)
|
|
52
|
-
else:
|
|
53
|
-
return {"error": f"Unsupported HTTP method: {method}"}
|
|
54
|
-
|
|
55
|
-
response.raise_for_status()
|
|
56
|
-
return response.json()
|
|
57
|
-
except requests.exceptions.HTTPError as err:
|
|
58
|
-
print(f"HTTP Error: {err}", file=sys.stderr)
|
|
59
|
-
return {"error": f"HTTP Error: {err}"}
|
|
60
|
-
except requests.exceptions.RequestException as err:
|
|
61
|
-
print(f"Error: {err}", file=sys.stderr)
|
|
62
|
-
return {"error": f"Error: {err}"}
|
|
63
|
-
except Exception as e:
|
|
64
|
-
print(f"Unexpected error: {str(e)}", file=sys.stderr)
|
|
65
|
-
return {"error": f"Unexpected error: {str(e)}"}
|
|
66
|
-
|
|
67
|
-
@asynccontextmanager
|
|
68
|
-
async def instana_api_token(read_token: str, base_url: str) -> AsyncIterator[Dict[str, BaseInstanaClient]]:
|
|
69
|
-
"""
|
|
70
|
-
Context manager for creating and managing Instana API clients.
|
|
71
|
-
Returns a dictionary of client instances for different API groups.
|
|
72
|
-
"""
|
|
73
|
-
# Import here to avoid circular imports
|
|
74
|
-
from .infrastructure_mcp_tools import InfrastructureMCPTools
|
|
75
|
-
from .application_mcp_tools import ApplicationClient
|
|
76
|
-
|
|
77
|
-
# Create the standard clients
|
|
78
|
-
infra_client = InfrastructureMCPTools(read_token=read_token, base_url=base_url)
|
|
79
|
-
app_client = ApplicationClient(read_token=read_token, base_url=base_url)
|
|
80
|
-
|
|
81
|
-
# Initialize clients dictionary
|
|
82
|
-
clients = {
|
|
83
|
-
"infrastructure": infra_client,
|
|
84
|
-
"application": app_client,
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
try:
|
|
88
|
-
yield clients
|
|
89
|
-
except Exception as e:
|
|
90
|
-
print(f"Error in Instana API client: {e}", file=sys.stderr)
|
|
91
|
-
finally:
|
|
92
|
-
# Clean up resources if needed
|
|
93
|
-
pass
|
|
@@ -1,316 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Log Alert Configuration MCP Tools Module
|
|
3
|
-
|
|
4
|
-
This module provides log alert configuration-specific MCP tools for Instana monitoring.
|
|
5
|
-
"""
|
|
6
|
-
|
|
7
|
-
import sys
|
|
8
|
-
import traceback
|
|
9
|
-
from typing import Dict, Any, List, Optional
|
|
10
|
-
from datetime import datetime
|
|
11
|
-
|
|
12
|
-
# Import the necessary classes from the SDK
|
|
13
|
-
try:
|
|
14
|
-
from instana_client.api.log_alert_configuration_api import LogAlertConfigurationApi
|
|
15
|
-
from instana_client.api_client import ApiClient
|
|
16
|
-
from instana_client.configuration import Configuration
|
|
17
|
-
from instana_client.models.log_alert_config import LogAlertConfig
|
|
18
|
-
except ImportError as e:
|
|
19
|
-
traceback.print_exc(file=sys.stderr)
|
|
20
|
-
raise
|
|
21
|
-
|
|
22
|
-
from .instana_client_base import BaseInstanaClient, register_as_tool
|
|
23
|
-
|
|
24
|
-
# Helper function for debug printing
|
|
25
|
-
def debug_print(*args, **kwargs):
|
|
26
|
-
"""Print debug information to stderr instead of stdout"""
|
|
27
|
-
print(*args, file=sys.stderr, **kwargs)
|
|
28
|
-
|
|
29
|
-
class LogAlertConfigurationMCPTools(BaseInstanaClient):
|
|
30
|
-
"""Tools for log alert configuration in Instana MCP."""
|
|
31
|
-
|
|
32
|
-
def __init__(self, read_token: str, base_url: str):
|
|
33
|
-
"""Initialize the Log Alert Configuration MCP tools client."""
|
|
34
|
-
super().__init__(read_token=read_token, base_url=base_url)
|
|
35
|
-
|
|
36
|
-
try:
|
|
37
|
-
debug_print(f"Initializing LogAlertConfigurationMCPTools with base_url={base_url}")
|
|
38
|
-
|
|
39
|
-
# Configure the API client with the correct base URL and authentication
|
|
40
|
-
configuration = Configuration()
|
|
41
|
-
configuration.host = base_url
|
|
42
|
-
configuration.api_key['ApiKeyAuth'] = read_token
|
|
43
|
-
configuration.api_key_prefix['ApiKeyAuth'] = 'apiToken'
|
|
44
|
-
|
|
45
|
-
# Create an API client with this configuration
|
|
46
|
-
api_client = ApiClient(configuration=configuration)
|
|
47
|
-
|
|
48
|
-
# Initialize the Instana SDK's LogAlertConfigurationApi with our configured client
|
|
49
|
-
self.log_alert_api = LogAlertConfigurationApi(api_client=api_client)
|
|
50
|
-
debug_print(f"Initialized LogAlertConfigurationApi with host: {configuration.host}")
|
|
51
|
-
except Exception as e:
|
|
52
|
-
debug_print(f"Error initializing LogAlertConfigurationApi: {e}")
|
|
53
|
-
traceback.print_exc(file=sys.stderr)
|
|
54
|
-
raise
|
|
55
|
-
|
|
56
|
-
@register_as_tool
|
|
57
|
-
async def create_log_alert_config(self, config: Dict[str, Any], ctx=None) -> Dict[str, Any]:
|
|
58
|
-
"""
|
|
59
|
-
Create a new log alert configuration.
|
|
60
|
-
|
|
61
|
-
Args:
|
|
62
|
-
config: Dictionary containing the log alert configuration
|
|
63
|
-
Required fields:
|
|
64
|
-
- name: Name of the alert
|
|
65
|
-
- query: Log query string
|
|
66
|
-
- threshold: Threshold value for the alert
|
|
67
|
-
- timeThreshold: Time threshold in milliseconds
|
|
68
|
-
- rule: Rule configuration
|
|
69
|
-
ctx: The MCP context (optional)
|
|
70
|
-
|
|
71
|
-
Returns:
|
|
72
|
-
Dictionary containing the created log alert configuration or error information
|
|
73
|
-
"""
|
|
74
|
-
try:
|
|
75
|
-
debug_print(f"create_log_alert_config called with config={config}")
|
|
76
|
-
|
|
77
|
-
# Convert dictionary to LogAlertConfig model
|
|
78
|
-
log_alert_config = LogAlertConfig(**config)
|
|
79
|
-
|
|
80
|
-
# Call the API
|
|
81
|
-
result = self.log_alert_api.create_log_alert_config(log_alert_config=log_alert_config)
|
|
82
|
-
|
|
83
|
-
debug_print(f"Result from create_log_alert_config: {result}")
|
|
84
|
-
return self._convert_to_dict(result)
|
|
85
|
-
except Exception as e:
|
|
86
|
-
debug_print(f"Error in create_log_alert_config: {e}")
|
|
87
|
-
import traceback
|
|
88
|
-
traceback.print_exc(file=sys.stderr)
|
|
89
|
-
return {"error": f"Failed to create log alert configuration: {str(e)}"}
|
|
90
|
-
|
|
91
|
-
@register_as_tool
|
|
92
|
-
async def delete_log_alert_config(self, id: str, ctx=None) -> Dict[str, Any]:
|
|
93
|
-
"""
|
|
94
|
-
Delete a log alert configuration.
|
|
95
|
-
|
|
96
|
-
Args:
|
|
97
|
-
id: ID of the log alert configuration to delete
|
|
98
|
-
ctx: The MCP context (optional)
|
|
99
|
-
|
|
100
|
-
Returns:
|
|
101
|
-
Dictionary containing the result of the deletion operation or error information
|
|
102
|
-
"""
|
|
103
|
-
try:
|
|
104
|
-
debug_print(f"delete_log_alert_config called with id={id}")
|
|
105
|
-
|
|
106
|
-
self.log_alert_api.delete_log_alert_config(id=id)
|
|
107
|
-
|
|
108
|
-
debug_print(f"Successfully deleted log alert configuration with ID {id}")
|
|
109
|
-
return {"success": True, "message": f"Log alert configuration with ID {id} deleted successfully"}
|
|
110
|
-
except Exception as e:
|
|
111
|
-
debug_print(f"Error in delete_log_alert_config: {e}")
|
|
112
|
-
import traceback
|
|
113
|
-
traceback.print_exc(file=sys.stderr)
|
|
114
|
-
return {"error": f"Failed to delete log alert configuration: {str(e)}"}
|
|
115
|
-
|
|
116
|
-
@register_as_tool
|
|
117
|
-
async def disable_log_alert_config(self, id: str, ctx=None) -> Dict[str, Any]:
|
|
118
|
-
"""
|
|
119
|
-
Disable a log alert configuration.
|
|
120
|
-
|
|
121
|
-
Args:
|
|
122
|
-
id: ID of the log alert configuration to disable
|
|
123
|
-
ctx: The MCP context (optional)
|
|
124
|
-
|
|
125
|
-
Returns:
|
|
126
|
-
Dictionary containing the result of the disable operation or error information
|
|
127
|
-
"""
|
|
128
|
-
try:
|
|
129
|
-
debug_print(f"disable_log_alert_config called with id={id}")
|
|
130
|
-
|
|
131
|
-
self.log_alert_api.disable_log_alert_config(id=id)
|
|
132
|
-
|
|
133
|
-
debug_print(f"Successfully disabled log alert configuration with ID {id}")
|
|
134
|
-
return {"success": True, "message": f"Log alert configuration with ID {id} disabled successfully"}
|
|
135
|
-
except Exception as e:
|
|
136
|
-
debug_print(f"Error in disable_log_alert_config: {e}")
|
|
137
|
-
import traceback
|
|
138
|
-
traceback.print_exc(file=sys.stderr)
|
|
139
|
-
return {"error": f"Failed to disable log alert configuration: {str(e)}"}
|
|
140
|
-
|
|
141
|
-
@register_as_tool
|
|
142
|
-
async def enable_log_alert_config(self, id: str, ctx=None) -> Dict[str, Any]:
|
|
143
|
-
"""
|
|
144
|
-
Enable a log alert configuration.
|
|
145
|
-
|
|
146
|
-
Args:
|
|
147
|
-
id: ID of the log alert configuration to enable
|
|
148
|
-
ctx: The MCP context (optional)
|
|
149
|
-
|
|
150
|
-
Returns:
|
|
151
|
-
Dictionary containing the result of the enable operation or error information
|
|
152
|
-
"""
|
|
153
|
-
try:
|
|
154
|
-
debug_print(f"enable_log_alert_config called with id={id}")
|
|
155
|
-
|
|
156
|
-
self.log_alert_api.enable_log_alert_config(id=id)
|
|
157
|
-
|
|
158
|
-
debug_print(f"Successfully enabled log alert configuration with ID {id}")
|
|
159
|
-
return {"success": True, "message": f"Log alert configuration with ID {id} enabled successfully"}
|
|
160
|
-
except Exception as e:
|
|
161
|
-
debug_print(f"Error in enable_log_alert_config: {e}")
|
|
162
|
-
import traceback
|
|
163
|
-
traceback.print_exc(file=sys.stderr)
|
|
164
|
-
return {"error": f"Failed to enable log alert configuration: {str(e)}"}
|
|
165
|
-
|
|
166
|
-
@register_as_tool
|
|
167
|
-
async def find_active_log_alert_configs(self, alert_ids: Optional[List[str]] = None, ctx=None) -> Dict[str, Any]:
|
|
168
|
-
"""
|
|
169
|
-
Get all active log alert configurations.
|
|
170
|
-
|
|
171
|
-
Args:
|
|
172
|
-
alert_ids: Optional list of alert IDs to filter by
|
|
173
|
-
ctx: The MCP context (optional)
|
|
174
|
-
|
|
175
|
-
Returns:
|
|
176
|
-
Dictionary containing active log alert configurations or error information
|
|
177
|
-
"""
|
|
178
|
-
try:
|
|
179
|
-
debug_print(f"find_active_log_alert_configs called with alert_ids={alert_ids}")
|
|
180
|
-
|
|
181
|
-
result = self.log_alert_api.find_active_log_alert_configs(alert_ids=alert_ids)
|
|
182
|
-
|
|
183
|
-
debug_print(f"Result from find_active_log_alert_configs: {result}")
|
|
184
|
-
return {"configs": [self._convert_to_dict(config) for config in result]}
|
|
185
|
-
except Exception as e:
|
|
186
|
-
debug_print(f"Error in find_active_log_alert_configs: {e}")
|
|
187
|
-
import traceback
|
|
188
|
-
traceback.print_exc(file=sys.stderr)
|
|
189
|
-
return {"error": f"Failed to find active log alert configurations: {str(e)}"}
|
|
190
|
-
|
|
191
|
-
@register_as_tool
|
|
192
|
-
async def find_log_alert_config(self, id: str, valid_on: Optional[int] = None, ctx=None) -> Dict[str, Any]:
|
|
193
|
-
"""
|
|
194
|
-
Get a specific log alert configuration by ID.
|
|
195
|
-
|
|
196
|
-
Args:
|
|
197
|
-
id: ID of the log alert configuration to retrieve
|
|
198
|
-
valid_on: Optional timestamp to get the configuration valid at that time
|
|
199
|
-
ctx: The MCP context (optional)
|
|
200
|
-
|
|
201
|
-
Returns:
|
|
202
|
-
Dictionary containing the log alert configuration or error information
|
|
203
|
-
"""
|
|
204
|
-
try:
|
|
205
|
-
debug_print(f"find_log_alert_config called with id={id}, valid_on={valid_on}")
|
|
206
|
-
|
|
207
|
-
result = self.log_alert_api.find_log_alert_config(id=id, valid_on=valid_on)
|
|
208
|
-
|
|
209
|
-
debug_print(f"Result from find_log_alert_config: {result}")
|
|
210
|
-
return self._convert_to_dict(result)
|
|
211
|
-
except Exception as e:
|
|
212
|
-
debug_print(f"Error in find_log_alert_config: {e}")
|
|
213
|
-
import traceback
|
|
214
|
-
traceback.print_exc(file=sys.stderr)
|
|
215
|
-
return {"error": f"Failed to find log alert configuration: {str(e)}"}
|
|
216
|
-
|
|
217
|
-
@register_as_tool
|
|
218
|
-
async def find_log_alert_config_versions(self, id: str, ctx=None) -> Dict[str, Any]:
|
|
219
|
-
"""
|
|
220
|
-
Get all versions of a log alert configuration.
|
|
221
|
-
|
|
222
|
-
Args:
|
|
223
|
-
id: ID of the log alert configuration to get versions for
|
|
224
|
-
ctx: The MCP context (optional)
|
|
225
|
-
|
|
226
|
-
Returns:
|
|
227
|
-
Dictionary containing versions of the log alert configuration or error information
|
|
228
|
-
"""
|
|
229
|
-
try:
|
|
230
|
-
debug_print(f"find_log_alert_config_versions called with id={id}")
|
|
231
|
-
|
|
232
|
-
result = self.log_alert_api.find_log_alert_config_versions(id=id)
|
|
233
|
-
|
|
234
|
-
debug_print(f"Result from find_log_alert_config_versions: {result}")
|
|
235
|
-
return {"versions": [self._convert_to_dict(version) for version in result]}
|
|
236
|
-
except Exception as e:
|
|
237
|
-
debug_print(f"Error in find_log_alert_config_versions: {e}")
|
|
238
|
-
import traceback
|
|
239
|
-
traceback.print_exc(file=sys.stderr)
|
|
240
|
-
return {"error": f"Failed to find log alert configuration versions: {str(e)}"}
|
|
241
|
-
|
|
242
|
-
@register_as_tool
|
|
243
|
-
async def restore_log_alert_config(self, id: str, created: int, ctx=None) -> Dict[str, Any]:
|
|
244
|
-
"""
|
|
245
|
-
Restore a log alert configuration to a previous version.
|
|
246
|
-
|
|
247
|
-
Args:
|
|
248
|
-
id: ID of the log alert configuration to restore
|
|
249
|
-
created: Timestamp of the version to restore
|
|
250
|
-
ctx: The MCP context (optional)
|
|
251
|
-
|
|
252
|
-
Returns:
|
|
253
|
-
Dictionary containing the result of the restore operation or error information
|
|
254
|
-
"""
|
|
255
|
-
try:
|
|
256
|
-
debug_print(f"restore_log_alert_config called with id={id}, created={created}")
|
|
257
|
-
|
|
258
|
-
self.log_alert_api.restore_log_alert_config(id=id, created=created)
|
|
259
|
-
|
|
260
|
-
debug_print(f"Successfully restored log alert configuration with ID {id}")
|
|
261
|
-
return {
|
|
262
|
-
"success": True,
|
|
263
|
-
"message": f"Log alert configuration with ID {id} restored to version from {datetime.fromtimestamp(created/1000).isoformat()}"
|
|
264
|
-
}
|
|
265
|
-
except Exception as e:
|
|
266
|
-
debug_print(f"Error in restore_log_alert_config: {e}")
|
|
267
|
-
import traceback
|
|
268
|
-
traceback.print_exc(file=sys.stderr)
|
|
269
|
-
return {"error": f"Failed to restore log alert configuration: {str(e)}"}
|
|
270
|
-
|
|
271
|
-
@register_as_tool
|
|
272
|
-
async def update_log_alert_config(self, id: str, config: Dict[str, Any], ctx=None) -> Dict[str, Any]:
|
|
273
|
-
"""
|
|
274
|
-
Update a log alert configuration.
|
|
275
|
-
|
|
276
|
-
Args:
|
|
277
|
-
id: ID of the log alert configuration to update
|
|
278
|
-
config: Dictionary containing the updated log alert configuration
|
|
279
|
-
ctx: The MCP context (optional)
|
|
280
|
-
|
|
281
|
-
Returns:
|
|
282
|
-
Dictionary containing the updated log alert configuration or error information
|
|
283
|
-
"""
|
|
284
|
-
try:
|
|
285
|
-
debug_print(f"update_log_alert_config called with id={id}, config={config}")
|
|
286
|
-
|
|
287
|
-
# Convert dictionary to LogAlertConfig model
|
|
288
|
-
log_alert_config = LogAlertConfig(**config)
|
|
289
|
-
|
|
290
|
-
# Call the API
|
|
291
|
-
result = self.log_alert_api.update_log_alert_config(id=id, log_alert_config=log_alert_config)
|
|
292
|
-
|
|
293
|
-
debug_print(f"Result from update_log_alert_config: {result}")
|
|
294
|
-
return self._convert_to_dict(result)
|
|
295
|
-
except Exception as e:
|
|
296
|
-
debug_print(f"Error in update_log_alert_config: {e}")
|
|
297
|
-
import traceback
|
|
298
|
-
traceback.print_exc(file=sys.stderr)
|
|
299
|
-
return {"error": f"Failed to update log alert configuration: {str(e)}"}
|
|
300
|
-
|
|
301
|
-
def _convert_to_dict(self, obj: Any) -> Dict[str, Any]:
|
|
302
|
-
"""
|
|
303
|
-
Convert an object to a dictionary.
|
|
304
|
-
|
|
305
|
-
Args:
|
|
306
|
-
obj: Object to convert
|
|
307
|
-
|
|
308
|
-
Returns:
|
|
309
|
-
Dictionary representation of the object
|
|
310
|
-
"""
|
|
311
|
-
if hasattr(obj, "to_dict"):
|
|
312
|
-
return obj.to_dict()
|
|
313
|
-
elif hasattr(obj, "__dict__"):
|
|
314
|
-
return obj.__dict__
|
|
315
|
-
else:
|
|
316
|
-
return obj
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
show the top 5 services with the highest number of calls to cassandra cluster ABC_CLUST
|
|
2
|
-
What is the total latency in milliseconds for HTTP calls from the service named MyService to the host named myhost in the last hour?
|
|
3
|
-
What is the sum of latency in the last 1 hour for database calls from the service named MyService to the host named myhost sorted by latency in descending order?
|
|
4
|
-
Show me the average response time of HTTP requests to the APPXYZ application in the last 10 minutes, group result by call name, and order result by average response time in ascending order.
|
|
5
|
-
show the average latency of all HTTP calls from service XYZ
|
|
6
|
-
show the average latency of HTTP calls from service XYZ to service ABC, grouped by the call name
|
|
7
|
-
What is the rate of calls in the last 5 minutes for HTTP calls from the service named MyService to the host named myhost grouped by destination host?
|
|
8
|
-
show the average latency of HTTP calls to the service named 'my_service'
|
|
9
|
-
show the average latency for all HTTP calls from service XYZ to service ABC
|
|
10
|
-
show the number of calls and errors from service XYZ to service ABC, grouped by the destination server
|
|
11
|
-
What is the number of calls in the last 2 hours for HTTP calls from the service named MyService to the host named myhost grouped by the call type and sorted by the number of calls in descending order?
|
|
12
|
-
Show me the total number of calls, errors, and the response time for HTTP calls from the APPXYZ application in the last 2 hours, group result by call name, and order result by response time in ascending order.
|
|
13
|
-
show the mean latency and number of calls from service XYZ to service ABC, grouped by the HTTP method
|
|
14
|
-
What is the rate of errors per minute for database calls from the service named MyService to the host named myhost in the last hour?
|
|
15
|
-
show the number of errors from service XYZ to service ABC, grouped by the HTTP method and ordered by errors
|
|
16
|
-
What is the max latency in the last 1 hour for database calls to the host named myhost of the service named MyService?
|
|
17
|
-
What are the sum of errors for HTTP calls from the service named MyService to the service named MyOtherService in the last 5 minutes?
|
|
18
|
-
What is the average latency in the last 1 hour for database calls to the host named myhost of the service named MyService, ordered by the latency in descending order?
|
|
19
|
-
Show me the number of failed HTTP requests between applications appXYZ and appABC in the last hour, group result by error messages, and order result by number of errors in descending order.
|
|
20
|
-
How many HTTP calls were made by the service named MyService to the host named myhost in the last 2 hours?
|
|
21
|
-
What is the average response time of PCFindInventoryIVSyncService calls handled by apiserver service of oms-pcity-prod-1 application?
|
|
22
|
-
Show top erroneous calls handled by 'Robot Shop - EP' application since yesterday
|
|
23
|
-
Show performance overview of all http calls in the past 2 hours group by call name
|
|
24
|
-
What is the average response time of promo HTTP calls handled by Kubernetes cluster demo-us-cluster?
|
|
25
|
-
What is the average response time of readiness calls, handled by service app of application zone in last 1 day?
|
|
26
|
-
Show count of erroneous HTTP calls by call.tag.Errorcode handled by AdService application.
|
|
27
|
-
Show top erroneous calls handled by AdService service since last 10 minutes.
|
|
28
|
-
Show performance overview of outbound http calls from kubernetes cluster kub8-names to AC-test1 application order by calls
|