monocle-apptrace 0.2.0__py3-none-any.whl → 0.3.0b2__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/botocore/__init__.py +9 -0
- monocle_apptrace/constants.py +18 -4
- monocle_apptrace/exporters/aws/s3_exporter.py +16 -16
- monocle_apptrace/exporters/azure/blob_exporter.py +2 -5
- monocle_apptrace/exporters/base_exporter.py +19 -18
- monocle_apptrace/instrumentor.py +3 -3
- monocle_apptrace/message_processing.py +80 -0
- monocle_apptrace/metamodel/maps/attributes/inference/botocore_entities.json +27 -0
- monocle_apptrace/metamodel/maps/attributes/inference/haystack_entities.json +57 -0
- monocle_apptrace/metamodel/maps/attributes/inference/langchain_entities.json +28 -6
- monocle_apptrace/metamodel/maps/attributes/inference/llamaindex_entities.json +28 -6
- monocle_apptrace/metamodel/maps/attributes/retrieval/haystack_entities.json +31 -0
- monocle_apptrace/metamodel/maps/attributes/retrieval/langchain_entities.json +8 -4
- monocle_apptrace/metamodel/maps/attributes/retrieval/llamaindex_entities.json +8 -4
- monocle_apptrace/metamodel/maps/botocore_methods.json +13 -0
- monocle_apptrace/metamodel/maps/haystack_methods.json +26 -6
- monocle_apptrace/metamodel/maps/llamaindex_methods.json +18 -0
- monocle_apptrace/utils.py +92 -12
- monocle_apptrace/wrap_common.py +208 -114
- monocle_apptrace/wrapper.py +2 -1
- {monocle_apptrace-0.2.0.dist-info → monocle_apptrace-0.3.0b2.dist-info}/METADATA +5 -2
- {monocle_apptrace-0.2.0.dist-info → monocle_apptrace-0.3.0b2.dist-info}/RECORD +25 -21
- {monocle_apptrace-0.2.0.dist-info → monocle_apptrace-0.3.0b2.dist-info}/WHEEL +1 -1
- monocle_apptrace/haystack/wrap_node.py +0 -27
- monocle_apptrace/haystack/wrap_openai.py +0 -44
- {monocle_apptrace-0.2.0.dist-info → monocle_apptrace-0.3.0b2.dist-info}/licenses/LICENSE +0 -0
- {monocle_apptrace-0.2.0.dist-info → monocle_apptrace-0.3.0b2.dist-info}/licenses/NOTICE +0 -0
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
monocle_apptrace/README.md,sha256=T5NFC01bF8VR0oVnAX_n0bhsEtttwqfTxDNAe5Y_ivE,3765
|
|
2
2
|
monocle_apptrace/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
-
monocle_apptrace/constants.py,sha256=
|
|
4
|
-
monocle_apptrace/instrumentor.py,sha256=
|
|
5
|
-
monocle_apptrace/
|
|
6
|
-
monocle_apptrace/
|
|
7
|
-
monocle_apptrace/
|
|
8
|
-
monocle_apptrace/
|
|
3
|
+
monocle_apptrace/constants.py,sha256=Q1rREmswflNn_ZeNhDGCOCpHXY6msaOqesS_LoXXBdg,1633
|
|
4
|
+
monocle_apptrace/instrumentor.py,sha256=bTgN3pWz5cGyOBBEbiNt8O4W5QJAprUCk7JhvLdd_C8,5346
|
|
5
|
+
monocle_apptrace/message_processing.py,sha256=NEg_F1epAAGNtwN_ht6TCKPnTMgx1da95-bamm-dZeE,3025
|
|
6
|
+
monocle_apptrace/utils.py,sha256=Png2ucLNww_0_UFQxzdPs5xaEMqyezhIbjpbb5gy-GI,9764
|
|
7
|
+
monocle_apptrace/wrap_common.py,sha256=DTb1SsqKNYWDodsbISJOy6WagRJxcN4h1F5KS3rXnW8,22465
|
|
8
|
+
monocle_apptrace/wrapper.py,sha256=GVgImJasbHfrNxT8FLoMeZmGB_JRp09RjSs6Nn7OouE,904
|
|
9
|
+
monocle_apptrace/botocore/__init__.py,sha256=SkRoVm6zFUHFG8JVFKhBXWsMHk2yOLpAxgq3mD-euY4,398
|
|
10
|
+
monocle_apptrace/exporters/base_exporter.py,sha256=Gov_QKp5fonVZ-YdNM2ynoPot7GCaSNmKbCHIP3bDlE,1680
|
|
9
11
|
monocle_apptrace/exporters/exporter_processor.py,sha256=BTcBgMuFLHCdCgVvc9TKIo9y8g1BvShI0L4vX6Q-cmk,393
|
|
10
12
|
monocle_apptrace/exporters/file_exporter.py,sha256=gN9pJ_X5pcstVVsyivgHsjWhr443eRa6Y6Hx1rGLQAM,2280
|
|
11
13
|
monocle_apptrace/exporters/monocle_exporters.py,sha256=mvVoGr4itvUBuakH17zNEuXYpHtqRhq2CBH5JXhleoM,1418
|
|
12
|
-
monocle_apptrace/exporters/aws/s3_exporter.py,sha256=
|
|
13
|
-
monocle_apptrace/exporters/azure/blob_exporter.py,sha256=
|
|
14
|
+
monocle_apptrace/exporters/aws/s3_exporter.py,sha256=1WhZ_xCk1_c1vD8u2d_6z2QIedM89A-wsHGHLQsnGtY,6618
|
|
15
|
+
monocle_apptrace/exporters/azure/blob_exporter.py,sha256=m7Hsw3OXlP2GOCQcdxf8LM6Fe12fZmih45x82Z12dbI,5597
|
|
14
16
|
monocle_apptrace/exporters/okahu/okahu_exporter.py,sha256=p2rjStwo0OMEdHWQt_QvREpUWXbDm5jGx3qXeYai4_M,4407
|
|
15
17
|
monocle_apptrace/haystack/__init__.py,sha256=zMvF6Dh1-vVIAQD__HC1ubT5bs-EupUghg7HNhDv7_c,448
|
|
16
|
-
monocle_apptrace/haystack/wrap_node.py,sha256=IK07Wn3Lk1Os9URsyrmB1HXOH2FNdzK9fNLlR8TZdYc,908
|
|
17
|
-
monocle_apptrace/haystack/wrap_openai.py,sha256=Yp916DhOl0WI6virRi3L43snfsQm7PhI28wlDsg19v8,1536
|
|
18
18
|
monocle_apptrace/haystack/wrap_pipeline.py,sha256=yZAw7Hdv7FXe6rrM7gA2y5SjaZYQZCAi0q-R-uqUEvk,2254
|
|
19
19
|
monocle_apptrace/langchain/__init__.py,sha256=3yhbdw1h9I1nVEfnOOPKz9yD5NqwdLSZsxtXbMplRkw,400
|
|
20
20
|
monocle_apptrace/llamaindex/__init__.py,sha256=TgV1ZM8Cz113pZ2aAgpYwsCJyHA2aHOvNoW1QMBp0mM,709
|
|
@@ -26,19 +26,23 @@ monocle_apptrace/metamodel/entities/inference_types.json,sha256=Gkq7qNw5Qn91tuq-
|
|
|
26
26
|
monocle_apptrace/metamodel/entities/model_types.json,sha256=Oz9DzuX_ptpLEVTc1Epv4_Y80TrYxR7cyc9kM0Zk780,785
|
|
27
27
|
monocle_apptrace/metamodel/entities/vector_store_types.json,sha256=EA0KayHMOG7wMIkec54en03_3yT1qpdGh5TiDrAoh4g,462
|
|
28
28
|
monocle_apptrace/metamodel/entities/workflow_types.json,sha256=eD0W3_FocKrzrrW0bks0hIJb9Kj7w8c1dpXzxmGLOwk,386
|
|
29
|
-
monocle_apptrace/metamodel/maps/
|
|
29
|
+
monocle_apptrace/metamodel/maps/botocore_methods.json,sha256=FvobptTS-whE5fI14-3QGqGErLijmUshIvzJWF1-6fE,338
|
|
30
|
+
monocle_apptrace/metamodel/maps/haystack_methods.json,sha256=yWOs2LHgrDpwhGC2aVJqNOLt0kPwlzZdzMb2yzHP1QI,1611
|
|
30
31
|
monocle_apptrace/metamodel/maps/langchain_methods.json,sha256=lfU8nd6td5qzTI01glM063Vg0UoZM9HGPirwN4OZcKc,4285
|
|
31
|
-
monocle_apptrace/metamodel/maps/llamaindex_methods.json,sha256=
|
|
32
|
-
monocle_apptrace/metamodel/maps/attributes/inference/
|
|
33
|
-
monocle_apptrace/metamodel/maps/attributes/inference/
|
|
34
|
-
monocle_apptrace/metamodel/maps/attributes/
|
|
35
|
-
monocle_apptrace/metamodel/maps/attributes/
|
|
32
|
+
monocle_apptrace/metamodel/maps/llamaindex_methods.json,sha256=dqfDQ4H8qB-GvctBzrgH0ldjdarbTRV0ID5a4LerN5I,3328
|
|
33
|
+
monocle_apptrace/metamodel/maps/attributes/inference/botocore_entities.json,sha256=GCFQPlTTlE64dFc9DPM1sf3Uk1x6g0UdsrABlyFwl6k,936
|
|
34
|
+
monocle_apptrace/metamodel/maps/attributes/inference/haystack_entities.json,sha256=e-0SOcP6b4A1hRYtDBQT3Mx94J73xqQNqdvqWyJSFmo,1756
|
|
35
|
+
monocle_apptrace/metamodel/maps/attributes/inference/langchain_entities.json,sha256=QZJkP4JZ0VmWWtegCxFXASO8bJSYtJTz2ObpWzSyF7o,1826
|
|
36
|
+
monocle_apptrace/metamodel/maps/attributes/inference/llamaindex_entities.json,sha256=-0ARREkmWRQLbFAufiBIAbPhunuUYVBTUoP5lNJrk90,1755
|
|
37
|
+
monocle_apptrace/metamodel/maps/attributes/retrieval/haystack_entities.json,sha256=_SNwWIoO4anww-UDrTFIvDeFaHJKmg3R8IzZLbRGBD8,1035
|
|
38
|
+
monocle_apptrace/metamodel/maps/attributes/retrieval/langchain_entities.json,sha256=-Dj7U0of2TmPjhYZ2SAMztQBHeeN81H-_4rTCfoAzyQ,916
|
|
39
|
+
monocle_apptrace/metamodel/maps/attributes/retrieval/llamaindex_entities.json,sha256=opfmuUWizZvfTD7FVxG21OrpHXc8HcL32En9ftC3eRA,903
|
|
36
40
|
monocle_apptrace/metamodel/spans/README.md,sha256=_uMkLLaWitQ_rPh7oQbW5Oe7uGSv2h_QA6YwxHRJi74,5433
|
|
37
41
|
monocle_apptrace/metamodel/spans/span_example.json,sha256=7ZAUssL1UYXlbKHre8PfeNlIhHnM28e2CH9EyHDTOt8,4402
|
|
38
42
|
monocle_apptrace/metamodel/spans/span_format.json,sha256=GhfioGgMhG7St0DeYA1fgNtMkbr9wiQ1L2hovekRQ24,1512
|
|
39
43
|
monocle_apptrace/metamodel/spans/span_types.json,sha256=jwVyPbYMhEf2Ea6Egmb3m1Za28ap9dgZIpJDhdE1BlY,361
|
|
40
|
-
monocle_apptrace-0.
|
|
41
|
-
monocle_apptrace-0.
|
|
42
|
-
monocle_apptrace-0.
|
|
43
|
-
monocle_apptrace-0.
|
|
44
|
-
monocle_apptrace-0.
|
|
44
|
+
monocle_apptrace-0.3.0b2.dist-info/METADATA,sha256=OVWocxsP5qI90CNQO12wINj09oV1XnNmAaoE1Tuxt9g,5546
|
|
45
|
+
monocle_apptrace-0.3.0b2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
46
|
+
monocle_apptrace-0.3.0b2.dist-info/licenses/LICENSE,sha256=ay9trLiP5I7ZsFXo6AqtkLYdRqe5S9r-DrPOvsNlZrg,9136
|
|
47
|
+
monocle_apptrace-0.3.0b2.dist-info/licenses/NOTICE,sha256=9jn4xtwM_uUetJMx5WqGnhrR7MIhpoRlpokjSTlyt8c,112
|
|
48
|
+
monocle_apptrace-0.3.0b2.dist-info/RECORD,,
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import logging
|
|
4
|
-
from opentelemetry import context as context_api
|
|
5
|
-
from opentelemetry.context import attach, set_value
|
|
6
|
-
from opentelemetry.instrumentation.utils import (
|
|
7
|
-
_SUPPRESS_INSTRUMENTATION_KEY,
|
|
8
|
-
)
|
|
9
|
-
from monocle_apptrace.wrap_common import WORKFLOW_TYPE_MAP, with_tracer_wrapper
|
|
10
|
-
|
|
11
|
-
logger = logging.getLogger(__name__)
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
@with_tracer_wrapper
|
|
15
|
-
def wrap(tracer, to_wrap, wrapped, instance, args, kwargs):
|
|
16
|
-
if context_api.get_value(_SUPPRESS_INSTRUMENTATION_KEY):
|
|
17
|
-
return wrapped(*args, **kwargs)
|
|
18
|
-
name = instance.name
|
|
19
|
-
attach(set_value("workflow_name", name))
|
|
20
|
-
with tracer.start_as_current_span(f"{name}.task") as span:
|
|
21
|
-
workflow_name = span.resource.attributes.get("service.name")
|
|
22
|
-
span.set_attribute("workflow_name",workflow_name)
|
|
23
|
-
span.set_attribute("workflow_type", WORKFLOW_TYPE_MAP["haystack"])
|
|
24
|
-
|
|
25
|
-
response = wrapped(*args, **kwargs)
|
|
26
|
-
|
|
27
|
-
return response
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import logging
|
|
2
|
-
from opentelemetry import context as context_api
|
|
3
|
-
from opentelemetry.instrumentation.utils import _SUPPRESS_INSTRUMENTATION_KEY
|
|
4
|
-
from monocle_apptrace.wrap_common import with_tracer_wrapper
|
|
5
|
-
from monocle_apptrace.utils import (
|
|
6
|
-
dont_throw,
|
|
7
|
-
set_span_attribute
|
|
8
|
-
)
|
|
9
|
-
|
|
10
|
-
logger = logging.getLogger(__name__)
|
|
11
|
-
|
|
12
|
-
@dont_throw
|
|
13
|
-
def _set_input_attributes(span, kwargs, instance, args):
|
|
14
|
-
set_span_attribute(span, "llm_input", kwargs.get("prompt"))
|
|
15
|
-
|
|
16
|
-
if 'model' in instance.__dict__:
|
|
17
|
-
model_name = instance.__dict__.get("model")
|
|
18
|
-
set_span_attribute(span, "model_name", model_name)
|
|
19
|
-
|
|
20
|
-
@dont_throw
|
|
21
|
-
def _set_response_attributes(span, response):
|
|
22
|
-
|
|
23
|
-
if "meta" in response:
|
|
24
|
-
token_usage = response["meta"][0]["usage"]
|
|
25
|
-
set_span_attribute(span, "completion_tokens", token_usage.get("completion_tokens"))
|
|
26
|
-
set_span_attribute(span, "prompt_tokens", token_usage.get("prompt_tokens"))
|
|
27
|
-
set_span_attribute(span, "total_tokens", token_usage.get("total_tokens"))
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
@with_tracer_wrapper
|
|
31
|
-
def wrap_openai(tracer, to_wrap, wrapped, instance, args, kwargs):
|
|
32
|
-
if context_api.get_value(_SUPPRESS_INSTRUMENTATION_KEY):
|
|
33
|
-
return wrapped(*args, **kwargs)
|
|
34
|
-
|
|
35
|
-
with tracer.start_as_current_span("haystack.openai") as span:
|
|
36
|
-
if span.is_recording():
|
|
37
|
-
_set_input_attributes(span, kwargs, instance, args)
|
|
38
|
-
response = wrapped(*args, **kwargs)
|
|
39
|
-
|
|
40
|
-
if response:
|
|
41
|
-
if span.is_recording():
|
|
42
|
-
_set_response_attributes(span, response)
|
|
43
|
-
|
|
44
|
-
return response
|
|
File without changes
|
|
File without changes
|