openlit 1.22.0__py3-none-any.whl → 1.22.2__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.
openlit/__init__.py CHANGED
@@ -140,12 +140,17 @@ def instrument_if_available(
140
140
  ):
141
141
  """Instruments the specified instrumentor if its library is available."""
142
142
  if instrumentor_name in disabled_instrumentors:
143
+ logger.info("Instrumentor %s is disabled", instrumentor_name)
143
144
  return
144
145
 
145
146
  module_name = module_name_map.get(instrumentor_name)
146
147
 
147
- if not module_name or find_spec(module_name) is not None:
148
- try:
148
+ if not module_name:
149
+ logger.error("No module mapping for %s", instrumentor_name)
150
+ return
151
+
152
+ try:
153
+ if find_spec(module_name) is not None:
149
154
  instrumentor_instance.instrument(
150
155
  environment=config.environment,
151
156
  application_name=config.application_name,
@@ -155,10 +160,12 @@ def instrument_if_available(
155
160
  metrics_dict=config.metrics_dict,
156
161
  disable_metrics=config.disable_metrics,
157
162
  )
158
-
159
- # pylint: disable=broad-exception-caught
160
- except Exception as e:
161
- logger.error("Failed to instrument %s: %s", instrumentor_name, e)
163
+ logger.info("Instrumented %s", instrumentor_name)
164
+ else:
165
+ # pylint: disable=line-too-long
166
+ logger.info("Library for %s (%s) not found. Skipping instrumentation", instrumentor_name, module_name)
167
+ except Exception as e:
168
+ logger.error("Failed to instrument %s: %s", instrumentor_name, e)
162
169
 
163
170
  def init(environment="default", application_name="default", tracer=None, otlp_endpoint=None,
164
171
  otlp_headers=None, disable_batch=False, trace_content=True, disabled_instrumentors=None,
@@ -184,7 +191,7 @@ def init(environment="default", application_name="default", tracer=None, otlp_en
184
191
  collect_gpu_stats (bool): Flag to enable or disable GPU metrics collection.
185
192
  """
186
193
  disabled_instrumentors = disabled_instrumentors if disabled_instrumentors else []
187
- # Check for invalid instrumentor names
194
+ logger.info("Starting openLIT initialization...")
188
195
 
189
196
  module_name_map = {
190
197
  "openai": "openai",
@@ -215,9 +222,7 @@ def init(environment="default", application_name="default", tracer=None, otlp_en
215
222
  name for name in disabled_instrumentors if name not in module_name_map
216
223
  ]
217
224
  for invalid_name in invalid_instrumentors:
218
- logger.warning(
219
- "Invalid instrumentor name detected and ignored: '%s'", invalid_name
220
- )
225
+ logger.warning("Invalid instrumentor name detected and ignored: '%s'", invalid_name)
221
226
 
222
227
  try:
223
228
  # Retrieve or create the single configuration instance.
@@ -237,7 +242,7 @@ def init(environment="default", application_name="default", tracer=None, otlp_en
237
242
  logger.error("openLIT tracing setup failed. Tracing will not be available.")
238
243
  return
239
244
 
240
- # Setup meter and receive metrics_dict instead of meter
245
+ # Setup meter and receive metrics_dict instead of meter.
241
246
  metrics_dict = setup_meter(
242
247
  application_name=application_name,
243
248
  environment=environment,
@@ -293,14 +298,13 @@ def init(environment="default", application_name="default", tracer=None, otlp_en
293
298
  # Initialize and instrument only the enabled instrumentors
294
299
  for name, instrumentor in instrumentor_instances.items():
295
300
  instrument_if_available(name, instrumentor, config,
296
- disabled_instrumentors, module_name_map)
301
+ disabled_instrumentors, module_name_map)
297
302
 
298
- if (disable_metrics is False) and (collect_gpu_stats is True):
303
+ if not disable_metrics and collect_gpu_stats:
299
304
  NvidiaGPUInstrumentor().instrument(
300
305
  environment=config.environment,
301
306
  application_name=config.application_name,
302
307
  )
303
-
304
308
  except Exception as e:
305
309
  logger.error("Error during openLIT initialization: %s", e)
306
310
 
@@ -481,8 +481,8 @@ def chat(gen_ai_endpoint, version, environment, application_name,
481
481
  response = wrapped(*args, **kwargs)
482
482
 
483
483
  try:
484
- input_tokens = response.response_metadata["prompt_eval_count"] or 0
485
- output_tokens = response.response_metadata["eval_count"] or 0
484
+ input_tokens = response.response_metadata.get("prompt_eval_count", 0)
485
+ output_tokens = response.response_metadata.get("eval_count", 0)
486
486
 
487
487
  # Calculate cost of the operation
488
488
  cost = get_chat_model_cost(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: openlit
3
- Version: 1.22.0
3
+ Version: 1.22.2
4
4
  Summary: OpenTelemetry-native Auto instrumentation library for monitoring LLM Applications and GPUs, facilitating the integration of observability into your GenAI-driven projects
5
5
  Home-page: https://github.com/openlit/openlit/tree/main/openlit/python
6
6
  Keywords: OpenTelemetry,otel,otlp,llm,tracing,openai,anthropic,claude,cohere,llm monitoring,observability,monitoring,gpt,Generative AI,chatGPT,gpu
@@ -73,6 +73,7 @@ This project adheres to the [Semantic Conventions](https://github.com/open-telem
73
73
  | [✅ vLLM](https://docs.openlit.io/latest/integrations/vllm) | | | |
74
74
  | [✅ OLA Krutrim](https://docs.openlit.io/latest/integrations/krutrim) | | | |
75
75
  | [✅ Google AI Studio](https://docs.openlit.io/latest/integrations/google-ai-studio) | | | |
76
+ | [✅ NVIDIA NIM](https://docs.openlit.io/latest/integrations/nvidia-nim) | | | |
76
77
 
77
78
  ## Supported Destinations
78
79
  - [✅ OpenTelemetry Collector](https://docs.openlit.io/latest/connections/otelcol)
@@ -1,5 +1,5 @@
1
1
  openlit/__helpers.py,sha256=lrn4PBs9owDudiCY2NBoVbAi7AU_HtUpyOj0oqPBsPY,5545
2
- openlit/__init__.py,sha256=w3xpFptltMR5TgYWz3ADfvWGpIH32CdBBbcIFFGc8vc,15498
2
+ openlit/__init__.py,sha256=NvlRqmf_mHcUNTHDI-Tv211x4BlDGLnU2vv8KTaGOxc,15782
3
3
  openlit/instrumentation/anthropic/__init__.py,sha256=oaU53BOPyfUKbEzYvLr1DPymDluurSnwo4Hernf2XdU,1955
4
4
  openlit/instrumentation/anthropic/anthropic.py,sha256=y7CEGhKOGHWt8G_5Phr4qPJTfPGRJIAr9Yk6nM3CcvM,16775
5
5
  openlit/instrumentation/anthropic/async_anthropic.py,sha256=Zz1KRKIG9wGn0quOoLvjORC-49IvHQpJ6GBdB-4PfCQ,16816
@@ -29,7 +29,7 @@ openlit/instrumentation/groq/groq.py,sha256=m4gFPbYzjUUIgjXZ0Alu2Zy1HcO5takCFA2X
29
29
  openlit/instrumentation/haystack/__init__.py,sha256=QK6XxxZUHX8vMv2Crk7rNBOc64iOOBLhJGL_lPlAZ8s,1758
30
30
  openlit/instrumentation/haystack/haystack.py,sha256=oQIZiDhdp3gnJnhYQ1OouJMc9YT0pQ-_31cmNuopa68,3891
31
31
  openlit/instrumentation/langchain/__init__.py,sha256=0AI2Dnqw81IcJw3jM--gGkv_HRh2GtosOGJjvOpw7Zk,3431
32
- openlit/instrumentation/langchain/langchain.py,sha256=7K-m35sS3yTu9IklRo6n9LCcymeg6OyIYKrMzMG_uDQ,35730
32
+ openlit/instrumentation/langchain/langchain.py,sha256=s8vZZxhHfDANeisqIyNvsd5BPcHbc-LNFKDXS5hiEfA,35734
33
33
  openlit/instrumentation/llamaindex/__init__.py,sha256=vPtK65G6b-TwJERowVRUVl7f_nBSlFdwPBtpg8dOGos,1977
34
34
  openlit/instrumentation/llamaindex/llamaindex.py,sha256=uiIigbwhonSbJWA7LpgOVI1R4kxxPODS1K5wyHIQ4hM,4048
35
35
  openlit/instrumentation/milvus/__init__.py,sha256=qi1yfmMrvkDtnrN_6toW8qC9BRL78bq7ayWpObJ8Bq4,2961
@@ -59,7 +59,7 @@ openlit/instrumentation/vllm/vllm.py,sha256=lDzM7F5pgxvh8nKL0dcKB4TD0Mc9wXOWeXOs
59
59
  openlit/otel/metrics.py,sha256=O7NoaDz0bY19mqpE4-0PcKwEe-B-iJFRgOCaanAuZAc,4291
60
60
  openlit/otel/tracing.py,sha256=vL1ifMbARPBpqK--yXYsCM6y5dSu5LFIKqkhZXtYmUc,3712
61
61
  openlit/semcov/__init__.py,sha256=wpAarrnkndbgvP8VSudi8IRInYtD02hkewqjyiC0dMk,7614
62
- openlit-1.22.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
63
- openlit-1.22.0.dist-info/METADATA,sha256=rSCNSQss7NahZ5Vnq028vzvKxmhsXuOxGvQt5n5Ock0,15489
64
- openlit-1.22.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
65
- openlit-1.22.0.dist-info/RECORD,,
62
+ openlit-1.22.2.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
63
+ openlit-1.22.2.dist-info/METADATA,sha256=yD1-PRHWYtdY6KsSX_ulQvL83tqbpBhZVkgQqm8J2vk,15710
64
+ openlit-1.22.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
65
+ openlit-1.22.2.dist-info/RECORD,,