monocle-apptrace 0.3.0b3__py3-none-any.whl → 0.3.0b4__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.

@@ -28,14 +28,22 @@ class S3SpanExporter(SpanExporterBase):
28
28
  DEFAULT_TIME_FORMAT = "%Y-%m-%d__%H.%M.%S"
29
29
  self.max_batch_size = 500
30
30
  self.export_interval = 1
31
- self.s3_client = boto3.client(
32
- 's3',
33
- aws_access_key_id=os.getenv('AWS_ACCESS_KEY_ID'),
34
- aws_secret_access_key=os.getenv('AWS_SECRET_ACCESS_KEY'),
35
- region_name=region_name,
36
- )
31
+ if(os.getenv('MONOCLE_AWS_ACCESS_KEY_ID') and os.getenv('MONOCLE_AWS_SECRET_ACCESS_KEY')):
32
+ self.s3_client = boto3.client(
33
+ 's3',
34
+ aws_access_key_id=os.getenv('MONOCLE_AWS_ACCESS_KEY_ID'),
35
+ aws_secret_access_key=os.getenv('MONOCLE_AWS_SECRET_ACCESS_KEY'),
36
+ region_name=region_name,
37
+ )
38
+ else:
39
+ self.s3_client = boto3.client(
40
+ 's3',
41
+ aws_access_key_id=os.getenv('AWS_ACCESS_KEY_ID'),
42
+ aws_secret_access_key=os.getenv('AWS_SECRET_ACCESS_KEY'),
43
+ region_name=region_name,
44
+ )
37
45
  self.bucket_name = bucket_name or os.getenv('MONOCLE_S3_BUCKET_NAME','default-bucket')
38
- self.file_prefix = DEFAULT_FILE_PREFIX
46
+ self.file_prefix = os.getenv('MONOCLE_S3_KEY_PREFIX', DEFAULT_FILE_PREFIX)
39
47
  self.time_format = DEFAULT_TIME_FORMAT
40
48
  self.export_queue = []
41
49
  self.last_export_time = time.time()
@@ -142,7 +150,8 @@ class S3SpanExporter(SpanExporterBase):
142
150
  @SpanExporterBase.retry_with_backoff(exceptions=(EndpointConnectionError, ConnectionClosedError, ReadTimeoutError, ConnectTimeoutError))
143
151
  def __upload_to_s3(self, span_data_batch: str):
144
152
  current_time = datetime.datetime.now().strftime(self.time_format)
