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
|
@@ -0,0 +1,331 @@
|
|
|
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 logging
|
|
8
|
+
import sys
|
|
9
|
+
from datetime import datetime
|
|
10
|
+
from typing import Any, Dict, List, Optional
|
|
11
|
+
|
|
12
|
+
# Configure logger for this module
|
|
13
|
+
logger = logging.getLogger(__name__)
|
|
14
|
+
|
|
15
|
+
# Import the necessary classes from the SDK
|
|
16
|
+
try:
|
|
17
|
+
from instana_client.api.log_alert_configuration_api import LogAlertConfigurationApi
|
|
18
|
+
from instana_client.api_client import ApiClient
|
|
19
|
+
from instana_client.configuration import Configuration
|
|
20
|
+
from instana_client.models.log_alert_config import LogAlertConfig
|
|
21
|
+
except ImportError:
|
|
22
|
+
logger.error("Failed to import Instana client modules", exc_info=True)
|
|
23
|
+
raise
|
|
24
|
+
|
|
25
|
+
from src.core.utils import BaseInstanaClient, register_as_tool
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class LogAlertConfigurationMCPTools(BaseInstanaClient):
|
|
29
|
+
"""Tools for log alert configuration in Instana MCP."""
|
|
30
|
+
|
|
31
|
+
def __init__(self, read_token: str, base_url: str):
|
|
32
|
+
"""Initialize the Log Alert Configuration MCP tools client."""
|
|
33
|
+
super().__init__(read_token=read_token, base_url=base_url)
|
|
34
|
+
|
|
35
|
+
try:
|
|
36
|
+
logger.debug(f"Initializing LogAlertConfigurationMCPTools with base_url={base_url}")
|
|
37
|
+
|
|
38
|
+
# Configure the API client with the correct base URL and authentication
|
|
39
|
+
configuration = Configuration()
|
|
40
|
+
configuration.host = base_url
|
|
41
|
+
configuration.api_key['ApiKeyAuth'] = read_token
|
|
42
|
+
configuration.api_key_prefix['ApiKeyAuth'] = 'apiToken'
|
|
43
|
+
|
|
44
|
+
# Create an API client with this configuration
|
|
45
|
+
api_client = ApiClient(configuration=configuration)
|
|
46
|
+
|
|
47
|
+
# Initialize the Instana SDK's LogAlertConfigurationApi with our configured client
|
|
48
|
+
self.log_alert_api = LogAlertConfigurationApi(api_client=api_client)
|
|
49
|
+
logger.debug(f"Initialized LogAlertConfigurationApi with host: {configuration.host}")
|
|
50
|
+
except Exception as e:
|
|
51
|
+
logger.error(f"Error initializing LogAlertConfigurationApi: {e}", exc_info=True)
|
|
52
|
+
raise
|
|
53
|
+
|
|
54
|
+
@register_as_tool
|
|
55
|
+
async def create_log_alert_config(self, config: Dict[str, Any], ctx=None) -> Dict[str, Any]:
|
|
56
|
+
"""
|
|
57
|
+
Create a new log alert configuration.
|
|
58
|
+
|
|
59
|
+
Args:
|
|
60
|
+
config: Dictionary containing the log alert configuration
|
|
61
|
+
Required fields:
|
|
62
|
+
- name: Name of the alert
|
|
63
|
+
- query: Log query string
|
|
64
|
+
- threshold: Threshold value for the alert
|
|
65
|
+
- timeThreshold: Time threshold in milliseconds
|
|
66
|
+
- rule: Rule configuration
|
|
67
|
+
ctx: The MCP context (optional)
|
|
68
|
+
|
|
69
|
+
Returns:
|
|
70
|
+
Dictionary containing the created log alert configuration or error information
|
|
71
|
+
"""
|
|
72
|
+
try:
|
|
73
|
+
logger.debug(f"create_log_alert_config called with config={config}")
|
|
74
|
+
|
|
75
|
+
try:
|
|
76
|
+
# Convert dictionary to LogAlertConfig model
|
|
77
|
+
log_alert_config = LogAlertConfig(**config)
|
|
78
|
+
except Exception as e:
|
|
79
|
+
logger.error(f"Error creating LogAlertConfig: {e}", exc_info=True)
|
|
80
|
+
return {"error": f"Failed to create log alert configuration: {e!s}"}
|
|
81
|
+
|
|
82
|
+
try:
|
|
83
|
+
# Call the API
|
|
84
|
+
result = self.log_alert_api.create_log_alert_config(log_alert_config=log_alert_config)
|
|
85
|
+
logger.debug(f"Result from create_log_alert_config: {result}")
|
|
86
|
+
return self._convert_to_dict(result)
|
|
87
|
+
except Exception as e:
|
|
88
|
+
logger.error(f"Error calling create_log_alert_config API: {e}", exc_info=True)
|
|
89
|
+
return {"error": f"Failed to create log alert configuration: {e!s}"}
|
|
90
|
+
except Exception as e:
|
|
91
|
+
logger.error(f"Error in create_log_alert_config: {e}", exc_info=True)
|
|
92
|
+
return {"error": f"Failed to create log alert configuration: {e!s}"}
|
|
93
|
+
|
|
94
|
+
@register_as_tool
|
|
95
|
+
async def delete_log_alert_config(self, id: str, ctx=None) -> Dict[str, Any]:
|
|
96
|
+
"""
|
|
97
|
+
Delete a log alert configuration.
|
|
98
|
+
|
|
99
|
+
Args:
|
|
100
|
+
id: ID of the log alert configuration to delete
|
|
101
|
+
ctx: The MCP context (optional)
|
|
102
|
+
|
|
103
|
+
Returns:
|
|
104
|
+
Dictionary containing the result of the deletion operation or error information
|
|
105
|
+
"""
|
|
106
|
+
try:
|
|
107
|
+
logger.debug(f"delete_log_alert_config called with id={id}")
|
|
108
|
+
|
|
109
|
+
try:
|
|
110
|
+
self.log_alert_api.delete_log_alert_config(id=id)
|
|
111
|
+
logger.debug(f"Successfully deleted log alert configuration with ID {id}")
|
|
112
|
+
return {"success": True, "message": f"Log alert configuration with ID {id} deleted successfully"}
|
|
113
|
+
except Exception as e:
|
|
114
|
+
logger.error(f"Error calling delete_log_alert_config API: {e}", exc_info=True)
|
|
115
|
+
return {"error": f"Failed to delete log alert configuration: {e!s}"}
|
|
116
|
+
except Exception as e:
|
|
117
|
+
logger.error(f"Error in delete_log_alert_config: {e}", exc_info=True)
|
|
118
|
+
return {"error": f"Failed to delete log alert configuration: {e!s}"}
|
|
119
|
+
|
|
120
|
+
@register_as_tool
|
|
121
|
+
async def disable_log_alert_config(self, id: str, ctx=None) -> Dict[str, Any]:
|
|
122
|
+
"""
|
|
123
|
+
Disable a log alert configuration.
|
|
124
|
+
|
|
125
|
+
Args:
|
|
126
|
+
id: ID of the log alert configuration to disable
|
|
127
|
+
ctx: The MCP context (optional)
|
|
128
|
+
|
|
129
|
+
Returns:
|
|
130
|
+
Dictionary containing the result of the disable operation or error information
|
|
131
|
+
"""
|
|
132
|
+
try:
|
|
133
|
+
logger.debug(f"disable_log_alert_config called with id={id}")
|
|
134
|
+
|
|
135
|
+
try:
|
|
136
|
+
self.log_alert_api.disable_log_alert_config(id=id)
|
|
137
|
+
logger.debug(f"Successfully disabled log alert configuration with ID {id}")
|
|
138
|
+
return {"success": True, "message": f"Log alert configuration with ID {id} disabled successfully"}
|
|
139
|
+
except Exception as e:
|
|
140
|
+
logger.error(f"Error calling disable_log_alert_config API: {e}", exc_info=True)
|
|
141
|
+
return {"error": f"Failed to disable log alert configuration: {e!s}"}
|
|
142
|
+
except Exception as e:
|
|
143
|
+
logger.error(f"Error in disable_log_alert_config: {e}", exc_info=True)
|
|
144
|
+
return {"error": f"Failed to disable log alert configuration: {e!s}"}
|
|
145
|
+
|
|
146
|
+
@register_as_tool
|
|
147
|
+
async def enable_log_alert_config(self, id: str, ctx=None) -> Dict[str, Any]:
|
|
148
|
+
"""
|
|
149
|
+
Enable a log alert configuration.
|
|
150
|
+
|
|
151
|
+
Args:
|
|
152
|
+
id: ID of the log alert configuration to enable
|
|
153
|
+
ctx: The MCP context (optional)
|
|
154
|
+
|
|
155
|
+
Returns:
|
|
156
|
+
Dictionary containing the result of the enable operation or error information
|
|
157
|
+
"""
|
|
158
|
+
try:
|
|
159
|
+
logger.debug(f"enable_log_alert_config called with id={id}")
|
|
160
|
+
|
|
161
|
+
try:
|
|
162
|
+
self.log_alert_api.enable_log_alert_config(id=id)
|
|
163
|
+
logger.debug(f"Successfully enabled log alert configuration with ID {id}")
|
|
164
|
+
return {"success": True, "message": f"Log alert configuration with ID {id} enabled successfully"}
|
|
165
|
+
except Exception as e:
|
|
166
|
+
logger.error(f"Error calling enable_log_alert_config API: {e}", exc_info=True)
|
|
167
|
+
return {"error": f"Failed to enable log alert configuration: {e!s}"}
|
|
168
|
+
except Exception as e:
|
|
169
|
+
logger.error(f"Error in enable_log_alert_config: {e}", exc_info=True)
|
|
170
|
+
return {"error": f"Failed to enable log alert configuration: {e!s}"}
|
|
171
|
+
|
|
172
|
+
@register_as_tool
|
|
173
|
+
async def find_active_log_alert_configs(self, alert_ids: Optional[List[str]] = None, ctx=None) -> Dict[str, Any]:
|
|
174
|
+
"""
|
|
175
|
+
Get all active log alert configurations.
|
|
176
|
+
|
|
177
|
+
Args:
|
|
178
|
+
alert_ids: Optional list of alert IDs to filter by
|
|
179
|
+
ctx: The MCP context (optional)
|
|
180
|
+
|
|
181
|
+
Returns:
|
|
182
|
+
Dictionary containing active log alert configurations or error information
|
|
183
|
+
"""
|
|
184
|
+
try:
|
|
185
|
+
logger.debug(f"find_active_log_alert_configs called with alert_ids={alert_ids}")
|
|
186
|
+
|
|
187
|
+
try:
|
|
188
|
+
result = self.log_alert_api.find_active_log_alert_configs(alert_ids=alert_ids)
|
|
189
|
+
logger.debug(f"Result from find_active_log_alert_configs: {result}")
|
|
190
|
+
return {"configs": [self._convert_to_dict(config) for config in result]}
|
|
191
|
+
except Exception as e:
|
|
192
|
+
logger.error(f"Error calling find_active_log_alert_configs API: {e}", exc_info=True)
|
|
193
|
+
return {"error": f"Failed to find active log alert configurations: {e!s}"}
|
|
194
|
+
except Exception as e:
|
|
195
|
+
logger.error(f"Error in find_active_log_alert_configs: {e}", exc_info=True)
|
|
196
|
+
return {"error": f"Failed to find active log alert configurations: {e!s}"}
|
|
197
|
+
|
|
198
|
+
@register_as_tool
|
|
199
|
+
async def find_log_alert_config(self, id: str, valid_on: Optional[int] = None, ctx=None) -> Dict[str, Any]:
|
|
200
|
+
"""
|
|
201
|
+
Get a specific log alert configuration by ID.
|
|
202
|
+
|
|
203
|
+
Args:
|
|
204
|
+
id: ID of the log alert configuration to retrieve
|
|
205
|
+
valid_on: Optional timestamp to get the configuration valid at that time
|
|
206
|
+
ctx: The MCP context (optional)
|
|
207
|
+
|
|
208
|
+
Returns:
|
|
209
|
+
Dictionary containing the log alert configuration or error information
|
|
210
|
+
"""
|
|
211
|
+
try:
|
|
212
|
+
logger.debug(f"find_log_alert_config called with id={id}, valid_on={valid_on}")
|
|
213
|
+
|
|
214
|
+
try:
|
|
215
|
+
result = self.log_alert_api.find_log_alert_config(id=id, valid_on=valid_on)
|
|
216
|
+
logger.debug(f"Result from find_log_alert_config: {result}")
|
|
217
|
+
return self._convert_to_dict(result)
|
|
218
|
+
except Exception as e:
|
|
219
|
+
logger.error(f"Error calling find_log_alert_config API: {e}", exc_info=True)
|
|
220
|
+
return {"error": f"Failed to find log alert configuration: {e!s}"}
|
|
221
|
+
except Exception as e:
|
|
222
|
+
logger.error(f"Error in find_log_alert_config: {e}", exc_info=True)
|
|
223
|
+
return {"error": f"Failed to find log alert configuration: {e!s}"}
|
|
224
|
+
|
|
225
|
+
@register_as_tool
|
|
226
|
+
async def find_log_alert_config_versions(self, id: str, ctx=None) -> Dict[str, Any]:
|
|
227
|
+
"""
|
|
228
|
+
Get all versions of a log alert configuration.
|
|
229
|
+
|
|
230
|
+
Args:
|
|
231
|
+
id: ID of the log alert configuration to get versions for
|
|
232
|
+
ctx: The MCP context (optional)
|
|
233
|
+
|
|
234
|
+
Returns:
|
|
235
|
+
Dictionary containing versions of the log alert configuration or error information
|
|
236
|
+
"""
|
|
237
|
+
try:
|
|
238
|
+
logger.debug(f"find_log_alert_config_versions called with id={id}")
|
|
239
|
+
|
|
240
|
+
try:
|
|
241
|
+
result = self.log_alert_api.find_log_alert_config_versions(id=id)
|
|
242
|
+
logger.debug(f"Result from find_log_alert_config_versions: {result}")
|
|
243
|
+
return {"versions": [self._convert_to_dict(version) for version in result]}
|
|
244
|
+
except Exception as e:
|
|
245
|
+
logger.error(f"Error calling find_log_alert_config_versions API: {e}", exc_info=True)
|
|
246
|
+
return {"error": f"Failed to find log alert configuration versions: {e!s}"}
|
|
247
|
+
except Exception as e:
|
|
248
|
+
logger.error(f"Error in find_log_alert_config_versions: {e}", exc_info=True)
|
|
249
|
+
return {"error": f"Failed to find log alert configuration versions: {e!s}"}
|
|
250
|
+
|
|
251
|
+
@register_as_tool
|
|
252
|
+
async def restore_log_alert_config(self, id: str, created: int, ctx=None) -> Dict[str, Any]:
|
|
253
|
+
"""
|
|
254
|
+
Restore a log alert configuration to a previous version.
|
|
255
|
+
|
|
256
|
+
Args:
|
|
257
|
+
id: ID of the log alert configuration to restore
|
|
258
|
+
created: Timestamp of the version to restore
|
|
259
|
+
ctx: The MCP context (optional)
|
|
260
|
+
|
|
261
|
+
Returns:
|
|
262
|
+
Dictionary containing the result of the restore operation or error information
|
|
263
|
+
"""
|
|
264
|
+
try:
|
|
265
|
+
logger.debug(f"restore_log_alert_config called with id={id}, created={created}")
|
|
266
|
+
|
|
267
|
+
try:
|
|
268
|
+
self.log_alert_api.restore_log_alert_config(id=id, created=created)
|
|
269
|
+
logger.debug(f"Successfully restored log alert configuration with ID {id}")
|
|
270
|
+
return {
|
|
271
|
+
"success": True,
|
|
272
|
+
"message": f"Log alert configuration with ID {id} restored to version from {datetime.fromtimestamp(created/1000).isoformat()}"
|
|
273
|
+
}
|
|
274
|
+
except Exception as e:
|
|
275
|
+
logger.error(f"Error calling restore_log_alert_config API: {e}", exc_info=True)
|
|
276
|
+
return {"error": f"Failed to restore log alert configuration: {e!s}"}
|
|
277
|
+
except Exception as e:
|
|
278
|
+
logger.error(f"Error in restore_log_alert_config: {e}", exc_info=True)
|
|
279
|
+
return {"error": f"Failed to restore log alert configuration: {e!s}"}
|
|
280
|
+
|
|
281
|
+
@register_as_tool
|
|
282
|
+
async def update_log_alert_config(self, id: str, config: Dict[str, Any], ctx=None) -> Dict[str, Any]:
|
|
283
|
+
"""
|
|
284
|
+
Update a log alert configuration.
|
|
285
|
+
|
|
286
|
+
Args:
|
|
287
|
+
id: ID of the log alert configuration to update
|
|
288
|
+
config: Dictionary containing the updated log alert configuration
|
|
289
|
+
ctx: The MCP context (optional)
|
|
290
|
+
|
|
291
|
+
Returns:
|
|
292
|
+
Dictionary containing the updated log alert configuration or error information
|
|
293
|
+
"""
|
|
294
|
+
try:
|
|
295
|
+
logger.debug(f"update_log_alert_config called with id={id}, config={config}")
|
|
296
|
+
|
|
297
|
+
try:
|
|
298
|
+
# Convert dictionary to LogAlertConfig model
|
|
299
|
+
log_alert_config = LogAlertConfig(**config)
|
|
300
|
+
except Exception as e:
|
|
301
|
+
logger.error(f"Error creating LogAlertConfig: {e}", exc_info=True)
|
|
302
|
+
return {"error": f"Failed to update log alert configuration: {e!s}"}
|
|
303
|
+
|
|
304
|
+
try:
|
|
305
|
+
# Call the API
|
|
306
|
+
result = self.log_alert_api.update_log_alert_config(id=id, log_alert_config=log_alert_config)
|
|
307
|
+
logger.debug(f"Result from update_log_alert_config: {result}")
|
|
308
|
+
return self._convert_to_dict(result)
|
|
309
|
+
except Exception as e:
|
|
310
|
+
logger.error(f"Error calling update_log_alert_config API: {e}", exc_info=True)
|
|
311
|
+
return {"error": f"Failed to update log alert configuration: {e!s}"}
|
|
312
|
+
except Exception as e:
|
|
313
|
+
logger.error(f"Error in update_log_alert_config: {e}", exc_info=True)
|
|
314
|
+
return {"error": f"Failed to update log alert configuration: {e!s}"}
|
|
315
|
+
|
|
316
|
+
def _convert_to_dict(self, obj: Any) -> Dict[str, Any]:
|
|
317
|
+
"""
|
|
318
|
+
Convert an object to a dictionary.
|
|
319
|
+
|
|
320
|
+
Args:
|
|
321
|
+
obj: Object to convert
|
|
322
|
+
|
|
323
|
+
Returns:
|
|
324
|
+
Dictionary representation of the object
|
|
325
|
+
"""
|
|
326
|
+
if hasattr(obj, "to_dict"):
|
|
327
|
+
return obj.to_dict()
|
|
328
|
+
elif hasattr(obj, "__dict__"):
|
|
329
|
+
return obj.__dict__
|
|
330
|
+
else:
|
|
331
|
+
return obj
|
src/prompts/__init__.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"""Prompts package for MCP Instana."""
|
|
2
|
+
import logging
|
|
3
|
+
|
|
4
|
+
from fastmcp import FastMCP
|
|
5
|
+
|
|
6
|
+
# Create an MCP server
|
|
7
|
+
mcp = FastMCP("Instana MCP Server")
|
|
8
|
+
|
|
9
|
+
# Global registry for all prompts
|
|
10
|
+
PROMPT_REGISTRY = []
|
|
11
|
+
|
|
12
|
+
def auto_register_prompt(func):
|
|
13
|
+
"""Wrap MCP's @mcp.prompt to also store prompt in a registry."""
|
|
14
|
+
func = mcp.prompt()(func) # apply MCP's decorator
|
|
15
|
+
PROMPT_REGISTRY.append(func)
|
|
16
|
+
return func
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Application-specific prompts package."""
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
from src.prompts import auto_register_prompt
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class ApplicationAlertsPrompts:
|
|
7
|
+
"""Class containing application alerts related prompts"""
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@auto_register_prompt
|
|
11
|
+
@staticmethod
|
|
12
|
+
def app_alerts_list(from_time: Optional[int]=None, to_time: Optional[int]=None, name_filter: Optional[str] = None, severity: Optional[str] = None) -> str:
|
|
13
|
+
"""List all application alerts in Instana server"""
|
|
14
|
+
return f"""
|
|
15
|
+
List application alerts with filters:
|
|
16
|
+
- Name filter: {name_filter or 'None'}
|
|
17
|
+
- Severity: {severity or 'None'}
|
|
18
|
+
- Time range: {from_time} to {to_time or 'current time'}
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@auto_register_prompt
|
|
23
|
+
@staticmethod
|
|
24
|
+
def app_alert_details(alert_ids: Optional[list] = None, application_id: Optional[str] = None) -> str:
|
|
25
|
+
"""Get Smart Alert Configurations details for a specific application"""
|
|
26
|
+
return f"""
|
|
27
|
+
Get alert details for:
|
|
28
|
+
- Alert IDs: {alert_ids or 'None'}
|
|
29
|
+
- Application ID: {application_id or 'None'}
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
@auto_register_prompt
|
|
34
|
+
@staticmethod
|
|
35
|
+
def app_alert_config_delete(id: str) -> str:
|
|
36
|
+
"""Delete a Smart Alert Configuration by ID"""
|
|
37
|
+
return f"Delete alert configuration with ID: {id}"
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
@auto_register_prompt
|
|
41
|
+
@staticmethod
|
|
42
|
+
def app_alert_config_enable(id: str) -> str:
|
|
43
|
+
"""Enable a Smart Alert Configuration by ID"""
|
|
44
|
+
return f"Enable alert configuration with ID: {id}"
|
|
45
|
+
|
|
46
|
+
@classmethod
|
|
47
|
+
def get_prompts(cls):
|
|
48
|
+
"""Return all prompts defined in this class"""
|
|
49
|
+
return [
|
|
50
|
+
('app_alerts_list', cls.app_alerts_list),
|
|
51
|
+
('app_alert_details', cls.app_alert_details),
|
|
52
|
+
('app_alert_config_delete', cls.app_alert_config_delete),
|
|
53
|
+
('app_alert_config_enable', cls.app_alert_config_enable),
|
|
54
|
+
]
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
from src.prompts import auto_register_prompt
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class ApplicationCatalogPrompts:
|
|
7
|
+
"""Class containing application catalog related prompts"""
|
|
8
|
+
|
|
9
|
+
@auto_register_prompt
|
|
10
|
+
@staticmethod
|
|
11
|
+
def app_catalog_yesterday(limit: int, use_case: Optional[str] = None, data_source: Optional[str] = None, var_from: Optional[int] = None) -> str:
|
|
12
|
+
"""List 3 available application tag catalog data for yesterday"""
|
|
13
|
+
return f"""
|
|
14
|
+
Get application catalog data:
|
|
15
|
+
- Use case: {use_case or 'None'}
|
|
16
|
+
- Data source: {data_source or 'None'}
|
|
17
|
+
- From: {var_from or 'last 24 hours'}
|
|
18
|
+
- Limit: {limit or '100'}
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
@classmethod
|
|
22
|
+
def get_prompts(cls):
|
|
23
|
+
"""Return all prompts defined in this class"""
|
|
24
|
+
return [
|
|
25
|
+
('app_catalog_yesterday', cls.app_catalog_yesterday),
|
|
26
|
+
]
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
from src.prompts import auto_register_prompt
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class ApplicationMetricsPrompts:
|
|
7
|
+
"""Class containing application metrics related prompts"""
|
|
8
|
+
|
|
9
|
+
@auto_register_prompt
|
|
10
|
+
@staticmethod
|
|
11
|
+
def get_application_metrics(application_ids: Optional[list] = None, metrics: Optional[list] = None, time_frame: Optional[dict] = None, fill_time_series: Optional[bool] = None) -> str:
|
|
12
|
+
"""Retrieve metrics for specific applications including latency, error rates, etc., over a given time frame"""
|
|
13
|
+
return f"""
|
|
14
|
+
Get application metrics for:
|
|
15
|
+
- Application IDs: {application_ids or 'None'}
|
|
16
|
+
- Metrics: {metrics or 'None'}
|
|
17
|
+
- Time frame: {time_frame or 'None'}
|
|
18
|
+
- Fill time series: {fill_time_series or 'None'}
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
@auto_register_prompt
|
|
22
|
+
@staticmethod
|
|
23
|
+
def get_application_endpoints_metrics(application_ids: Optional[list] = None, metrics: Optional[list] = None, time_frame: Optional[dict] = None, order: Optional[dict] = None, pagination: Optional[dict] = None, filters: Optional[dict] = None, fill_time_series: Optional[bool] = None) -> str:
|
|
24
|
+
"""Retrieve metrics for endpoints within an application, such as latency, error rates, and call counts"""
|
|
25
|
+
return f"""
|
|
26
|
+
Get endpoint metrics for applications:
|
|
27
|
+
- Application IDs: {application_ids}
|
|
28
|
+
- Metrics: {metrics}
|
|
29
|
+
- Time frame: {time_frame}
|
|
30
|
+
- Order: {order or 'None'}
|
|
31
|
+
- Pagination: {pagination or 'None'}
|
|
32
|
+
- Filters: {filters or 'None'}
|
|
33
|
+
- Fill time series: {fill_time_series or 'None'}
|
|
34
|
+
"""
|
|
35
|
+
|
|
36
|
+
@auto_register_prompt
|
|
37
|
+
@staticmethod
|
|
38
|
+
def get_application_service_metrics(service_ids: list, metrics: Optional[list] = None, var_from: Optional[int] = None, to: Optional[int] = None, fill_time_series: Optional[bool] = None, include_snapshot_ids: Optional[bool] = None) -> str:
|
|
39
|
+
"""Fetch metrics over a specific time frame for specific services"""
|
|
40
|
+
return f"""
|
|
41
|
+
Get service metrics:
|
|
42
|
+
- Service IDs: {service_ids}
|
|
43
|
+
- Metrics: {metrics or 'None'}
|
|
44
|
+
- From: {var_from or '1 hour ago'}
|
|
45
|
+
- To: {to or 'now'}
|
|
46
|
+
- Fill time series: {fill_time_series or 'None'}
|
|
47
|
+
- Include snapshot IDs: {include_snapshot_ids or 'None'}
|
|
48
|
+
"""
|
|
49
|
+
|
|
50
|
+
@classmethod
|
|
51
|
+
def get_prompts(cls):
|
|
52
|
+
"""Return all prompts defined in this class"""
|
|
53
|
+
return [
|
|
54
|
+
('get_application_metrics', cls.get_application_metrics),
|
|
55
|
+
('get_application_endpoints_metrics', cls.get_application_endpoints_metrics),
|
|
56
|
+
('get_application_service_metrics', cls.get_application_service_metrics),
|
|
57
|
+
]
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
from src.prompts import auto_register_prompt
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class ApplicationResourcesPrompts:
|
|
7
|
+
"""Class containing application resources related prompts"""
|
|
8
|
+
|
|
9
|
+
@auto_register_prompt
|
|
10
|
+
@staticmethod
|
|
11
|
+
def application_insights_summary(window_size: int, to_time: int, name_filter: Optional[str] = None, application_boundary_scope: Optional[str] = None) -> str:
|
|
12
|
+
"""Retrieve a list of services within application perspectives from Instana"""
|
|
13
|
+
return f"""
|
|
14
|
+
Get application insights summary with:
|
|
15
|
+
- Name filter: {name_filter or 'None'}
|
|
16
|
+
- Window size: {window_size or '1 hour'}
|
|
17
|
+
- To time: {to_time or 'now'}
|
|
18
|
+
- Boundary scope: {application_boundary_scope or 'None'}
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
@classmethod
|
|
22
|
+
def get_prompts(cls):
|
|
23
|
+
"""Return all prompts defined in this class"""
|
|
24
|
+
return [
|
|
25
|
+
('application_insights_summary', cls.application_insights_summary),
|
|
26
|
+
]
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
from src.prompts import auto_register_prompt
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class ApplicationSettingsPrompts:
|
|
7
|
+
"""Class containing application settings related prompts"""
|
|
8
|
+
|
|
9
|
+
@auto_register_prompt
|
|
10
|
+
@staticmethod
|
|
11
|
+
def get_all_applications_configs() -> str:
|
|
12
|
+
"""Get a list of all Application Perspectives with their configuration settings"""
|
|
13
|
+
return "Retrieve all application configurations"
|
|
14
|
+
|
|
15
|
+
@auto_register_prompt
|
|
16
|
+
@staticmethod
|
|
17
|
+
def get_application_config(id: str) -> str:
|
|
18
|
+
"""Get an Application Perspective configuration by ID"""
|
|
19
|
+
return f"Retrieve application configuration with ID: {id}"
|
|
20
|
+
|
|
21
|
+
@auto_register_prompt
|
|
22
|
+
@staticmethod
|
|
23
|
+
def get_all_endpoint_configs() -> str:
|
|
24
|
+
"""Get a list of all Endpoint Perspectives with their configuration settings"""
|
|
25
|
+
return "Retrieve all endpoint configurations"
|
|
26
|
+
|
|
27
|
+
@auto_register_prompt
|
|
28
|
+
@staticmethod
|
|
29
|
+
def get_endpoint_config(id: str) -> str:
|
|
30
|
+
"""Retrieve the endpoint configuration of a service"""
|
|
31
|
+
return f"Get endpoint configuration with ID: {id}"
|
|
32
|
+
|
|
33
|
+
@auto_register_prompt
|
|
34
|
+
@staticmethod
|
|
35
|
+
def get_all_manual_service_configs() -> str:
|
|
36
|
+
"""Get a list of all Manual Service Perspectives with their configuration settings"""
|
|
37
|
+
return "Retrieve all manual service configurations"
|
|
38
|
+
|
|
39
|
+
@auto_register_prompt
|
|
40
|
+
@staticmethod
|
|
41
|
+
def add_manual_service_config(
|
|
42
|
+
enabled: bool,
|
|
43
|
+
tag_filter_expression: dict,
|
|
44
|
+
unmonitored_service_name: Optional[str] = None,
|
|
45
|
+
existing_service_id: Optional[str] = None,
|
|
46
|
+
description: Optional[str] = None
|
|
47
|
+
) -> str:
|
|
48
|
+
"""Create a manual service mapping configuration"""
|
|
49
|
+
return f"""
|
|
50
|
+
Add manual service configuration:
|
|
51
|
+
- Tag filter: {tag_filter_expression}
|
|
52
|
+
- Unmonitored service name: {unmonitored_service_name or 'None'}
|
|
53
|
+
- Existing service ID: {existing_service_id or 'None'}
|
|
54
|
+
- Description: {description or 'None'}
|
|
55
|
+
- Enabled: {enabled or 'True'}
|
|
56
|
+
"""
|
|
57
|
+
|
|
58
|
+
@auto_register_prompt
|
|
59
|
+
@staticmethod
|
|
60
|
+
def get_service_config(id: str) -> str:
|
|
61
|
+
"""Retrieve the particular custom service configuration"""
|
|
62
|
+
return f"Get service configuration with ID: {id}"
|
|
63
|
+
|
|
64
|
+
@classmethod
|
|
65
|
+
def get_prompts(cls):
|
|
66
|
+
"""Return all prompts defined in this class"""
|
|
67
|
+
return [
|
|
68
|
+
('get_all_applications_configs', cls.get_all_applications_configs),
|
|
69
|
+
('get_application_config', cls.get_application_config),
|
|
70
|
+
('get_all_endpoint_configs', cls.get_all_endpoint_configs),
|
|
71
|
+
('get_endpoint_config', cls.get_endpoint_config),
|
|
72
|
+
('get_all_manual_service_configs', cls.get_all_manual_service_configs),
|
|
73
|
+
('add_manual_service_config', cls.add_manual_service_config),
|
|
74
|
+
('get_service_config', cls.get_service_config),
|
|
75
|
+
]
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
from src.prompts import auto_register_prompt
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class ApplicationTopologyPrompts:
|
|
7
|
+
"""Class containing application topology related prompts"""
|
|
8
|
+
|
|
9
|
+
@auto_register_prompt
|
|
10
|
+
@staticmethod
|
|
11
|
+
def get_application_topology(
|
|
12
|
+
window_size: Optional[int] = None,
|
|
13
|
+
to_timestamp: Optional[int] = None,
|
|
14
|
+
application_id: Optional[str] = None,
|
|
15
|
+
application_boundary_scope: Optional[str] = None) -> str:
|
|
16
|
+
"""Retrieve the service topology showing connections between services"""
|
|
17
|
+
return f"""
|
|
18
|
+
Get application topology:
|
|
19
|
+
- Window size: {window_size or '1 hour'}
|
|
20
|
+
- To timestamp: {to_timestamp or 'current time'}
|
|
21
|
+
- Application ID: {application_id or 'None'}
|
|
22
|
+
- Boundary scope: {application_boundary_scope or 'INBOUND'}
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
@classmethod
|
|
26
|
+
def get_prompts(cls):
|
|
27
|
+
"""Return all prompts defined in this class"""
|
|
28
|
+
return [
|
|
29
|
+
('get_application_topology', cls.get_application_topology),
|
|
30
|
+
]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Events-specific prompts package."""
|