monocle-apptrace 0.5.1b1__py3-none-any.whl → 0.5.3__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 monocle-apptrace might be problematic. Click here for more details.
- monocle_apptrace/exporters/file_exporter.py +8 -1
- monocle_apptrace/instrumentation/common/span_handler.py +7 -4
- monocle_apptrace/instrumentation/common/utils.py +10 -2
- monocle_apptrace/instrumentation/common/wrapper_method.py +3 -1
- monocle_apptrace/instrumentation/metamodel/adk/entities/agent.py +6 -1
- monocle_apptrace/instrumentation/metamodel/adk/entities/tool.py +8 -3
- monocle_apptrace/instrumentation/metamodel/agents/entities/inference.py +15 -3
- monocle_apptrace/instrumentation/metamodel/aiohttp/_helper.py +22 -7
- monocle_apptrace/instrumentation/metamodel/aiohttp/entities/http.py +14 -3
- monocle_apptrace/instrumentation/metamodel/azfunc/_helper.py +21 -11
- monocle_apptrace/instrumentation/metamodel/azfunc/entities/http.py +7 -2
- monocle_apptrace/instrumentation/metamodel/fastapi/_helper.py +19 -6
- monocle_apptrace/instrumentation/metamodel/fastapi/entities/http.py +6 -2
- monocle_apptrace/instrumentation/metamodel/fastapi/methods.py +19 -19
- monocle_apptrace/instrumentation/metamodel/flask/_helper.py +20 -6
- monocle_apptrace/instrumentation/metamodel/flask/entities/http.py +7 -2
- monocle_apptrace/instrumentation/metamodel/lambdafunc/_helper.py +25 -14
- monocle_apptrace/instrumentation/metamodel/lambdafunc/entities/http.py +7 -2
- monocle_apptrace/instrumentation/metamodel/langgraph/entities/inference.py +1 -1
- monocle_apptrace/instrumentation/metamodel/llamaindex/entities/agent.py +1 -1
- monocle_apptrace/instrumentation/metamodel/mcp/entities/inference.py +5 -0
- monocle_apptrace/instrumentation/metamodel/mistral/__init__.py +0 -0
- monocle_apptrace/instrumentation/metamodel/mistral/_helper.py +174 -0
- monocle_apptrace/instrumentation/metamodel/mistral/entities/__init__.py +0 -0
- monocle_apptrace/instrumentation/metamodel/mistral/entities/inference.py +85 -0
- monocle_apptrace/instrumentation/metamodel/mistral/methods.py +41 -0
- monocle_apptrace/instrumentation/metamodel/teamsai/_helper.py +2 -2
- {monocle_apptrace-0.5.1b1.dist-info → monocle_apptrace-0.5.3.dist-info}/METADATA +1 -1
- {monocle_apptrace-0.5.1b1.dist-info → monocle_apptrace-0.5.3.dist-info}/RECORD +33 -28
- {monocle_apptrace-0.5.1b1.dist-info → monocle_apptrace-0.5.3.dist-info}/WHEEL +0 -0
- {monocle_apptrace-0.5.1b1.dist-info → monocle_apptrace-0.5.3.dist-info}/entry_points.txt +0 -0
- {monocle_apptrace-0.5.1b1.dist-info → monocle_apptrace-0.5.3.dist-info}/licenses/LICENSE +0 -0
- {monocle_apptrace-0.5.1b1.dist-info → monocle_apptrace-0.5.3.dist-info}/licenses/NOTICE +0 -0
|
@@ -14,12 +14,13 @@ from monocle_apptrace.exporters.exporter_processor import ExportTaskProcessor
|
|
|
14
14
|
DEFAULT_FILE_PREFIX:str = "monocle_trace_"
|
|
15
15
|
DEFAULT_TIME_FORMAT:str = "%Y-%m-%d_%H.%M.%S"
|
|
16
16
|
HANDLE_TIMEOUT_SECONDS: int = 60 # 1 minute timeout
|
|
17
|
+
DEFAULT_TRACE_FOLDER = ".monocle"
|
|
17
18
|
|
|
18
19
|
class FileSpanExporter(SpanExporterBase):
|
|
19
20
|
def __init__(
|
|
20
21
|
self,
|
|
21
22
|
service_name: Optional[str] = None,
|
|
22
|
-
out_path:str = ".",
|
|
23
|
+
out_path:str = path.join(".", DEFAULT_TRACE_FOLDER),
|
|
23
24
|
file_prefix = DEFAULT_FILE_PREFIX,
|
|
24
25
|
time_format = DEFAULT_TIME_FORMAT,
|
|
25
26
|
formatter: Callable[
|
|
@@ -34,12 +35,16 @@ class FileSpanExporter(SpanExporterBase):
|
|
|
34
35
|
self.formatter = formatter
|
|
35
36
|
self.service_name = service_name
|
|
36
37
|
self.output_path = os.getenv("MONOCLE_TRACE_OUTPUT_PATH", out_path)
|
|
38
|
+
if not os.path.exists(self.output_path):
|
|
39
|
+
os.makedirs(self.output_path)
|
|
37
40
|
self.file_prefix = file_prefix
|
|
38
41
|
self.time_format = time_format
|
|
39
42
|
self.task_processor = task_processor
|
|
40
43
|
self.is_first_span_in_file = True # Track if this is the first span in the current file
|
|
41
44
|
if self.task_processor is not None:
|
|
42
45
|
self.task_processor.start()
|
|
46
|
+
self.last_file_processed:str = None
|
|
47
|
+
self.last_trace_id = None
|
|
43
48
|
|
|
44
49
|
def export(self, spans: Sequence[ReadableSpan]) -> SpanExportResult:
|
|
45
50
|
is_root_span = any(not span.parent for span in spans)
|
|
@@ -96,6 +101,8 @@ class FileSpanExporter(SpanExporterBase):
|
|
|
96
101
|
print(f"Error closing file {file_path}: {e}")
|
|
97
102
|
finally:
|
|
98
103
|
del self.file_handles[trace_id]
|
|
104
|
+
self.last_file_processed = file_path
|
|
105
|
+
self.last_trace_id = trace_id
|
|
99
106
|
|
|
100
107
|
def _mark_span_written(self, trace_id: int) -> None:
|
|
101
108
|
"""Mark that a span has been written for this trace (no longer first span)."""
|
|
@@ -26,6 +26,7 @@ WORKFLOW_TYPE_MAP = {
|
|
|
26
26
|
"anthropic": "workflow.anthropic",
|
|
27
27
|
"gemini": "workflow.gemini",
|
|
28
28
|
"litellm": "workflow.litellm",
|
|
29
|
+
"mistralai": "workflow.mistral"
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
FRAMEWORK_WORKFLOW_LIST = [
|
|
@@ -185,7 +186,12 @@ class SpanHandler:
|
|
|
185
186
|
accessor = attribute.get("accessor")
|
|
186
187
|
if accessor:
|
|
187
188
|
try:
|
|
188
|
-
|
|
189
|
+
try:
|
|
190
|
+
result = accessor(arguments)
|
|
191
|
+
except MonocleSpanException as e:
|
|
192
|
+
span.set_status(StatusCode.ERROR, e.message)
|
|
193
|
+
detected_error = True
|
|
194
|
+
result = e.get_err_code()
|
|
189
195
|
if result and isinstance(result, dict):
|
|
190
196
|
result = dict((key, value) for key, value in result.items() if value is not None)
|
|
191
197
|
if result and isinstance(result, (int, str, list, dict)):
|
|
@@ -193,9 +199,6 @@ class SpanHandler:
|
|
|
193
199
|
event_attributes[attribute_key] = result
|
|
194
200
|
else:
|
|
195
201
|
event_attributes.update(result)
|
|
196
|
-
except MonocleSpanException as e:
|
|
197
|
-
span.set_status(StatusCode.ERROR, e.message)
|
|
198
|
-
detected_error = True
|
|
199
202
|
except Exception as e:
|
|
200
203
|
logger.debug(f"Error evaluating accessor for attribute '{attribute_key}': {e}")
|
|
201
204
|
matching_timestamp = getattr(ret_result, "timestamps", {}).get(event_name, None)
|
|
@@ -30,7 +30,7 @@ except Exception as e:
|
|
|
30
30
|
logger.warning("Exception finding monocle-apptrace version.")
|
|
31
31
|
|
|
32
32
|
class MonocleSpanException(Exception):
|
|
33
|
-
def __init__(self, err_message:str):
|
|
33
|
+
def __init__(self, err_message:str, err_code:str = None):
|
|
34
34
|
"""
|
|
35
35
|
Monocle exeption to indicate error in span processing.
|
|
36
36
|
Parameters:
|
|
@@ -39,10 +39,15 @@ class MonocleSpanException(Exception):
|
|
|
39
39
|
"""
|
|
40
40
|
super().__init__(err_message)
|
|
41
41
|
self.message = err_message
|
|
42
|
+
self.err_code = err_code
|
|
42
43
|
|
|
43
44
|
def __str__(self):
|
|
44
45
|
"""String representation of the exception."""
|
|
45
|
-
return f"[Monocle Span Error: {self.message}
|
|
46
|
+
return f"[Monocle Span Error: {self.message}"
|
|
47
|
+
|
|
48
|
+
def get_err_code(self):
|
|
49
|
+
"""Retrieve the error code."""
|
|
50
|
+
return self.err_code
|
|
46
51
|
|
|
47
52
|
def set_span_attribute(span, name, value):
|
|
48
53
|
if value is not None:
|
|
@@ -98,6 +103,7 @@ def with_tracer_wrapper(func):
|
|
|
98
103
|
|
|
99
104
|
return _with_tracer
|
|
100
105
|
|
|
106
|
+
|
|
101
107
|
def resolve_from_alias(my_map, alias):
|
|
102
108
|
"""Find a alias that is not none from list of aliases"""
|
|
103
109
|
|
|
@@ -393,6 +399,7 @@ def get_exception_message(arguments):
|
|
|
393
399
|
else:
|
|
394
400
|
return ''
|
|
395
401
|
|
|
402
|
+
|
|
396
403
|
def get_error_message(arguments):
|
|
397
404
|
status_code = get_status_code(arguments)
|
|
398
405
|
if status_code == 'success':
|
|
@@ -400,6 +407,7 @@ def get_error_message(arguments):
|
|
|
400
407
|
else:
|
|
401
408
|
return status_code
|
|
402
409
|
|
|
410
|
+
|
|
403
411
|
def get_status_code(arguments):
|
|
404
412
|
if arguments["exception"] is not None:
|
|
405
413
|
return get_exception_status_code(arguments)
|
|
@@ -37,6 +37,7 @@ from monocle_apptrace.instrumentation.metamodel.mcp.mcp_processor import MCPAgen
|
|
|
37
37
|
from monocle_apptrace.instrumentation.metamodel.a2a.methods import A2A_CLIENT_METHODS
|
|
38
38
|
from monocle_apptrace.instrumentation.metamodel.litellm.methods import LITELLM_METHODS
|
|
39
39
|
from monocle_apptrace.instrumentation.metamodel.adk.methods import ADK_METHODS
|
|
40
|
+
from monocle_apptrace.instrumentation.metamodel.mistral.methods import MISTRAL_METHODS
|
|
40
41
|
|
|
41
42
|
class WrapperMethod:
|
|
42
43
|
def __init__(
|
|
@@ -107,7 +108,8 @@ DEFAULT_METHODS_LIST = (
|
|
|
107
108
|
MCP_METHODS +
|
|
108
109
|
A2A_CLIENT_METHODS +
|
|
109
110
|
LITELLM_METHODS +
|
|
110
|
-
ADK_METHODS
|
|
111
|
+
ADK_METHODS +
|
|
112
|
+
MISTRAL_METHODS
|
|
111
113
|
)
|
|
112
114
|
|
|
113
115
|
MONOCLE_SPAN_HANDLERS: Dict[str, SpanHandler] = {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
from monocle_apptrace.instrumentation.common.constants import SPAN_SUBTYPES, SPAN_TYPES
|
|
2
|
+
from monocle_apptrace.instrumentation.common.utils import get_error_message
|
|
2
3
|
from monocle_apptrace.instrumentation.metamodel.adk import _helper
|
|
3
4
|
AGENT = {
|
|
4
5
|
"type": SPAN_TYPES.AGENTIC_INVOCATION,
|
|
@@ -45,6 +46,10 @@ AGENT = {
|
|
|
45
46
|
"_comment": "this is response from LLM",
|
|
46
47
|
"attribute": "response",
|
|
47
48
|
"accessor": lambda arguments: _helper.extract_agent_response(arguments['result'])
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"attribute": "error_code",
|
|
52
|
+
"accessor": lambda arguments: get_error_message(arguments)
|
|
48
53
|
}
|
|
49
54
|
]
|
|
50
55
|
}
|
|
@@ -108,4 +113,4 @@ DELEGATION = {
|
|
|
108
113
|
}
|
|
109
114
|
]
|
|
110
115
|
]
|
|
111
|
-
}
|
|
116
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
from monocle_apptrace.instrumentation.common.constants import SPAN_SUBTYPES, SPAN_TYPES
|
|
2
|
+
from monocle_apptrace.instrumentation.common.utils import get_error_message
|
|
2
3
|
from monocle_apptrace.instrumentation.metamodel.adk import _helper
|
|
3
4
|
TOOL = {
|
|
4
5
|
"type": SPAN_TYPES.AGENTIC_TOOL_INVOCATION,
|
|
@@ -40,7 +41,7 @@ TOOL = {
|
|
|
40
41
|
"attributes": [
|
|
41
42
|
{
|
|
42
43
|
"_comment": "this is Tool input",
|
|
43
|
-
"attribute": "
|
|
44
|
+
"attribute": "input",
|
|
44
45
|
"accessor": lambda arguments: _helper.extract_tool_input(arguments)
|
|
45
46
|
},
|
|
46
47
|
]
|
|
@@ -52,8 +53,12 @@ TOOL = {
|
|
|
52
53
|
"_comment": "this is response from Tool",
|
|
53
54
|
"attribute": "response",
|
|
54
55
|
"accessor": lambda arguments: _helper.extract_tool_response(arguments['result'])
|
|
55
|
-
}
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"attribute": "error_code",
|
|
59
|
+
"accessor": lambda arguments: get_error_message(arguments)
|
|
60
|
+
},
|
|
56
61
|
]
|
|
57
62
|
}
|
|
58
63
|
]
|
|
59
|
-
}
|
|
64
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
from monocle_apptrace.instrumentation.common.constants import AGENT_REQUEST_SPAN_NAME, SPAN_SUBTYPES, SPAN_TYPES
|
|
2
|
+
from monocle_apptrace.instrumentation.common.utils import get_error_message
|
|
2
3
|
from monocle_apptrace.instrumentation.metamodel.agents import _helper
|
|
3
4
|
|
|
4
5
|
AGENT = {
|
|
@@ -50,6 +51,10 @@ AGENT = {
|
|
|
50
51
|
"accessor": lambda arguments: _helper.extract_agent_response(
|
|
51
52
|
arguments["result"]
|
|
52
53
|
),
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"attribute": "error_code",
|
|
57
|
+
"accessor": lambda arguments: get_error_message(arguments)
|
|
53
58
|
}
|
|
54
59
|
],
|
|
55
60
|
},
|
|
@@ -101,8 +106,11 @@ AGENT_REQUEST = {
|
|
|
101
106
|
"accessor": lambda arguments: _helper.extract_agent_response(
|
|
102
107
|
arguments["result"]
|
|
103
108
|
),
|
|
104
|
-
|
|
105
|
-
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"attribute": "error_code",
|
|
112
|
+
"accessor": lambda arguments: get_error_message(arguments)
|
|
113
|
+
}],
|
|
106
114
|
},
|
|
107
115
|
],
|
|
108
116
|
}
|
|
@@ -151,7 +159,7 @@ TOOLS = {
|
|
|
151
159
|
"attributes": [
|
|
152
160
|
{
|
|
153
161
|
"_comment": "this is Tool input",
|
|
154
|
-
"attribute": "
|
|
162
|
+
"attribute": "input",
|
|
155
163
|
"accessor": lambda arguments: _helper.extract_tool_input(arguments),
|
|
156
164
|
},
|
|
157
165
|
],
|
|
@@ -165,6 +173,10 @@ TOOLS = {
|
|
|
165
173
|
"accessor": lambda arguments: _helper.extract_tool_response(
|
|
166
174
|
arguments["result"]
|
|
167
175
|
),
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
"attribute": "error_code",
|
|
179
|
+
"accessor": lambda arguments: get_error_message(arguments)
|
|
168
180
|
}
|
|
169
181
|
],
|
|
170
182
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
from threading import local
|
|
3
|
-
from monocle_apptrace.instrumentation.common.utils import extract_http_headers, clear_http_scopes, try_option, Option, MonocleSpanException
|
|
3
|
+
from monocle_apptrace.instrumentation.common.utils import extract_http_headers, clear_http_scopes, get_exception_status_code, try_option, Option, MonocleSpanException
|
|
4
4
|
from monocle_apptrace.instrumentation.common.span_handler import SpanHandler
|
|
5
5
|
from monocle_apptrace.instrumentation.common.constants import HTTP_SUCCESS_CODES
|
|
6
6
|
from urllib.parse import unquote
|
|
@@ -8,7 +8,7 @@ from urllib.parse import unquote
|
|
|
8
8
|
logger = logging.getLogger(__name__)
|
|
9
9
|
MAX_DATA_LENGTH = 1000
|
|
10
10
|
|
|
11
|
-
def
|
|
11
|
+
def get_url(args) -> str:
|
|
12
12
|
route_path: Option[str] = try_option(getattr, args[0], 'path')
|
|
13
13
|
return route_path.unwrap_or("")
|
|
14
14
|
|
|
@@ -31,11 +31,17 @@ def extract_response(result) -> str:
|
|
|
31
31
|
response = ""
|
|
32
32
|
return response
|
|
33
33
|
|
|
34
|
-
def extract_status(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
def extract_status(arguments) -> str:
|
|
35
|
+
if arguments["exception"] is not None:
|
|
36
|
+
return get_exception_status_code(arguments)
|
|
37
|
+
result = arguments['result']
|
|
38
|
+
if hasattr(result, 'status'):
|
|
39
|
+
status = f"{result.status}"
|
|
40
|
+
if status not in HTTP_SUCCESS_CODES:
|
|
41
|
+
error_message = extract_response(result)
|
|
42
|
+
raise MonocleSpanException(f"error: {status} - {error_message}", status)
|
|
43
|
+
else:
|
|
44
|
+
status = "success"
|
|
39
45
|
return status
|
|
40
46
|
|
|
41
47
|
def aiohttp_pre_tracing(args):
|
|
@@ -49,6 +55,15 @@ def aiohttp_skip_span(args) -> bool:
|
|
|
49
55
|
return True
|
|
50
56
|
return False
|
|
51
57
|
|
|
58
|
+
def get_route(args) -> str:
|
|
59
|
+
try:
|
|
60
|
+
return args[0].match_info.route.resource.canonical
|
|
61
|
+
except Exception as e:
|
|
62
|
+
return get_url(args)
|
|
63
|
+
|
|
64
|
+
def get_function_name(args) -> str:
|
|
65
|
+
return args[0].match_info.handler.__name__
|
|
66
|
+
|
|
52
67
|
class aiohttpSpanHandler(SpanHandler):
|
|
53
68
|
|
|
54
69
|
def pre_tracing(self, to_wrap, wrapped, instance, args, kwargs):
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from monocle_apptrace.instrumentation.common.constants import SPAN_TYPES
|
|
2
2
|
from monocle_apptrace.instrumentation.metamodel.aiohttp import _helper
|
|
3
|
+
|
|
3
4
|
AIO_HTTP_PROCESSOR = {
|
|
4
5
|
"type": SPAN_TYPES.HTTP_PROCESS,
|
|
5
6
|
"attributes": [
|
|
@@ -14,11 +15,21 @@ AIO_HTTP_PROCESSOR = {
|
|
|
14
15
|
"attribute": "route",
|
|
15
16
|
"accessor": lambda arguments: _helper.get_route(arguments['args'])
|
|
16
17
|
},
|
|
18
|
+
{
|
|
19
|
+
"_comment": "request method, request URI",
|
|
20
|
+
"attribute": "url",
|
|
21
|
+
"accessor": lambda arguments: _helper.get_url(arguments['args'])
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"_comment": "request function name",
|
|
25
|
+
"attribute": "function_name",
|
|
26
|
+
"accessor": lambda arguments: _helper.get_function_name(arguments['args'])
|
|
27
|
+
},
|
|
17
28
|
{
|
|
18
29
|
"_comment": "request method, request URI",
|
|
19
30
|
"attribute": "body",
|
|
20
31
|
"accessor": lambda arguments: _helper.get_body(arguments['args'])
|
|
21
|
-
}
|
|
32
|
+
}
|
|
22
33
|
]
|
|
23
34
|
],
|
|
24
35
|
"events": [
|
|
@@ -37,8 +48,8 @@ AIO_HTTP_PROCESSOR = {
|
|
|
37
48
|
"attributes": [
|
|
38
49
|
{
|
|
39
50
|
"_comment": "status from HTTP response",
|
|
40
|
-
"attribute": "
|
|
41
|
-
"accessor": lambda arguments: _helper.extract_status(arguments
|
|
51
|
+
"attribute": "error_code",
|
|
52
|
+
"accessor": lambda arguments: _helper.extract_status(arguments)
|
|
42
53
|
},
|
|
43
54
|
{
|
|
44
55
|
"_comment": "this is result from LLM",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
from threading import local
|
|
3
|
-
from monocle_apptrace.instrumentation.common.utils import extract_http_headers, clear_http_scopes, try_option, Option, MonocleSpanException
|
|
3
|
+
from monocle_apptrace.instrumentation.common.utils import extract_http_headers, clear_http_scopes, get_exception_status_code, try_option, Option, MonocleSpanException
|
|
4
4
|
from monocle_apptrace.instrumentation.common.span_handler import SpanHandler
|
|
5
5
|
from monocle_apptrace.instrumentation.common.constants import HTTP_SUCCESS_CODES
|
|
6
6
|
from urllib.parse import unquote, urlparse, ParseResult
|
|
@@ -13,7 +13,7 @@ def get_url(kwargs) -> ParseResult:
|
|
|
13
13
|
url_str = try_option(getattr, kwargs['req'], 'url')
|
|
14
14
|
url = url_str.unwrap_or(None)
|
|
15
15
|
if url is not None:
|
|
16
|
-
return
|
|
16
|
+
return url
|
|
17
17
|
else:
|
|
18
18
|
return None
|
|
19
19
|
|
|
@@ -25,9 +25,11 @@ def get_function_name(kwargs) -> str:
|
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
def get_route(kwargs) -> str:
|
|
28
|
-
|
|
29
|
-
if
|
|
28
|
+
url_str = get_url(kwargs)
|
|
29
|
+
if url_str is not None:
|
|
30
|
+
url: ParseResult = urlparse(url_str)
|
|
30
31
|
return url.path
|
|
32
|
+
return ""
|
|
31
33
|
|
|
32
34
|
def get_method(kwargs) -> str:
|
|
33
35
|
# return args[0]['method'] if 'method' in args[0] else ""
|
|
@@ -35,9 +37,11 @@ def get_method(kwargs) -> str:
|
|
|
35
37
|
return http_method.unwrap_or("")
|
|
36
38
|
|
|
37
39
|
def get_params(kwargs) -> dict:
|
|
38
|
-
|
|
39
|
-
if
|
|
40
|
+
url_str = get_url(kwargs)
|
|
41
|
+
if url_str is not None:
|
|
42
|
+
url: ParseResult = urlparse(url_str)
|
|
40
43
|
return unquote(url.query)
|
|
44
|
+
return {}
|
|
41
45
|
|
|
42
46
|
def get_body(kwargs) -> dict:
|
|
43
47
|
if hasattr(kwargs['req'], 'get_body'):
|
|
@@ -57,11 +61,17 @@ def extract_response(result) -> str:
|
|
|
57
61
|
response = ""
|
|
58
62
|
return response
|
|
59
63
|
|
|
60
|
-
def extract_status(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
64
|
+
def extract_status(arguments) -> str:
|
|
65
|
+
if arguments["exception"] is not None:
|
|
66
|
+
return get_exception_status_code(arguments)
|
|
67
|
+
result = arguments['result']
|
|
68
|
+
if hasattr(result, 'status_code'):
|
|
69
|
+
status = f"{result.status_code}"
|
|
70
|
+
if status not in HTTP_SUCCESS_CODES:
|
|
71
|
+
error_message = extract_response(result)
|
|
72
|
+
raise MonocleSpanException(f"error: {status} - {error_message}", status)
|
|
73
|
+
else:
|
|
74
|
+
status = "success"
|
|
65
75
|
return status
|
|
66
76
|
|
|
67
77
|
def azure_func_pre_tracing(kwargs):
|
|
@@ -23,6 +23,11 @@ AZFUNC_HTTP_PROCESSOR = {
|
|
|
23
23
|
"_comment": "request function name",
|
|
24
24
|
"attribute": "function_name",
|
|
25
25
|
"accessor": lambda arguments: _helper.get_function_name(arguments['kwargs'])
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"_comment": "request function name",
|
|
29
|
+
"attribute": "url",
|
|
30
|
+
"accessor": lambda arguments: _helper.get_url(arguments['kwargs'])
|
|
26
31
|
}
|
|
27
32
|
]
|
|
28
33
|
],
|
|
@@ -42,8 +47,8 @@ AZFUNC_HTTP_PROCESSOR = {
|
|
|
42
47
|
"attributes": [
|
|
43
48
|
{
|
|
44
49
|
"_comment": "status from HTTP response",
|
|
45
|
-
"attribute": "
|
|
46
|
-
"accessor": lambda arguments: _helper.extract_status(arguments
|
|
50
|
+
"attribute": "error_code",
|
|
51
|
+
"accessor": lambda arguments: _helper.extract_status(arguments)
|
|
47
52
|
},
|
|
48
53
|
{
|
|
49
54
|
"_comment": "this is result from LLM",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
from threading import local
|
|
3
|
-
from monocle_apptrace.instrumentation.common.utils import extract_http_headers, clear_http_scopes
|
|
3
|
+
from monocle_apptrace.instrumentation.common.utils import extract_http_headers, clear_http_scopes, get_exception_status_code
|
|
4
4
|
from monocle_apptrace.instrumentation.common.span_handler import SpanHandler
|
|
5
5
|
from monocle_apptrace.instrumentation.common.constants import HTTP_SUCCESS_CODES
|
|
6
6
|
from monocle_apptrace.instrumentation.common.utils import MonocleSpanException
|
|
@@ -15,6 +15,13 @@ MAX_DATA_LENGTH = 1000
|
|
|
15
15
|
token_data = local()
|
|
16
16
|
token_data.current_token = None
|
|
17
17
|
|
|
18
|
+
def get_url(args) -> str:
|
|
19
|
+
server = args.get('server', ('127.0.0.1', 80))
|
|
20
|
+
host, port = server
|
|
21
|
+
path = args.get('path', '/')
|
|
22
|
+
scheme = args.get('scheme', 'http')
|
|
23
|
+
return f"{scheme}://{host}:{port}{path}"
|
|
24
|
+
|
|
18
25
|
def get_route(scope) -> str:
|
|
19
26
|
return scope.get('path', '')
|
|
20
27
|
|
|
@@ -42,11 +49,17 @@ def extract_response(response) -> str:
|
|
|
42
49
|
logger.warning(f"Error extracting response: {e}")
|
|
43
50
|
return ""
|
|
44
51
|
|
|
45
|
-
def extract_status(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
52
|
+
def extract_status(arguments) -> str:
|
|
53
|
+
if arguments["exception"] is not None:
|
|
54
|
+
return get_exception_status_code(arguments)
|
|
55
|
+
instance = arguments['instance']
|
|
56
|
+
if hasattr(instance, 'status_code'):
|
|
57
|
+
status = f"{instance.status_code}"
|
|
58
|
+
if status not in HTTP_SUCCESS_CODES:
|
|
59
|
+
error_message = extract_response(instance)
|
|
60
|
+
raise MonocleSpanException(f"error: {status} - {error_message}", status)
|
|
61
|
+
else:
|
|
62
|
+
status = "success"
|
|
50
63
|
return status
|
|
51
64
|
|
|
52
65
|
def fastapi_pre_tracing(scope):
|
|
@@ -13,6 +13,10 @@ FASTAPI_HTTP_PROCESSOR = {
|
|
|
13
13
|
"attribute": "route",
|
|
14
14
|
"accessor": lambda arguments: _helper.get_route(arguments['args'][0])
|
|
15
15
|
},
|
|
16
|
+
{
|
|
17
|
+
"attribute": "url",
|
|
18
|
+
"accessor": lambda arguments: _helper.get_url(arguments['args'][0])
|
|
19
|
+
},
|
|
16
20
|
]
|
|
17
21
|
]
|
|
18
22
|
}
|
|
@@ -32,8 +36,8 @@ FASTAPI_RESPONSE_PROCESSOR = {
|
|
|
32
36
|
"name": "data.output",
|
|
33
37
|
"attributes": [
|
|
34
38
|
{
|
|
35
|
-
"attribute": "
|
|
36
|
-
"accessor": lambda arguments: _helper.extract_status(arguments
|
|
39
|
+
"attribute": "error_code",
|
|
40
|
+
"accessor": lambda arguments: _helper.extract_status(arguments)
|
|
37
41
|
},
|
|
38
42
|
{
|
|
39
43
|
"attribute": "response",
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
from monocle_apptrace.instrumentation.common.wrapper import atask_wrapper
|
|
1
|
+
from monocle_apptrace.instrumentation.common.wrapper import atask_wrapper,task_wrapper
|
|
2
2
|
from monocle_apptrace.instrumentation.metamodel.fastapi.entities.http import FASTAPI_HTTP_PROCESSOR, FASTAPI_RESPONSE_PROCESSOR
|
|
3
3
|
|
|
4
4
|
FASTAPI_METHODS = [
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
5
|
+
{
|
|
6
|
+
"package": "fastapi",
|
|
7
|
+
"object": "FastAPI",
|
|
8
|
+
"method": "__call__",
|
|
9
|
+
"wrapper_method": task_wrapper,
|
|
10
|
+
"span_name": "fastapi.request",
|
|
11
|
+
"span_handler": "fastapi_handler",
|
|
12
|
+
"output_processor": FASTAPI_HTTP_PROCESSOR,
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"package": "starlette.responses",
|
|
16
|
+
"object": "Response",
|
|
17
|
+
"method": "__call__",
|
|
18
|
+
"span_name": "fastapi.response",
|
|
19
|
+
"wrapper_method": task_wrapper,
|
|
20
|
+
"span_handler": "fastapi_response_handler",
|
|
21
|
+
"output_processor": FASTAPI_RESPONSE_PROCESSOR
|
|
22
|
+
}
|
|
23
23
|
]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
from threading import local
|
|
3
|
-
from monocle_apptrace.instrumentation.common.utils import extract_http_headers, clear_http_scopes
|
|
3
|
+
from monocle_apptrace.instrumentation.common.utils import extract_http_headers, clear_http_scopes, get_exception_status_code
|
|
4
4
|
from monocle_apptrace.instrumentation.common.span_handler import SpanHandler
|
|
5
5
|
from monocle_apptrace.instrumentation.common.constants import HTTP_SUCCESS_CODES
|
|
6
6
|
from monocle_apptrace.instrumentation.common.utils import MonocleSpanException
|
|
@@ -22,6 +22,14 @@ def get_params(args) -> dict:
|
|
|
22
22
|
params = args[0]['QUERY_STRING'] if 'QUERY_STRING' in args[0] else ""
|
|
23
23
|
return unquote(params)
|
|
24
24
|
|
|
25
|
+
def get_url(args) -> str:
|
|
26
|
+
url = ""
|
|
27
|
+
if len(args) > 1 or not isinstance(args[0], dict):
|
|
28
|
+
if 'HTTP_HOST' in args[0]:
|
|
29
|
+
url = f"http://{args[0]['HTTP_HOST']}{args[0].get('REQUEST_URI', '')}"
|
|
30
|
+
|
|
31
|
+
return url
|
|
32
|
+
|
|
25
33
|
def get_body(args) -> dict:
|
|
26
34
|
return ""
|
|
27
35
|
|
|
@@ -32,11 +40,17 @@ def extract_response(instance) -> str:
|
|
|
32
40
|
response = ""
|
|
33
41
|
return response
|
|
34
42
|
|
|
35
|
-
def extract_status(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
43
|
+
def extract_status(arguments) -> str:
|
|
44
|
+
if arguments["exception"] is not None:
|
|
45
|
+
return get_exception_status_code(arguments)
|
|
46
|
+
instance = arguments['instance']
|
|
47
|
+
if hasattr(instance, 'status_code'):
|
|
48
|
+
status = f"{instance.status_code}"
|
|
49
|
+
if status not in HTTP_SUCCESS_CODES:
|
|
50
|
+
error_message = extract_response(instance)
|
|
51
|
+
raise MonocleSpanException(f"error: {status} - {error_message}", status)
|
|
52
|
+
else:
|
|
53
|
+
status = "success"
|
|
40
54
|
return status
|
|
41
55
|
|
|
42
56
|
def flask_pre_tracing(args):
|
|
@@ -14,6 +14,11 @@ FLASK_HTTP_PROCESSOR = {
|
|
|
14
14
|
"attribute": "route",
|
|
15
15
|
"accessor": lambda arguments: _helper.get_route(arguments['args'])
|
|
16
16
|
},
|
|
17
|
+
{
|
|
18
|
+
"_comment": "request method, request URI",
|
|
19
|
+
"attribute": "url",
|
|
20
|
+
"accessor": lambda arguments: _helper.get_url(arguments['args'])
|
|
21
|
+
},
|
|
17
22
|
]
|
|
18
23
|
]
|
|
19
24
|
}
|
|
@@ -35,8 +40,8 @@ FLASK_RESPONSE_PROCESSOR = {
|
|
|
35
40
|
"attributes": [
|
|
36
41
|
{
|
|
37
42
|
"_comment": "status from HTTP response",
|
|
38
|
-
"attribute": "
|
|
39
|
-
"accessor": lambda arguments: _helper.extract_status(arguments
|
|
43
|
+
"attribute": "error_code",
|
|
44
|
+
"accessor": lambda arguments: _helper.extract_status(arguments)
|
|
40
45
|
},
|
|
41
46
|
{
|
|
42
47
|
"_comment": "this is result from LLM",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
from threading import local
|
|
3
|
-
from
|
|
3
|
+
from unittest import result
|
|
4
|
+
from monocle_apptrace.instrumentation.common.utils import extract_http_headers, clear_http_scopes, get_exception_status_code, try_option, Option, \
|
|
4
5
|
MonocleSpanException
|
|
5
6
|
from monocle_apptrace.instrumentation.common.span_handler import SpanHandler
|
|
6
7
|
from monocle_apptrace.instrumentation.common.constants import HTTP_SUCCESS_CODES
|
|
@@ -11,13 +12,18 @@ MAX_DATA_LENGTH = 1000
|
|
|
11
12
|
token_data = local()
|
|
12
13
|
token_data.current_token = None
|
|
13
14
|
|
|
14
|
-
def get_url(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
def get_url(args) -> str:
|
|
16
|
+
event = args[1]
|
|
17
|
+
host = event.get('headers', {}).get('Host', '')
|
|
18
|
+
stage = event.get('requestContext', {}).get('stage', '')
|
|
19
|
+
path = event.get('path', '')
|
|
20
|
+
query_params = event.get('queryStringParameters', {})
|
|
21
|
+
scheme = 'https' if event.get('headers', {}).get('X-Forwarded-Proto', 'http') == 'https' else 'http'
|
|
22
|
+
url = f"{scheme}://{host}/{stage}{path}"
|
|
23
|
+
if query_params:
|
|
24
|
+
from urllib.parse import urlencode
|
|
25
|
+
url += '?' + urlencode(query_params)
|
|
26
|
+
return url
|
|
21
27
|
|
|
22
28
|
def get_route(args) -> str:
|
|
23
29
|
event = args[1]
|
|
@@ -53,14 +59,19 @@ def extract_response(result) -> str:
|
|
|
53
59
|
return response
|
|
54
60
|
|
|
55
61
|
|
|
56
|
-
def extract_status(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
62
|
+
def extract_status(arguments) -> str:
|
|
63
|
+
if arguments["exception"] is not None:
|
|
64
|
+
return get_exception_status_code(arguments)
|
|
65
|
+
result = arguments['result']
|
|
66
|
+
if isinstance(result, dict) and 'statusCode' in result:
|
|
67
|
+
status = f"{result['statusCode']}"
|
|
68
|
+
if status not in HTTP_SUCCESS_CODES:
|
|
69
|
+
error_message = extract_response(result)
|
|
70
|
+
raise MonocleSpanException(f"error: {status} - {error_message}", status)
|
|
71
|
+
else:
|
|
72
|
+
status = "success"
|
|
61
73
|
return status
|
|
62
74
|
|
|
63
|
-
|
|
64
75
|
def lambda_func_pre_tracing(kwargs):
|
|
65
76
|
headers = kwargs['event'].get('headers', {}) if 'event' in kwargs else {}
|
|
66
77
|
return extract_http_headers(headers)
|
|
@@ -19,6 +19,11 @@ LAMBDA_HTTP_PROCESSOR = {
|
|
|
19
19
|
"attribute": "body",
|
|
20
20
|
"accessor": lambda arguments: _helper.get_body(arguments['args'])
|
|
21
21
|
},
|
|
22
|
+
{
|
|
23
|
+
"_comment": "request method, request URI",
|
|
24
|
+
"attribute": "url",
|
|
25
|
+
"accessor": lambda arguments: _helper.get_url(arguments['args'])
|
|
26
|
+
},
|
|
22
27
|
]
|
|
23
28
|
],
|
|
24
29
|
"events": [
|
|
@@ -37,8 +42,8 @@ LAMBDA_HTTP_PROCESSOR = {
|
|
|
37
42
|
"attributes": [
|
|
38
43
|
{
|
|
39
44
|
"_comment": "status from HTTP response",
|
|
40
|
-
"attribute": "
|
|
41
|
-
"accessor": lambda arguments: _helper.extract_status(arguments
|
|
45
|
+
"attribute": "error_code",
|
|
46
|
+
"accessor": lambda arguments: _helper.extract_status(arguments)
|
|
42
47
|
},
|
|
43
48
|
{
|
|
44
49
|
"_comment": "this is result from LLM",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
from monocle_apptrace.instrumentation.common.constants import SPAN_SUBTYPES, SPAN_TYPES
|
|
2
|
+
from monocle_apptrace.instrumentation.common.utils import get_error_message
|
|
2
3
|
from monocle_apptrace.instrumentation.metamodel.mcp import _helper
|
|
3
4
|
|
|
4
5
|
TOOLS = {
|
|
@@ -44,6 +45,10 @@ TOOLS = {
|
|
|
44
45
|
"attribute": "output",
|
|
45
46
|
"accessor": lambda arguments: _helper.get_output_text(arguments)
|
|
46
47
|
},
|
|
48
|
+
{
|
|
49
|
+
"attribute": "error_code",
|
|
50
|
+
"accessor": lambda arguments: get_error_message(arguments)
|
|
51
|
+
}
|
|
47
52
|
],
|
|
48
53
|
},
|
|
49
54
|
],
|
|
File without changes
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module provides utility functions for extracting system, user,
|
|
3
|
+
and assistant messages from various input formats.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
import json
|
|
7
|
+
import logging
|
|
8
|
+
from opentelemetry.context import get_value
|
|
9
|
+
from monocle_apptrace.instrumentation.common.utils import (
|
|
10
|
+
Option,
|
|
11
|
+
get_json_dumps,
|
|
12
|
+
get_keys_as_tuple,
|
|
13
|
+
get_nested_value,
|
|
14
|
+
get_status_code,
|
|
15
|
+
try_option,
|
|
16
|
+
get_exception_message,
|
|
17
|
+
)
|
|
18
|
+
from monocle_apptrace.instrumentation.metamodel.finish_types import map_anthropic_finish_reason_to_finish_type
|
|
19
|
+
from monocle_apptrace.instrumentation.common.constants import AGENT_PREFIX_KEY, INFERENCE_AGENT_DELEGATION, INFERENCE_TURN_END, INFERENCE_TOOL_CALL
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
logger = logging.getLogger(__name__)
|
|
23
|
+
|
|
24
|
+
def extract_provider_name(instance):
|
|
25
|
+
provider_url: Option[str] = try_option(getattr, instance._client.base_url, 'host')
|
|
26
|
+
return provider_url.unwrap_or(None)
|
|
27
|
+
|
|
28
|
+
def extract_inference_endpoint(instance):
|
|
29
|
+
inference_endpoint: Option[str] = try_option(getattr, instance._client, 'base_url').map(str)
|
|
30
|
+
if inference_endpoint.is_none() and "meta" in instance.client.__dict__:
|
|
31
|
+
inference_endpoint = try_option(getattr, instance.client.meta, 'endpoint_url').map(str)
|
|
32
|
+
|
|
33
|
+
return inference_endpoint.unwrap_or(extract_provider_name(instance))
|
|
34
|
+
|
|
35
|
+
def dummy_method(arguents):
|
|
36
|
+
pass
|
|
37
|
+
|
|
38
|
+
def extract_messages(kwargs):
|
|
39
|
+
"""Extract system and user messages"""
|
|
40
|
+
try:
|
|
41
|
+
messages = []
|
|
42
|
+
if "system" in kwargs and isinstance(kwargs["system"], str):
|
|
43
|
+
messages.append({"system": kwargs["system"]})
|
|
44
|
+
if 'messages' in kwargs and len(kwargs['messages']) >0:
|
|
45
|
+
for msg in kwargs['messages']:
|
|
46
|
+
if msg.get('content') and msg.get('role'):
|
|
47
|
+
messages.append({msg['role']: msg['content']})
|
|
48
|
+
return [get_json_dumps(message) for message in messages]
|
|
49
|
+
except Exception as e:
|
|
50
|
+
logger.warning("Warning: Error occurred in extract_messages: %s", str(e))
|
|
51
|
+
return []
|
|
52
|
+
|
|
53
|
+
def get_exception_status_code(arguments):
|
|
54
|
+
exc = arguments.get("exception")
|
|
55
|
+
if exc is not None and hasattr(exc, "status_code"):
|
|
56
|
+
if exc.status_code == 401:
|
|
57
|
+
return "unauthorized"
|
|
58
|
+
elif exc.status_code == 403:
|
|
59
|
+
return "forbidden"
|
|
60
|
+
elif exc.status_code == 404:
|
|
61
|
+
return "not_found"
|
|
62
|
+
else:
|
|
63
|
+
return str(exc.status_code)
|
|
64
|
+
elif exc is not None:
|
|
65
|
+
return "error"
|
|
66
|
+
else:
|
|
67
|
+
return "success"
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def extract_assistant_message(arguments):
|
|
71
|
+
"""
|
|
72
|
+
Extract the assistant message from a Mistral response or stream chunks.
|
|
73
|
+
Returns a JSON string like {"assistant": "<text>"}.
|
|
74
|
+
"""
|
|
75
|
+
try:
|
|
76
|
+
result = arguments.get("result")
|
|
77
|
+
if result is None:
|
|
78
|
+
return ""
|
|
79
|
+
|
|
80
|
+
# Handle full response
|
|
81
|
+
if hasattr(result, "choices") and result.choices:
|
|
82
|
+
msg_obj = result.choices[0].message
|
|
83
|
+
return get_json_dumps({msg_obj.role: msg_obj.content})
|
|
84
|
+
|
|
85
|
+
# Handle streaming: result might be a list of CompletionEvent chunks
|
|
86
|
+
if isinstance(result, list):
|
|
87
|
+
content = []
|
|
88
|
+
for chunk in result:
|
|
89
|
+
# Each chunk may have delta attribute
|
|
90
|
+
if hasattr(chunk, "delta") and hasattr(chunk.delta, "content"):
|
|
91
|
+
content.append(chunk.delta.content or "")
|
|
92
|
+
return get_json_dumps({"assistant": "".join(content)})
|
|
93
|
+
|
|
94
|
+
return ""
|
|
95
|
+
|
|
96
|
+
except Exception as e:
|
|
97
|
+
logger.warning("Warning in extract_assistant_message: %s", str(e))
|
|
98
|
+
return ""
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def update_span_from_llm_response(response):
|
|
103
|
+
meta_dict = {}
|
|
104
|
+
if response is not None and hasattr(response, "usage"):
|
|
105
|
+
if hasattr(response, "usage") and response.usage is not None:
|
|
106
|
+
token_usage = response.usage
|
|
107
|
+
else:
|
|
108
|
+
response_metadata = response.response_metadata
|
|
109
|
+
token_usage = response_metadata.get("token_usage")
|
|
110
|
+
if token_usage is not None:
|
|
111
|
+
meta_dict.update({"completion_tokens": getattr(response.usage, "output_tokens", 0)})
|
|
112
|
+
meta_dict.update({"prompt_tokens": getattr(response.usage, "input_tokens", 0)})
|
|
113
|
+
meta_dict.update({"total_tokens": getattr(response.usage, "input_tokens", 0)+getattr(response.usage, "output_tokens", 0)})
|
|
114
|
+
return meta_dict
|
|
115
|
+
|
|
116
|
+
def extract_finish_reason(arguments):
|
|
117
|
+
"""Extract stop_reason from Anthropic response (Claude)."""
|
|
118
|
+
try:
|
|
119
|
+
# Arguments may be a dict with 'result' or just the response object
|
|
120
|
+
response = arguments.get("result") if isinstance(arguments, dict) else arguments
|
|
121
|
+
if response is not None and hasattr(response, "stop_reason"):
|
|
122
|
+
return response.stop_reason
|
|
123
|
+
except Exception as e:
|
|
124
|
+
logger.warning("Warning: Error occurred in extract_finish_reason: %s", str(e))
|
|
125
|
+
return None
|
|
126
|
+
return None
|
|
127
|
+
|
|
128
|
+
def map_finish_reason_to_finish_type(finish_reason):
|
|
129
|
+
"""Map Anthropic stop_reason to finish_type, similar to OpenAI mapping."""
|
|
130
|
+
return map_anthropic_finish_reason_to_finish_type(finish_reason)
|
|
131
|
+
|
|
132
|
+
def agent_inference_type(arguments):
|
|
133
|
+
"""Extract agent inference type from Anthropic response"""
|
|
134
|
+
try:
|
|
135
|
+
status = get_status_code(arguments)
|
|
136
|
+
if status == 'success' or status == 'completed':
|
|
137
|
+
response = arguments["result"]
|
|
138
|
+
|
|
139
|
+
# Check if stop_reason indicates tool use
|
|
140
|
+
if hasattr(response, "stop_reason") and response.stop_reason == "tool_use":
|
|
141
|
+
# Check if this is agent delegation by looking at tool names
|
|
142
|
+
if hasattr(response, "content") and response.content:
|
|
143
|
+
agent_prefix = get_value(AGENT_PREFIX_KEY)
|
|
144
|
+
for content_block in response.content:
|
|
145
|
+
if (hasattr(content_block, "type") and
|
|
146
|
+
content_block.type == "tool_use" and
|
|
147
|
+
hasattr(content_block, "name")):
|
|
148
|
+
tool_name = content_block.name
|
|
149
|
+
if agent_prefix and tool_name.startswith(agent_prefix):
|
|
150
|
+
return INFERENCE_AGENT_DELEGATION
|
|
151
|
+
# If we found tool use but no agent delegation, it's a regular tool call
|
|
152
|
+
return INFERENCE_TOOL_CALL
|
|
153
|
+
|
|
154
|
+
# Fallback: check the extracted message for tool content
|
|
155
|
+
assistant_message = extract_assistant_message(arguments)
|
|
156
|
+
if assistant_message:
|
|
157
|
+
try:
|
|
158
|
+
message = json.loads(assistant_message)
|
|
159
|
+
if message and isinstance(message, dict):
|
|
160
|
+
assistant_content = message.get("assistant", "")
|
|
161
|
+
if assistant_content:
|
|
162
|
+
agent_prefix = get_value(AGENT_PREFIX_KEY)
|
|
163
|
+
if agent_prefix and agent_prefix in assistant_content:
|
|
164
|
+
return INFERENCE_AGENT_DELEGATION
|
|
165
|
+
except (json.JSONDecodeError, TypeError):
|
|
166
|
+
# If JSON parsing fails, fall back to string analysis
|
|
167
|
+
agent_prefix = get_value(AGENT_PREFIX_KEY)
|
|
168
|
+
if agent_prefix and agent_prefix in assistant_message:
|
|
169
|
+
return INFERENCE_AGENT_DELEGATION
|
|
170
|
+
|
|
171
|
+
return INFERENCE_TURN_END
|
|
172
|
+
except Exception as e:
|
|
173
|
+
logger.warning("Warning: Error occurred in agent_inference_type: %s", str(e))
|
|
174
|
+
return INFERENCE_TURN_END
|
|
File without changes
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
from monocle_apptrace.instrumentation.common.constants import SPAN_TYPES
|
|
2
|
+
from monocle_apptrace.instrumentation.metamodel.mistral import _helper
|
|
3
|
+
from monocle_apptrace.instrumentation.common.utils import get_error_message, resolve_from_alias
|
|
4
|
+
|
|
5
|
+
MISTRAL_INFERENCE = {
|
|
6
|
+
"type": SPAN_TYPES.INFERENCE,
|
|
7
|
+
"attributes": [
|
|
8
|
+
[
|
|
9
|
+
{
|
|
10
|
+
"_comment": "provider type ,name , deployment , inference_endpoint",
|
|
11
|
+
"attribute": "type",
|
|
12
|
+
"accessor": lambda arguments: 'inference.mistral'
|
|
13
|
+
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"attribute": "provider_name",
|
|
17
|
+
"accessor": lambda arguments: "mistral"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"attribute": "inference_endpoint",
|
|
21
|
+
"accessor": lambda arguments: "https://api.mistral.ai"
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
[
|
|
25
|
+
{
|
|
26
|
+
"_comment": "LLM Model",
|
|
27
|
+
"attribute": "name",
|
|
28
|
+
"accessor": lambda arguments: resolve_from_alias(arguments['kwargs'], ['model', 'model_name', 'endpoint_name', 'deployment_name'])
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"attribute": "type",
|
|
32
|
+
"accessor": lambda arguments: 'model.llm.' + resolve_from_alias(arguments['kwargs'], ['model', 'model_name', 'endpoint_name', 'deployment_name'])
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
],
|
|
36
|
+
"events": [
|
|
37
|
+
{
|
|
38
|
+
"name": "data.input",
|
|
39
|
+
"attributes": [
|
|
40
|
+
{
|
|
41
|
+
"_comment": "this is instruction and user query to LLM",
|
|
42
|
+
"attribute": "input",
|
|
43
|
+
"accessor": lambda arguments: _helper.extract_messages(arguments['kwargs'])
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"name": "data.output",
|
|
49
|
+
"attributes": [
|
|
50
|
+
{
|
|
51
|
+
"attribute": "error_code",
|
|
52
|
+
"accessor": lambda arguments: get_error_message(arguments)
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"_comment": "this is result from LLM",
|
|
56
|
+
"attribute": "response",
|
|
57
|
+
"accessor": lambda arguments: _helper.extract_assistant_message(arguments)
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"name": "metadata",
|
|
63
|
+
"attributes": [
|
|
64
|
+
{
|
|
65
|
+
"_comment": "this is metadata usage from LLM",
|
|
66
|
+
"accessor": lambda arguments: _helper.update_span_from_llm_response(arguments['result'])
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"_comment": "finish reason from Anthropic response",
|
|
70
|
+
"attribute": "finish_reason",
|
|
71
|
+
"accessor": lambda arguments: _helper.extract_finish_reason(arguments)
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"_comment": "finish type mapped from finish reason",
|
|
75
|
+
"attribute": "finish_type",
|
|
76
|
+
"accessor": lambda arguments: _helper.map_finish_reason_to_finish_type(_helper.extract_finish_reason(arguments))
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"attribute": "inference_sub_type",
|
|
80
|
+
"accessor": lambda arguments: _helper.agent_inference_type(arguments)
|
|
81
|
+
}
|
|
82
|
+
]
|
|
83
|
+
}
|
|
84
|
+
]
|
|
85
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
from monocle_apptrace.instrumentation.common.wrapper import task_wrapper, atask_wrapper
|
|
2
|
+
from monocle_apptrace.instrumentation.metamodel.mistral.entities.inference import MISTRAL_INFERENCE
|
|
3
|
+
|
|
4
|
+
MISTRAL_METHODS = [
|
|
5
|
+
{
|
|
6
|
+
"package": "mistralai.chat", # where Chat is defined
|
|
7
|
+
"object": "Chat", # class name
|
|
8
|
+
"method": "complete", # the sync method
|
|
9
|
+
"span_handler": "non_framework_handler",
|
|
10
|
+
"wrapper_method": task_wrapper,
|
|
11
|
+
"output_processor": MISTRAL_INFERENCE
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"package": "mistralai.chat", # where Chat is defined
|
|
15
|
+
"object": "Chat", # class name
|
|
16
|
+
"method": "complete_async", # the async method
|
|
17
|
+
"span_handler": "non_framework_handler",
|
|
18
|
+
"wrapper_method": atask_wrapper,
|
|
19
|
+
"output_processor": MISTRAL_INFERENCE
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"package": "mistralai.chat",
|
|
23
|
+
"object": "Chat",
|
|
24
|
+
"method": "stream", # sync streaming
|
|
25
|
+
"span_handler": "non_framework_handler",
|
|
26
|
+
"wrapper_method": task_wrapper,
|
|
27
|
+
"output_processor": MISTRAL_INFERENCE,
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"package": "mistralai.chat",
|
|
31
|
+
"object": "Chat",
|
|
32
|
+
"method": "stream_async", # async streaming
|
|
33
|
+
"span_handler": "non_framework_handler",
|
|
34
|
+
"wrapper_method": atask_wrapper,
|
|
35
|
+
"output_processor": MISTRAL_INFERENCE,
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
@@ -100,7 +100,7 @@ def status_check(arguments):
|
|
|
100
100
|
if hasattr(arguments["result"], "error") and arguments["result"].error is not None:
|
|
101
101
|
error_msg:str = arguments["result"].error
|
|
102
102
|
error_code:str = arguments["result"].status if hasattr(arguments["result"], "status") else "unknown"
|
|
103
|
-
raise MonocleSpanException(f"Error: {error_code} - {error_msg}")
|
|
103
|
+
raise MonocleSpanException(f"Error: {error_code} - {error_msg}", error_code)
|
|
104
104
|
|
|
105
105
|
def get_prompt_template(arguments):
|
|
106
106
|
pass
|
|
@@ -152,7 +152,7 @@ def extract_status_code(arguments):
|
|
|
152
152
|
def check_status(arguments):
|
|
153
153
|
status = get_status_code(arguments)
|
|
154
154
|
if status != 'success' and arguments['exception'] is None:
|
|
155
|
-
raise MonocleSpanException(f"{status}")
|
|
155
|
+
raise MonocleSpanException(f"{status}", status)
|
|
156
156
|
|
|
157
157
|
def map_finish_reason_to_finish_type(finish_reason):
|
|
158
158
|
"""Map TeamsAI finish_reason to standardized finish_type."""
|
|
@@ -4,7 +4,7 @@ monocle_apptrace/__main__.py,sha256=MLLPbC4YTp8O2wQrn8BROSZGvQpQd5brk_d1n_dWVWA,
|
|
|
4
4
|
monocle_apptrace/mcp_server.py,sha256=X5NFOE1QHkIktykGlRH-bzOnLsby5E9sTRAT-4BOQx0,5591
|
|
5
5
|
monocle_apptrace/exporters/base_exporter.py,sha256=xm2MkDjuVZc-vmSXBMMsNMyIoy4z0O4g6wOAyuEnHwo,2062
|
|
6
6
|
monocle_apptrace/exporters/exporter_processor.py,sha256=-spCIJ_UfJ0fax_jE-ii3ODQBwtnHZgYIGVNd91Q718,6298
|
|
7
|
-
monocle_apptrace/exporters/file_exporter.py,sha256=
|
|
7
|
+
monocle_apptrace/exporters/file_exporter.py,sha256=eBfLKRsAtudHTFd0IRcov5rLK48r95TCL8cqRuj2EG4,8208
|
|
8
8
|
monocle_apptrace/exporters/monocle_exporters.py,sha256=qo6S53dp2ko6EzMP-ICL2buqgmw8HZboy19j7iHp1Qk,2882
|
|
9
9
|
monocle_apptrace/exporters/aws/s3_exporter.py,sha256=9GA2tiWOUBLtDdGIdLLyYJEdQ1jRC5SdxxVH3qqR8Qk,8260
|
|
10
10
|
monocle_apptrace/exporters/aws/s3_exporter_opendal.py,sha256=0aEUxdMgJaDUwqjw0DqlCMr8kjl01KgwUt3_RRCVFds,5917
|
|
@@ -17,11 +17,11 @@ monocle_apptrace/instrumentation/common/constants.py,sha256=dAbIKrfI97oYMKNj5gdP
|
|
|
17
17
|
monocle_apptrace/instrumentation/common/instrumentor.py,sha256=2mxnnxlnBpaJUpIhS2dihIfbmbUEbLN8H2hUtN34c9o,10849
|
|
18
18
|
monocle_apptrace/instrumentation/common/method_wrappers.py,sha256=jC3G_R2YVD0JWCzxx1zNzJbe_BsNhsveVMegJRXA3IQ,10152
|
|
19
19
|
monocle_apptrace/instrumentation/common/scope_wrapper.py,sha256=Ysr4zmb71sZm3R-fNabctnNJHnmLVL9FE-4EmQo3HxA,3927
|
|
20
|
-
monocle_apptrace/instrumentation/common/span_handler.py,sha256=
|
|
20
|
+
monocle_apptrace/instrumentation/common/span_handler.py,sha256=CbTQYkkT2TvzW5k8snOM8dULxp2A5GAoqzmaH3eCgD4,15235
|
|
21
21
|
monocle_apptrace/instrumentation/common/tracing.md,sha256=6Lr8QGxEFHKhj-mMvLV3xjFnplKSs6HEdwl0McPK47M,7577
|
|
22
|
-
monocle_apptrace/instrumentation/common/utils.py,sha256=
|
|
22
|
+
monocle_apptrace/instrumentation/common/utils.py,sha256=hsF1Opoa7kJA9eEWNzYAU88u3JFYMsNQlUilL8fcqiE,15761
|
|
23
23
|
monocle_apptrace/instrumentation/common/wrapper.py,sha256=vbt2650Z3YNcxIvrT3odZ1RHIIeAHrrvYQOqFNUGXHQ,20285
|
|
24
|
-
monocle_apptrace/instrumentation/common/wrapper_method.py,sha256=
|
|
24
|
+
monocle_apptrace/instrumentation/common/wrapper_method.py,sha256=Gohu3z74moELkhaXAonhQXYjn--2dfLdkiHPGvYTiB0,6692
|
|
25
25
|
monocle_apptrace/instrumentation/metamodel/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
26
26
|
monocle_apptrace/instrumentation/metamodel/finish_types.py,sha256=ck-bWfMezrNIkUHy9QpW25cLCmNsjmceYzBzEydm92w,19267
|
|
27
27
|
monocle_apptrace/instrumentation/metamodel/a2a/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -32,27 +32,27 @@ monocle_apptrace/instrumentation/metamodel/a2a/entities/inference.py,sha256=5v37
|
|
|
32
32
|
monocle_apptrace/instrumentation/metamodel/adk/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
33
33
|
monocle_apptrace/instrumentation/metamodel/adk/_helper.py,sha256=mEs8AU1ti9ClWDdKzNGDYdOw_gMqKdbHc39hN7WxFKU,6417
|
|
34
34
|
monocle_apptrace/instrumentation/metamodel/adk/methods.py,sha256=Wp6MJArvLotY2CIAf1PlwJzdcH8qBk7II1KPBRET7c0,917
|
|
35
|
-
monocle_apptrace/instrumentation/metamodel/adk/entities/agent.py,sha256=
|
|
36
|
-
monocle_apptrace/instrumentation/metamodel/adk/entities/tool.py,sha256=
|
|
35
|
+
monocle_apptrace/instrumentation/metamodel/adk/entities/agent.py,sha256=GCwvFyhAocvPzYr_lrQf9MfC9vEEnyg2EhOm2fBvdks,3674
|
|
36
|
+
monocle_apptrace/instrumentation/metamodel/adk/entities/tool.py,sha256=EEZxYM9bdH7KCmO-jnTywXAiN45hel5eAqLyHKZ1BbU,2157
|
|
37
37
|
monocle_apptrace/instrumentation/metamodel/agents/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
38
38
|
monocle_apptrace/instrumentation/metamodel/agents/_helper.py,sha256=bHF3BaJyCli8VFgd-eRxaditoYT5UXLF7a1-zzMafik,7625
|
|
39
39
|
monocle_apptrace/instrumentation/metamodel/agents/agents_processor.py,sha256=P95dNBh18M74Bw-BklwcN3wRfyi4vC3Q9EOcR8QBheg,6194
|
|
40
40
|
monocle_apptrace/instrumentation/metamodel/agents/methods.py,sha256=l7KwBLm_olUfZsN9UxUVc_spvSGLNqBJzKh3cyX40-o,1758
|
|
41
41
|
monocle_apptrace/instrumentation/metamodel/agents/entities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
42
|
-
monocle_apptrace/instrumentation/metamodel/agents/entities/inference.py,sha256=
|
|
42
|
+
monocle_apptrace/instrumentation/metamodel/agents/entities/inference.py,sha256=TYjZU_823EYjIirr9fmjaDzeZjslHj4tVeSgILXvXq0,6617
|
|
43
43
|
monocle_apptrace/instrumentation/metamodel/aiohttp/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
44
|
-
monocle_apptrace/instrumentation/metamodel/aiohttp/_helper.py,sha256=
|
|
44
|
+
monocle_apptrace/instrumentation/metamodel/aiohttp/_helper.py,sha256=6wTmycVbETB0fOc99No2rePVgACKR3J6HCUkaedV0o8,2539
|
|
45
45
|
monocle_apptrace/instrumentation/metamodel/aiohttp/methods.py,sha256=rcfGoRMLJeu-X2O9fGv6nhhjUrBJALKOJ-axiedavMI,435
|
|
46
|
-
monocle_apptrace/instrumentation/metamodel/aiohttp/entities/http.py,sha256=
|
|
46
|
+
monocle_apptrace/instrumentation/metamodel/aiohttp/entities/http.py,sha256=OC7qgaKLUD_otmtP5jNyWcR_D0GGSbBZAxNa6RtQXwE,2201
|
|
47
47
|
monocle_apptrace/instrumentation/metamodel/anthropic/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
48
48
|
monocle_apptrace/instrumentation/metamodel/anthropic/_helper.py,sha256=fuILJFil-Gr2hIDIK-2xlHyibCwVXLbakFgJ2P9AKNE,8615
|
|
49
49
|
monocle_apptrace/instrumentation/metamodel/anthropic/methods.py,sha256=WVXoN_i5h9hXjrJV5xF9wIQIpmP_gCN3P8HEPfAsfik,703
|
|
50
50
|
monocle_apptrace/instrumentation/metamodel/anthropic/entities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
51
51
|
monocle_apptrace/instrumentation/metamodel/anthropic/entities/inference.py,sha256=6mwMs-ZYoS0B4mkUXwy1VFBzJQd8olEwhEqYgUSyVIc,3643
|
|
52
|
-
monocle_apptrace/instrumentation/metamodel/azfunc/_helper.py,sha256=
|
|
52
|
+
monocle_apptrace/instrumentation/metamodel/azfunc/_helper.py,sha256=7c1yKH9coWdGku8BOAp83H0GtSkfZF3sHFv7uRWL8Yg,3041
|
|
53
53
|
monocle_apptrace/instrumentation/metamodel/azfunc/methods.py,sha256=dCcptd9nLsXkkWtSgXBh7zRia-1g-A3rgiC4cqt5Tzo,916
|
|
54
54
|
monocle_apptrace/instrumentation/metamodel/azfunc/wrapper.py,sha256=zssmQNWG-kn9cSfE1JYwqHsl1hU4zrN2xUcFbyos8oM,712
|
|
55
|
-
monocle_apptrace/instrumentation/metamodel/azfunc/entities/http.py,sha256=
|
|
55
|
+
monocle_apptrace/instrumentation/metamodel/azfunc/entities/http.py,sha256=gWjUe5t4JWOGtzJDRFWbZqjPi8ER6hFa_2V43M8D2do,2208
|
|
56
56
|
monocle_apptrace/instrumentation/metamodel/azureaiinference/__init__.py,sha256=zHdtJf4MZKSIi-4KPxdDR_dZdRAdZuy7Z8yDRa6cBps,44
|
|
57
57
|
monocle_apptrace/instrumentation/metamodel/azureaiinference/_helper.py,sha256=j0f9ej0k0696kXrmOq_bmO4uQuxcgM5UsMCVDWXcbCI,11734
|
|
58
58
|
monocle_apptrace/instrumentation/metamodel/azureaiinference/methods.py,sha256=PsxJPFSc9yp9uzdpwVUWUAd2PVwF7MYwf3I2_cqHSOk,810
|
|
@@ -64,14 +64,14 @@ monocle_apptrace/instrumentation/metamodel/botocore/entities/__init__.py,sha256=
|
|
|
64
64
|
monocle_apptrace/instrumentation/metamodel/botocore/entities/inference.py,sha256=-YW5pBQ3fWy3TMbiRfBfJyDx_4bR4OgTjS2poG-hWoM,3073
|
|
65
65
|
monocle_apptrace/instrumentation/metamodel/botocore/handlers/botocore_span_handler.py,sha256=aZ_jxngqjihxxTPFOqYH8rjoEdF_WVwE_3-TB57d_8I,1444
|
|
66
66
|
monocle_apptrace/instrumentation/metamodel/fastapi/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
67
|
-
monocle_apptrace/instrumentation/metamodel/fastapi/_helper.py,sha256=
|
|
68
|
-
monocle_apptrace/instrumentation/metamodel/fastapi/methods.py,sha256=
|
|
67
|
+
monocle_apptrace/instrumentation/metamodel/fastapi/_helper.py,sha256=6gObluSeIJgp4yoVF_tMoLe65DjtDiRQMpwI224k3WM,3643
|
|
68
|
+
monocle_apptrace/instrumentation/metamodel/fastapi/methods.py,sha256=n2nAGaxrjC-E5UGJwVlriNkFlFRAG80RrxGK5yHoobY,816
|
|
69
69
|
monocle_apptrace/instrumentation/metamodel/fastapi/entities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
70
|
-
monocle_apptrace/instrumentation/metamodel/fastapi/entities/http.py,sha256=
|
|
70
|
+
monocle_apptrace/instrumentation/metamodel/fastapi/entities/http.py,sha256=HUH_lrxezw96t-9hCle-yALEZaHfZpOTEVB0kNkacv4,1476
|
|
71
71
|
monocle_apptrace/instrumentation/metamodel/flask/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
72
|
-
monocle_apptrace/instrumentation/metamodel/flask/_helper.py,sha256=
|
|
72
|
+
monocle_apptrace/instrumentation/metamodel/flask/_helper.py,sha256=gPrzlz9W3NY6DYQz9grMBnuYqiKuNvNMIpQwQboQlYE,3268
|
|
73
73
|
monocle_apptrace/instrumentation/metamodel/flask/methods.py,sha256=dWCMEDk-HWHiD0vlMoAVYbIFclstmVkUpRrCtqDWyFE,739
|
|
74
|
-
monocle_apptrace/instrumentation/metamodel/flask/entities/http.py,sha256
|
|
74
|
+
monocle_apptrace/instrumentation/metamodel/flask/entities/http.py,sha256=bj_A7_tiz9oY-1nAXYL1V_Kj4g3Z6HLKqdCOdw4qgUc,1804
|
|
75
75
|
monocle_apptrace/instrumentation/metamodel/gemini/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
76
76
|
monocle_apptrace/instrumentation/metamodel/gemini/_helper.py,sha256=qCjZGPYP_aidE4Eue4GK0x8RbTkh74ayJfJkFRLdhpg,5103
|
|
77
77
|
monocle_apptrace/instrumentation/metamodel/gemini/methods.py,sha256=prvi1oY4n1DAefP6IJ7McfrtprHRlwmtGBb-R1kxlPQ,881
|
|
@@ -84,10 +84,10 @@ monocle_apptrace/instrumentation/metamodel/haystack/methods.py,sha256=fuICw7KVTA
|
|
|
84
84
|
monocle_apptrace/instrumentation/metamodel/haystack/entities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
85
85
|
monocle_apptrace/instrumentation/metamodel/haystack/entities/inference.py,sha256=pykGCW_ucEdPkp_yshSyHeK7p2WxJpnzxHEPt7TONp0,3880
|
|
86
86
|
monocle_apptrace/instrumentation/metamodel/haystack/entities/retrieval.py,sha256=bWagT0us1sGFlvHEToYlVk4PPDxFimQC0l_BJmrjnxc,2439
|
|
87
|
-
monocle_apptrace/instrumentation/metamodel/lambdafunc/_helper.py,sha256=
|
|
87
|
+
monocle_apptrace/instrumentation/metamodel/lambdafunc/_helper.py,sha256=mKD-IbylOUugK9GGuGv-S53AUei_8swQ4Ak8A5iwUxw,3043
|
|
88
88
|
monocle_apptrace/instrumentation/metamodel/lambdafunc/methods.py,sha256=-b5dfI5oZVdRmBjfrVJgQuN910p7SUOu9Tc1AUhkz3A,934
|
|
89
89
|
monocle_apptrace/instrumentation/metamodel/lambdafunc/wrapper.py,sha256=nxnfCwPftoRdHfjuRNrILEFOvB1e8oXqHRfPn-qxyZY,716
|
|
90
|
-
monocle_apptrace/instrumentation/metamodel/lambdafunc/entities/http.py,sha256=
|
|
90
|
+
monocle_apptrace/instrumentation/metamodel/lambdafunc/entities/http.py,sha256=ws2tSnf77rHdJ2E0ER2SOB9U7EDp33d9yNh2O29yDRA,1984
|
|
91
91
|
monocle_apptrace/instrumentation/metamodel/langchain/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
92
92
|
monocle_apptrace/instrumentation/metamodel/langchain/_helper.py,sha256=Xt-PRVLDMU6buiKLcUhw-IwL5sj1FF-etkp403HGRs0,12339
|
|
93
93
|
monocle_apptrace/instrumentation/metamodel/langchain/methods.py,sha256=sQLrji0NLuG8i8q5UdbgzPUjWh_WmromfvWL3pGZdCk,2941
|
|
@@ -99,7 +99,7 @@ monocle_apptrace/instrumentation/metamodel/langgraph/_helper.py,sha256=O0x8fLwc5
|
|
|
99
99
|
monocle_apptrace/instrumentation/metamodel/langgraph/langgraph_processor.py,sha256=0JZKLwWcdXTvp7QoBhCV6CoplohMoH3jdZ0EtfUNi2s,3156
|
|
100
100
|
monocle_apptrace/instrumentation/metamodel/langgraph/methods.py,sha256=xu3BkxjupktwdAPAvavOd2_ZhjllqfYQQ3s1RWrhWlE,1295
|
|
101
101
|
monocle_apptrace/instrumentation/metamodel/langgraph/entities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
102
|
-
monocle_apptrace/instrumentation/metamodel/langgraph/entities/inference.py,sha256=
|
|
102
|
+
monocle_apptrace/instrumentation/metamodel/langgraph/entities/inference.py,sha256=XfnEEmE02aLPXKNwocGjLMkUlRJJGPhPEblFBCoDUug,5133
|
|
103
103
|
monocle_apptrace/instrumentation/metamodel/litellm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
104
104
|
monocle_apptrace/instrumentation/metamodel/litellm/_helper.py,sha256=Yo0RtiJ4WKDRuC9VqUmXmdQmRLduOsVGHMNwswwdcLk,3433
|
|
105
105
|
monocle_apptrace/instrumentation/metamodel/litellm/methods.py,sha256=D3rT7bQKzPRxGIs3GxwPmjmmti8ndF7_5Cmz8ojfSJQ,627
|
|
@@ -110,7 +110,7 @@ monocle_apptrace/instrumentation/metamodel/llamaindex/_helper.py,sha256=-Vw215wW
|
|
|
110
110
|
monocle_apptrace/instrumentation/metamodel/llamaindex/llamaindex_processor.py,sha256=BRZWUSY5M6cpU1YpsBjL2jBtrWD2suWLN04eDcL1xsM,3903
|
|
111
111
|
monocle_apptrace/instrumentation/metamodel/llamaindex/methods.py,sha256=OQjFgyBC6ykHOrsV3otw81gHPtPiAV20UUT_-c9L-Vs,5166
|
|
112
112
|
monocle_apptrace/instrumentation/metamodel/llamaindex/entities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
113
|
-
monocle_apptrace/instrumentation/metamodel/llamaindex/entities/agent.py,sha256=
|
|
113
|
+
monocle_apptrace/instrumentation/metamodel/llamaindex/entities/agent.py,sha256=toYHGAoBFqyQU94oejX_xtCKp9djkXbWFluf-NJlkmc,5255
|
|
114
114
|
monocle_apptrace/instrumentation/metamodel/llamaindex/entities/inference.py,sha256=sWXR1-Vp6QxQVm9yYrrb3N6i8vS4vuR7G1MkS-DFY9o,3401
|
|
115
115
|
monocle_apptrace/instrumentation/metamodel/llamaindex/entities/retrieval.py,sha256=z9jWZW_UCYL0fKCUKXEiIzloZeYi14kGkOPqewO4If8,1952
|
|
116
116
|
monocle_apptrace/instrumentation/metamodel/mcp/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -118,7 +118,12 @@ monocle_apptrace/instrumentation/metamodel/mcp/_helper.py,sha256=m67hrdAD_plMdMO
|
|
|
118
118
|
monocle_apptrace/instrumentation/metamodel/mcp/mcp_processor.py,sha256=bCAEUYNudGcXhpS-U7GP6Zt917AhvxJWJpoykfjE044,377
|
|
119
119
|
monocle_apptrace/instrumentation/metamodel/mcp/methods.py,sha256=rgd5lZG8Z8x4vGZ5JxZiPeAwBoaZp6wOuwO8uYzHRCs,685
|
|
120
120
|
monocle_apptrace/instrumentation/metamodel/mcp/entities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
121
|
-
monocle_apptrace/instrumentation/metamodel/mcp/entities/inference.py,sha256=
|
|
121
|
+
monocle_apptrace/instrumentation/metamodel/mcp/entities/inference.py,sha256=hd1K63T3DHInaTvcCHm8VO7IZsT5cV3todvOucWPL34,1783
|
|
122
|
+
monocle_apptrace/instrumentation/metamodel/mistral/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
123
|
+
monocle_apptrace/instrumentation/metamodel/mistral/_helper.py,sha256=XKMv7y9KKukduF3XveGAhUL14XPMxS0X9FSU4Rd4kHg,7392
|
|
124
|
+
monocle_apptrace/instrumentation/metamodel/mistral/methods.py,sha256=G--5SBRNXXE-gRZAWxfEahnrZM40Nstc3cNUemWjioU,1441
|
|
125
|
+
monocle_apptrace/instrumentation/metamodel/mistral/entities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
126
|
+
monocle_apptrace/instrumentation/metamodel/mistral/entities/inference.py,sha256=2W6IWvLSJYHdHJ30sQDdLkyitG8ZrGUPhKu2ULylooc,3243
|
|
122
127
|
monocle_apptrace/instrumentation/metamodel/openai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
123
128
|
monocle_apptrace/instrumentation/metamodel/openai/_helper.py,sha256=Iy8bsvpMTXEj0Ay60aBZKT1u2h2fxllBCnj0zb7FLHc,14985
|
|
124
129
|
monocle_apptrace/instrumentation/metamodel/openai/methods.py,sha256=jpqZyfiJbzMz1r3W3fwMCGiQsbiDSkhqgADJextGxFQ,1796
|
|
@@ -130,16 +135,16 @@ monocle_apptrace/instrumentation/metamodel/requests/_helper.py,sha256=GS03VbT9Li
|
|
|
130
135
|
monocle_apptrace/instrumentation/metamodel/requests/methods.py,sha256=O7lkglRvV97zqnCu6r2JwvW8WQqi4uvlpmNkAPpXigE,440
|
|
131
136
|
monocle_apptrace/instrumentation/metamodel/requests/entities/http.py,sha256=wM7HVf6GMnnso7sAO-YfRkYLWW21M_kLPMM8Ak9czLk,1751
|
|
132
137
|
monocle_apptrace/instrumentation/metamodel/teamsai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
133
|
-
monocle_apptrace/instrumentation/metamodel/teamsai/_helper.py,sha256=
|
|
138
|
+
monocle_apptrace/instrumentation/metamodel/teamsai/_helper.py,sha256=0wX6HOdzjQecYnrzWmR0RBX3Bm_WWbq1bKJO8DUhfM4,7212
|
|
134
139
|
monocle_apptrace/instrumentation/metamodel/teamsai/methods.py,sha256=5fPh2l8nSi524KwHGp-m6GVEy3lXmBG-97i7r0CpE2g,3453
|
|
135
140
|
monocle_apptrace/instrumentation/metamodel/teamsai/sample.json,sha256=GnlzIad8rjugqkOh18bhKdxNlrJW77zSjwT6JEqDwyU,26003
|
|
136
141
|
monocle_apptrace/instrumentation/metamodel/teamsai/entities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
137
142
|
monocle_apptrace/instrumentation/metamodel/teamsai/entities/inference/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
138
143
|
monocle_apptrace/instrumentation/metamodel/teamsai/entities/inference/actionplanner_output_processor.py,sha256=FRR9iBdDBXfYscP-lkORMNKl_lllflZN6gMlC7m_94w,3206
|
|
139
144
|
monocle_apptrace/instrumentation/metamodel/teamsai/entities/inference/teamsai_output_processor.py,sha256=o9jrBIEqPDg3VfR6zexUCpkq3jlX0lQji8CKLUUK4Wk,3022
|
|
140
|
-
monocle_apptrace-0.5.
|
|
141
|
-
monocle_apptrace-0.5.
|
|
142
|
-
monocle_apptrace-0.5.
|
|
143
|
-
monocle_apptrace-0.5.
|
|
144
|
-
monocle_apptrace-0.5.
|
|
145
|
-
monocle_apptrace-0.5.
|
|
145
|
+
monocle_apptrace-0.5.3.dist-info/METADATA,sha256=Tg5j-g9XMePvDp0jbnZpYEvNhCfhQ4V4tXvaTj7H4jw,8011
|
|
146
|
+
monocle_apptrace-0.5.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
147
|
+
monocle_apptrace-0.5.3.dist-info/entry_points.txt,sha256=rxpPKb3klrgZEbSyOFQ2J6KRPO7ri9ES-zmC8Jtikx8,70
|
|
148
|
+
monocle_apptrace-0.5.3.dist-info/licenses/LICENSE,sha256=ay9trLiP5I7ZsFXo6AqtkLYdRqe5S9r-DrPOvsNlZrg,9136
|
|
149
|
+
monocle_apptrace-0.5.3.dist-info/licenses/NOTICE,sha256=9jn4xtwM_uUetJMx5WqGnhrR7MIhpoRlpokjSTlyt8c,112
|
|
150
|
+
monocle_apptrace-0.5.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|