145
- file_name = f"{self.file_prefix}{current_time}.ndjson"
153
+ prefix = self.file_prefix + os.environ.get('MONOCLE_S3_KEY_PREFIX_CURRENT', '')
154
+ file_name = f"{prefix}{current_time}.ndjson"
146
155
  self.s3_client.put_object(
147
156
  Bucket=self.bucket_name,
148
157
  Key=file_name,
@@ -75,7 +75,7 @@ class SpanHandler:
75
75
  if result and isinstance(result, str):
76
76
  span.set_attribute(attribute_name, result)
77
77
  except Exception as e:
78
- logger.error(f"Error processing accessor: {e}")
78
+ logger.debug(f"Error processing accessor: {e}")
79
79
  else:
80
80
  logger.warning(f"{' and '.join([key for key in ['attribute', 'accessor'] if not processor.get(key)])} not found or incorrect in entity JSON")
81
81
  span_index += 1
@@ -106,7 +106,7 @@ class SpanHandler:
106
106
  else:
107
107
  event_attributes.update(accessor(arguments))
108
108
  except Exception as e:
109
- logger.error(f"Error evaluating accessor for attribute '{attribute_key}': {e}")
109
+ logger.debug(f"Error evaluating accessor for attribute '{attribute_key}': {e}")
110
110
  span.add_event(name=event_name, attributes=event_attributes)
111
111
 
112
112
 
@@ -19,6 +19,8 @@ def extract_messages(args):
19
19
  """Extract system and user messages"""
20
20
  try:
21
21
  messages = []
22
+ if args and isinstance(args, (list, tuple)) and hasattr(args[0], 'text'):
23
+ return [args[0].text]
22
24
  if args and isinstance(args, (list, tuple)) and len(args) > 0:
23
25
  if hasattr(args[0], "messages") and isinstance(args[0].messages, list):
24
26
  for msg in args[0].messages:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: monocle_apptrace
3
- Version: 0.3.0b3
3
+ Version: 0.3.0b4
4
4
  Summary: package with monocle genAI tracing
5
5
  Project-URL: Homepage, https://github.com/monocle2ai/monocle
6
6
  Project-URL: Issues, https://github.com/monocle2ai/monocle/issues
@@ -4,7 +4,7 @@ monocle_apptrace/exporters/base_exporter.py,sha256=Gov_QKp5fonVZ-YdNM2ynoPot7GCa
4
4
  monocle_apptrace/exporters/exporter_processor.py,sha256=BTcBgMuFLHCdCgVvc9TKIo9y8g1BvShI0L4vX6Q-cmk,393
5
5
  monocle_apptrace/exporters/file_exporter.py,sha256=gN9pJ_X5pcstVVsyivgHsjWhr443eRa6Y6Hx1rGLQAM,2280
6
6
  monocle_apptrace/exporters/monocle_exporters.py,sha256=WRcRnnN0gSL7khN-BZ9wonMKiWaHNFqnBZ-QyM6hMsg,2177
7
- monocle_apptrace/exporters/aws/s3_exporter.py,sha256=eq5SfZmaeyhtXeXYnJGAfT1vlaNGSyh1leGX9Rr7vQ4,6619
7
+ monocle_apptrace/exporters/aws/s3_exporter.py,sha256=JMxtox61J6gUoEFsM1PJisBJPySMpm_U2Uv68WioKtE,7146
8
8
  monocle_apptrace/exporters/aws/s3_exporter_opendal.py,sha256=FvyW0KkAz0W_1g16C_ERmamg4fSreT-UXgLaN9URTVQ,5057
9
9
  monocle_apptrace/exporters/azure/blob_exporter.py,sha256=m7Hsw3OXlP2GOCQcdxf8LM6Fe12fZmih45x82Z12dbI,5597
10
10
  monocle_apptrace/exporters/azure/blob_exporter_opendal.py,sha256=h5xv7JU6YEXL4AKT2B1op3YsHoA0rNnLCGq8seoVRWs,6114
@@ -13,7 +13,7 @@ monocle_apptrace/instrumentation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRk
13
13
  monocle_apptrace/instrumentation/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
14
  monocle_apptrace/instrumentation/common/constants.py,sha256=ySfwN5ZUtNFwm3ba5QWxBpLmZVuBRqVltuaBvpk-e3Y,1937
15
15
  monocle_apptrace/instrumentation/common/instrumentor.py,sha256=v79pmHDRf64G1Y0A6RMZlxbKizYRuNwlkJpRabESDiU,8386
16
- monocle_apptrace/instrumentation/common/span_handler.py,sha256=d5ycN3_OYkNm6_XKuAybMa-s1o6VrH92bEiR-Q_Hj24,7141
16
+ monocle_apptrace/instrumentation/common/span_handler.py,sha256=G00LWciyoODiaXRtjqLDFspiHVBpx04HBJfxTUE79ak,7141
17
17
  monocle_apptrace/instrumentation/common/utils.py,sha256=nX3TErgaaYSlebYqQHuj4nqFyU51-nMrdIbQmO2vOTI,5357
18
18
  monocle_apptrace/instrumentation/common/wrapper.py,sha256=Q-7gyJpTtNpY1-khduT3vykvOewQ8qKzKQfYaZjho7s,2864
19
19
  monocle_apptrace/instrumentation/common/wrapper_method.py,sha256=rWiSdzhZrnWnNVVAZMetPboCH2HHSOZ7KgI7dPwGxV8,1629
@@ -30,7 +30,7 @@ monocle_apptrace/instrumentation/metamodel/haystack/entities/__init__.py,sha256=
30
30
  monocle_apptrace/instrumentation/metamodel/haystack/entities/inference.py,sha256=PkCaaar5hbZH7YGtWisq8dUJqBINsFGmtaUgt11UDa4,3019
31
31
  monocle_apptrace/instrumentation/metamodel/haystack/entities/retrieval.py,sha256=nq3lsk2qFxXqwrAHsBt8zrh4ZVGAJABkPtylrjUCCqc,2357
32
32
  monocle_apptrace/instrumentation/metamodel/langchain/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
33
- monocle_apptrace/instrumentation/metamodel/langchain/_helper.py,sha256=7GixVwwzYR_Vcit1YN-xscA00HWFxOx7lcpqI94zi-w,4535
33
+ monocle_apptrace/instrumentation/metamodel/langchain/_helper.py,sha256=txpamIJKAOBVIEq0ndqWBkFghMJi38NWrieW3lNfK34,4651
34
34
  monocle_apptrace/instrumentation/metamodel/langchain/methods.py,sha256=xEWO4uSiOnR221cvXESnVgAfC6JeExsP46ZkbK8_Yqs,3027
35
35
  monocle_apptrace/instrumentation/metamodel/langchain/entities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
36
36
  monocle_apptrace/instrumentation/metamodel/langchain/entities/inference.py,sha256=wjW9hb1Qwr_aqY0lPehdPftyHtuvHinGxVmy0TVj5xo,2705
@@ -41,8 +41,8 @@ monocle_apptrace/instrumentation/metamodel/llamaindex/methods.py,sha256=THr-nmeG
41
41
  monocle_apptrace/instrumentation/metamodel/llamaindex/entities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
42
42
  monocle_apptrace/instrumentation/metamodel/llamaindex/entities/inference.py,sha256=585hJXbdN2kFOnABv12vlzFkCbDExZln5ISvQI71EHw,2623
43
43
  monocle_apptrace/instrumentation/metamodel/llamaindex/entities/retrieval.py,sha256=QBF1nrqog5KHh925jiY2V-kejL6iVLKUowZmqUDoiJ4,1870
44
- monocle_apptrace-0.3.0b3.dist-info/METADATA,sha256=VVAF6k-HKzOqIX05cguZz9fmkySu6CKpNWr8ynwRo8I,6265
45
- monocle_apptrace-0.3.0b3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
46
- monocle_apptrace-0.3.0b3.dist-info/licenses/LICENSE,sha256=ay9trLiP5I7ZsFXo6AqtkLYdRqe5S9r-DrPOvsNlZrg,9136
47
- monocle_apptrace-0.3.0b3.dist-info/licenses/NOTICE,sha256=9jn4xtwM_uUetJMx5WqGnhrR7MIhpoRlpokjSTlyt8c,112
48
- monocle_apptrace-0.3.0b3.dist-info/RECORD,,
44
+ monocle_apptrace-0.3.0b4.dist-info/METADATA,sha256=uMbXIhUajnOyxh8n6q2P3RxPC7p6I1aFOmQj772omQs,6265
45
+ monocle_apptrace-0.3.0b4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
46
+ monocle_apptrace-0.3.0b4.dist-info/licenses/LICENSE,sha256=ay9trLiP5I7ZsFXo6AqtkLYdRqe5S9r-DrPOvsNlZrg,9136
47
+ monocle_apptrace-0.3.0b4.dist-info/licenses/NOTICE,sha256=9jn4xtwM_uUetJMx5WqGnhrR7MIhpoRlpokjSTlyt8c,112
48
+ monocle_apptrace-0.3.0b4.dist-info/RECORD,,