openlit 1.34.22__py3-none-any.whl → 1.34.24__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/__helpers.py +48 -3
- openlit/__init__.py +3 -0
- openlit/instrumentation/ag2/__init__.py +22 -18
- openlit/instrumentation/ag2/ag2.py +75 -124
- openlit/instrumentation/ag2/async_ag2.py +114 -0
- openlit/instrumentation/ag2/utils.py +175 -0
- openlit/instrumentation/langchain/__init__.py +11 -35
- openlit/instrumentation/langchain/async_langchain.py +51 -337
- openlit/instrumentation/langchain/langchain.py +50 -310
- openlit/instrumentation/langchain/utils.py +252 -0
- openlit/instrumentation/langchain_community/__init__.py +74 -0
- openlit/instrumentation/langchain_community/async_langchain_community.py +49 -0
- openlit/instrumentation/langchain_community/langchain_community.py +49 -0
- openlit/instrumentation/langchain_community/utils.py +69 -0
- openlit/instrumentation/pinecone/__init__.py +128 -20
- openlit/instrumentation/pinecone/async_pinecone.py +59 -0
- openlit/instrumentation/pinecone/pinecone.py +36 -150
- openlit/instrumentation/pinecone/utils.py +182 -0
- openlit/semcov/__init__.py +13 -1
- {openlit-1.34.22.dist-info → openlit-1.34.24.dist-info}/METADATA +1 -1
- {openlit-1.34.22.dist-info → openlit-1.34.24.dist-info}/RECORD +23 -14
- {openlit-1.34.22.dist-info → openlit-1.34.24.dist-info}/LICENSE +0 -0
- {openlit-1.34.22.dist-info → openlit-1.34.24.dist-info}/WHEEL +0 -0
@@ -1,173 +1,59 @@
|
|
1
|
-
# pylint: disable=duplicate-code, broad-exception-caught, too-many-statements, unused-argument, possibly-used-before-assignment
|
2
1
|
"""
|
3
|
-
Module for monitoring Pinecone.
|
2
|
+
Module for monitoring Pinecone API calls.
|
4
3
|
"""
|
5
4
|
|
6
|
-
import
|
7
|
-
from opentelemetry.trace import SpanKind
|
8
|
-
from opentelemetry
|
9
|
-
from openlit.__helpers import
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
Counts Length of object if it exists, Else returns None
|
18
|
-
"""
|
19
|
-
|
20
|
-
if obj:
|
21
|
-
return len(obj)
|
22
|
-
|
23
|
-
return None
|
5
|
+
import time
|
6
|
+
from opentelemetry.trace import SpanKind
|
7
|
+
from opentelemetry import context as context_api
|
8
|
+
from openlit.__helpers import (
|
9
|
+
handle_exception,
|
10
|
+
set_server_address_and_port,
|
11
|
+
)
|
12
|
+
from openlit.instrumentation.pinecone.utils import (
|
13
|
+
process_vectordb_response,
|
14
|
+
DB_OPERATION_MAP,
|
15
|
+
)
|
24
16
|
|
25
17
|
def general_wrap(gen_ai_endpoint, version, environment, application_name,
|
26
|
-
|
18
|
+
tracer, pricing_info, capture_message_content, metrics, disable_metrics):
|
27
19
|
"""
|
28
|
-
|
29
|
-
|
30
|
-
This function is intended to wrap around Pinecone operations in order to
|
31
|
-
measure their execution time, log relevant information, and trace the execution
|
32
|
-
using OpenTelemetry. This helps in monitoring and debugging operations within
|
33
|
-
the Pinecone space.
|
34
|
-
|
35
|
-
Parameters:
|
36
|
-
- pinecone_operation (str): The specific Pinecone operation being monitored.
|
37
|
-
Examples include 'create_index', 'query', 'upsert', etc.
|
38
|
-
- version (str): The version of the application interfacing with Pinecone.
|
39
|
-
- environment (str): The deployment environment, such as 'production' or 'development'.
|
40
|
-
- application_name (str): The name of the application performing the Pinecone operation.
|
41
|
-
- tracer (opentelemetry.trace.Tracer): An object used for OpenTelemetry tracing.
|
42
|
-
- pricing_info (dict): Information about pricing, not used in current implementation.
|
43
|
-
- capture_message_content (bool): A flag indicating whether the content of responses should be traced.
|
44
|
-
|
45
|
-
Returns:
|
46
|
-
- function: A decorator function that, when applied, wraps the target function with
|
47
|
-
additional functionality for tracing and logging Pinecone operations.
|
20
|
+
Generates a telemetry wrapper for Pinecone function calls.
|
48
21
|
"""
|
49
22
|
|
50
23
|
def wrapper(wrapped, instance, args, kwargs):
|
51
24
|
"""
|
52
|
-
|
53
|
-
|
54
|
-
This inner wrapper function captures the execution of Pinecone operations,
|
55
|
-
annotating the operation with relevant metrics and tracing information, and
|
56
|
-
ensuring any exceptions are caught and logged appropriately.
|
57
|
-
|
58
|
-
Parameters:
|
59
|
-
- wrapped (Callable): The Pinecone operation to be wrapped and executed.
|
60
|
-
- instance (object): The instance on which the operation is called (for class methods).
|
61
|
-
- args (tuple): Positional arguments for the Pinecone operation.
|
62
|
-
- kwargs (dict): Keyword arguments for the Pinecone operation.
|
63
|
-
|
64
|
-
Returns:
|
65
|
-
- Any: The result of executing the wrapped Pinecone operation.
|
25
|
+
Wraps the Pinecone function call.
|
66
26
|
"""
|
67
27
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
try:
|
72
|
-
span.set_attribute(TELEMETRY_SDK_NAME, "openlit")
|
73
|
-
span.set_attribute(SemanticConvention.GEN_AI_ENDPOINT,
|
74
|
-
gen_ai_endpoint)
|
75
|
-
span.set_attribute(DEPLOYMENT_ENVIRONMENT,
|
76
|
-
environment)
|
77
|
-
span.set_attribute(SERVICE_NAME,
|
78
|
-
application_name)
|
79
|
-
span.set_attribute(SemanticConvention.GEN_AI_OPERATION,
|
80
|
-
SemanticConvention.GEN_AI_OPERATION_TYPE_VECTORDB)
|
81
|
-
span.set_attribute(SemanticConvention.DB_SYSTEM_NAME,
|
82
|
-
SemanticConvention.DB_SYSTEM_PINECONE)
|
83
|
-
|
84
|
-
if gen_ai_endpoint == "pinecone.create_index":
|
85
|
-
db_operation = SemanticConvention.DB_OPERATION_CREATE_INDEX
|
86
|
-
span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
|
87
|
-
SemanticConvention.DB_OPERATION_CREATE_INDEX)
|
88
|
-
span.set_attribute(SemanticConvention.DB_INDEX_NAME,
|
89
|
-
kwargs.get("name", ""))
|
90
|
-
span.set_attribute(SemanticConvention.DB_INDEX_DIMENSION,
|
91
|
-
kwargs.get("dimensions", ""))
|
92
|
-
span.set_attribute(SemanticConvention.DB_INDEX_METRIC,
|
93
|
-
kwargs.get("metric", ""))
|
94
|
-
span.set_attribute(SemanticConvention.DB_INDEX_SPEC,
|
95
|
-
str(kwargs.get("spec", "")))
|
96
|
-
|
97
|
-
elif gen_ai_endpoint == "pinecone.query":
|
98
|
-
db_operation = SemanticConvention.DB_OPERATION_QUERY
|
99
|
-
span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
|
100
|
-
SemanticConvention.DB_OPERATION_QUERY)
|
101
|
-
span.set_attribute(SemanticConvention.DB_STATEMENT,
|
102
|
-
str(kwargs.get("vector")))
|
103
|
-
span.set_attribute(SemanticConvention.DB_N_RESULTS,
|
104
|
-
kwargs.get("top_k", ""))
|
105
|
-
span.set_attribute(SemanticConvention.DB_FILTER,
|
106
|
-
str(kwargs.get("filter", "")))
|
107
|
-
span.set_attribute(SemanticConvention.DB_NAMESPACE,
|
108
|
-
str(kwargs.get("namespace", "")))
|
28
|
+
if context_api.get_value(context_api._SUPPRESS_INSTRUMENTATION_KEY):
|
29
|
+
return wrapped(*args, **kwargs)
|
109
30
|
|
110
|
-
|
111
|
-
|
112
|
-
span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
|
113
|
-
SemanticConvention.DB_OPERATION_UPDATE)
|
114
|
-
span.set_attribute(SemanticConvention.DB_UPDATE_ID,
|
115
|
-
kwargs.get("id",""))
|
116
|
-
span.set_attribute(SemanticConvention.DB_UPDATE_VALUES,
|
117
|
-
str(kwargs.get("values",[])))
|
118
|
-
span.set_attribute(SemanticConvention.DB_NAMESPACE,
|
119
|
-
str(kwargs.get("namespace", "")))
|
120
|
-
span.set_attribute(SemanticConvention.DB_UPDATE_METADATA,
|
121
|
-
str(kwargs.get("set_metadata", "")))
|
31
|
+
# Get server address and port using the standard helper
|
32
|
+
server_address, server_port = set_server_address_and_port(instance, "pinecone.io", 443)
|
122
33
|
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
34
|
+
db_operation = DB_OPERATION_MAP.get(gen_ai_endpoint, "unknown")
|
35
|
+
if db_operation == "create_collection":
|
36
|
+
namespace = kwargs.get("name") or (args[0] if args else "unknown")
|
37
|
+
else:
|
38
|
+
namespace = kwargs.get("namespace") or (args[0] if args else "unknown")
|
39
|
+
span_name = f"{db_operation} {namespace}"
|
129
40
|
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
span.set_attribute(SemanticConvention.DB_ID_COUNT,
|
135
|
-
object_count(kwargs.get("ids")))
|
136
|
-
span.set_attribute(SemanticConvention.DB_FILTER,
|
137
|
-
str(kwargs.get("filter", "")))
|
138
|
-
span.set_attribute(SemanticConvention.DB_DELETE_ALL,
|
139
|
-
kwargs.get("delete_all", False))
|
140
|
-
span.set_attribute(SemanticConvention.DB_NAMESPACE,
|
141
|
-
kwargs.get("namespace", ""))
|
142
|
-
|
143
|
-
span.set_status(Status(StatusCode.OK))
|
144
|
-
|
145
|
-
if disable_metrics is False:
|
146
|
-
attributes = {
|
147
|
-
TELEMETRY_SDK_NAME:
|
148
|
-
"openlit",
|
149
|
-
SERVICE_NAME:
|
150
|
-
application_name,
|
151
|
-
SemanticConvention.DB_SYSTEM_NAME:
|
152
|
-
SemanticConvention.DB_SYSTEM_PINECONE,
|
153
|
-
DEPLOYMENT_ENVIRONMENT:
|
154
|
-
environment,
|
155
|
-
SemanticConvention.GEN_AI_OPERATION:
|
156
|
-
SemanticConvention.GEN_AI_OPERATION_TYPE_VECTORDB,
|
157
|
-
SemanticConvention.DB_OPERATION_NAME:
|
158
|
-
db_operation
|
159
|
-
}
|
41
|
+
with tracer.start_as_current_span(span_name, kind=SpanKind.CLIENT) as span:
|
42
|
+
try:
|
43
|
+
start_time = time.time()
|
44
|
+
response = wrapped(*args, **kwargs)
|
160
45
|
|
161
|
-
|
46
|
+
# Process response and generate telemetry
|
47
|
+
response = process_vectordb_response(
|
48
|
+
response, db_operation, server_address, server_port,
|
49
|
+
environment, application_name, metrics, start_time, span,
|
50
|
+
capture_message_content, disable_metrics, version, instance, args, **kwargs
|
51
|
+
)
|
162
52
|
|
163
|
-
# Return original response
|
164
53
|
return response
|
165
54
|
|
166
55
|
except Exception as e:
|
167
56
|
handle_exception(span, e)
|
168
|
-
|
169
|
-
|
170
|
-
# Return original response
|
171
|
-
return response
|
57
|
+
raise
|
172
58
|
|
173
59
|
return wrapper
|
@@ -0,0 +1,182 @@
|
|
1
|
+
"""
|
2
|
+
Pinecone OpenTelemetry instrumentation utility functions
|
3
|
+
"""
|
4
|
+
import time
|
5
|
+
|
6
|
+
from opentelemetry.trace import Status, StatusCode
|
7
|
+
|
8
|
+
from openlit.__helpers import (
|
9
|
+
common_db_span_attributes,
|
10
|
+
record_db_metrics,
|
11
|
+
)
|
12
|
+
from openlit.semcov import SemanticConvention
|
13
|
+
|
14
|
+
# Operation mapping for simple span naming
|
15
|
+
DB_OPERATION_MAP = {
|
16
|
+
"pinecone.create_collection": SemanticConvention.DB_OPERATION_CREATE_COLLECTION,
|
17
|
+
"pinecone.upsert": SemanticConvention.DB_OPERATION_UPSERT,
|
18
|
+
"pinecone.query": SemanticConvention.DB_OPERATION_QUERY,
|
19
|
+
"pinecone.search": SemanticConvention.DB_OPERATION_SEARCH,
|
20
|
+
"pinecone.fetch": SemanticConvention.DB_OPERATION_FETCH,
|
21
|
+
"pinecone.update": SemanticConvention.DB_OPERATION_UPDATE,
|
22
|
+
"pinecone.delete": SemanticConvention.DB_OPERATION_DELETE,
|
23
|
+
"pinecone.upsert_records": SemanticConvention.DB_OPERATION_UPSERT,
|
24
|
+
"pinecone.search_records": SemanticConvention.DB_OPERATION_QUERY,
|
25
|
+
}
|
26
|
+
|
27
|
+
def object_count(obj):
|
28
|
+
"""
|
29
|
+
Counts length of object if it exists, else returns 0.
|
30
|
+
"""
|
31
|
+
return len(obj) if obj else 0
|
32
|
+
|
33
|
+
def common_vectordb_logic(scope, environment, application_name,
|
34
|
+
metrics, capture_message_content, disable_metrics, version, instance=None):
|
35
|
+
"""
|
36
|
+
Process vector database request and generate telemetry.
|
37
|
+
"""
|
38
|
+
|
39
|
+
scope._end_time = time.time()
|
40
|
+
|
41
|
+
# Set common database span attributes using helper
|
42
|
+
common_db_span_attributes(scope, SemanticConvention.DB_SYSTEM_PINECONE, scope._server_address, scope._server_port,
|
43
|
+
environment, application_name, version)
|
44
|
+
|
45
|
+
# Set DB operation specific attributes
|
46
|
+
scope._span.set_attribute(SemanticConvention.DB_OPERATION_NAME, scope._db_operation)
|
47
|
+
scope._span.set_attribute(SemanticConvention.DB_CLIENT_OPERATION_DURATION, scope._end_time - scope._start_time)
|
48
|
+
|
49
|
+
# Set Create Index operation specific attributes
|
50
|
+
if scope._db_operation == SemanticConvention.DB_OPERATION_CREATE_COLLECTION:
|
51
|
+
# Standard database attributes
|
52
|
+
scope._span.set_attribute(SemanticConvention.DB_COLLECTION_NAME, scope._kwargs.get("name", ""))
|
53
|
+
|
54
|
+
# Vector database specific attributes (extensions)
|
55
|
+
scope._span.set_attribute(SemanticConvention.DB_COLLECTION_DIMENSION, scope._kwargs.get("dimension", -1))
|
56
|
+
scope._span.set_attribute(SemanticConvention.DB_SEARCH_SIMILARITY_METRIC, scope._kwargs.get("metric", "cosine"))
|
57
|
+
scope._span.set_attribute(SemanticConvention.DB_COLLECTION_SPEC, str(scope._kwargs.get("spec", "")))
|
58
|
+
|
59
|
+
elif scope._db_operation == SemanticConvention.DB_OPERATION_SEARCH:
|
60
|
+
namespace = scope._kwargs.get("namespace", "default") or (scope._args[0] if scope._args else "unknown")
|
61
|
+
query = scope._kwargs.get("query", {})
|
62
|
+
|
63
|
+
# Extract query text or vector from different possible locations
|
64
|
+
query_text = query.get("inputs", {}).get("text", "")
|
65
|
+
query_vector = query.get("vector", {})
|
66
|
+
query_content = query_text or str(query_vector)
|
67
|
+
|
68
|
+
# Standard database attributes
|
69
|
+
scope._span.set_attribute(SemanticConvention.DB_QUERY_TEXT, query_content)
|
70
|
+
scope._span.set_attribute(SemanticConvention.DB_NAMESPACE, namespace)
|
71
|
+
|
72
|
+
# Vector database specific attributes (extensions)
|
73
|
+
scope._span.set_attribute(SemanticConvention.DB_VECTOR_QUERY_TOP_K, query.get("top_k", -1))
|
74
|
+
scope._span.set_attribute(SemanticConvention.DB_QUERY_SUMMARY,
|
75
|
+
f"SEARCH {namespace} top_k={query.get('top_k', -1)} text={query_text} vector={query_vector}")
|
76
|
+
|
77
|
+
elif scope._db_operation == SemanticConvention.DB_OPERATION_QUERY:
|
78
|
+
namespace = scope._kwargs.get("namespace", "default") or (scope._args[0] if scope._args else "unknown")
|
79
|
+
query = scope._kwargs.get("vector", [])
|
80
|
+
|
81
|
+
# Standard database attributes
|
82
|
+
scope._span.set_attribute(SemanticConvention.DB_QUERY_TEXT, str(query))
|
83
|
+
scope._span.set_attribute(SemanticConvention.DB_NAMESPACE, namespace)
|
84
|
+
|
85
|
+
# Vector database specific attributes (extensions)
|
86
|
+
scope._span.set_attribute(SemanticConvention.DB_VECTOR_QUERY_TOP_K, scope._kwargs.get("top_k", ""))
|
87
|
+
scope._span.set_attribute(SemanticConvention.DB_FILTER, str(scope._kwargs.get("filter", "")))
|
88
|
+
scope._span.set_attribute(SemanticConvention.DB_QUERY_SUMMARY,
|
89
|
+
f"{scope._db_operation} {namespace} "
|
90
|
+
f"top_k={scope._kwargs.get('top_k', -1)} "
|
91
|
+
f"filtered={scope._kwargs.get('filter', '')} "
|
92
|
+
f"vector={scope._kwargs.get('vector', '')}")
|
93
|
+
|
94
|
+
elif scope._db_operation == SemanticConvention.DB_OPERATION_FETCH:
|
95
|
+
namespace = scope._kwargs.get("namespace", "default") or (scope._args[0] if scope._args else "unknown")
|
96
|
+
query = scope._kwargs.get("ids", [])
|
97
|
+
|
98
|
+
# Standard database attributes
|
99
|
+
scope._span.set_attribute(SemanticConvention.DB_QUERY_TEXT, str(query))
|
100
|
+
scope._span.set_attribute(SemanticConvention.DB_NAMESPACE, namespace)
|
101
|
+
|
102
|
+
# Vector database specific attributes (extensions)
|
103
|
+
scope._span.set_attribute(SemanticConvention.DB_QUERY_SUMMARY,
|
104
|
+
f"FETCH {namespace} ids={query}")
|
105
|
+
scope._span.set_attribute(SemanticConvention.DB_RESPONSE_RETURNED_ROWS, object_count(scope._response.vectors))
|
106
|
+
|
107
|
+
elif scope._db_operation == SemanticConvention.DB_OPERATION_UPDATE:
|
108
|
+
namespace = scope._kwargs.get("namespace") or (scope._args[0] if scope._args else "unknown")
|
109
|
+
query = scope._kwargs.get("id", "")
|
110
|
+
|
111
|
+
# Standard database attributes
|
112
|
+
scope._span.set_attribute(SemanticConvention.DB_QUERY_TEXT, query)
|
113
|
+
scope._span.set_attribute(SemanticConvention.DB_NAMESPACE, namespace)
|
114
|
+
|
115
|
+
# Vector database specific attributes (extensions)
|
116
|
+
scope._span.set_attribute(SemanticConvention.DB_QUERY_SUMMARY,
|
117
|
+
f"{scope._db_operation} {namespace} "
|
118
|
+
f"id={query} "
|
119
|
+
f"values={scope._kwargs.get('values', [])} "
|
120
|
+
f"set_metadata={scope._kwargs.get('set_metadata', '')}")
|
121
|
+
|
122
|
+
elif scope._db_operation == SemanticConvention.DB_OPERATION_UPSERT:
|
123
|
+
namespace = scope._kwargs.get("namespace") or (scope._args[0] if scope._args else "unknown")
|
124
|
+
query = scope._kwargs.get("vectors") or (scope._args[1] if len(scope._args) > 1 else None)
|
125
|
+
|
126
|
+
# Standard database attributes
|
127
|
+
scope._span.set_attribute(SemanticConvention.DB_QUERY_TEXT, str(query))
|
128
|
+
scope._span.set_attribute(SemanticConvention.DB_NAMESPACE, namespace)
|
129
|
+
|
130
|
+
# Vector database specific attributes (extensions)
|
131
|
+
scope._span.set_attribute(SemanticConvention.DB_VECTOR_COUNT, object_count(query))
|
132
|
+
scope._span.set_attribute(SemanticConvention.DB_QUERY_SUMMARY,
|
133
|
+
f"{scope._db_operation} {namespace} vectors_count={object_count(query)}")
|
134
|
+
|
135
|
+
elif scope._db_operation == SemanticConvention.DB_OPERATION_DELETE:
|
136
|
+
namespace = scope._kwargs.get("namespace") or (scope._args[0] if scope._args else "unknown")
|
137
|
+
query = scope._kwargs.get("ids") or (scope._args[1] if len(scope._args) > 1 else None)
|
138
|
+
|
139
|
+
# Standard database attributes
|
140
|
+
scope._span.set_attribute(SemanticConvention.DB_QUERY_TEXT, str(query))
|
141
|
+
scope._span.set_attribute(SemanticConvention.DB_NAMESPACE, namespace)
|
142
|
+
|
143
|
+
# Vector database specific attributes (extensions)
|
144
|
+
scope._span.set_attribute(SemanticConvention.DB_ID_COUNT, object_count(scope._kwargs.get("ids")))
|
145
|
+
scope._span.set_attribute(SemanticConvention.DB_FILTER, str(scope._kwargs.get("filter", "")))
|
146
|
+
scope._span.set_attribute(SemanticConvention.DB_DELETE_ALL, scope._kwargs.get("delete_all", False))
|
147
|
+
scope._span.set_attribute(SemanticConvention.DB_QUERY_SUMMARY,
|
148
|
+
f"{scope._db_operation} {namespace} "
|
149
|
+
f"ids={query} "
|
150
|
+
f"filter={scope._kwargs.get('filter', '')} "
|
151
|
+
f"delete_all={scope._kwargs.get('delete_all', False)}")
|
152
|
+
|
153
|
+
scope._span.set_status(Status(StatusCode.OK))
|
154
|
+
|
155
|
+
# Record metrics using helper
|
156
|
+
if not disable_metrics:
|
157
|
+
record_db_metrics(metrics, SemanticConvention.DB_SYSTEM_PINECONE, scope._server_address, scope._server_port,
|
158
|
+
environment, application_name, scope._start_time, scope._end_time)
|
159
|
+
|
160
|
+
def process_vectordb_response(response, db_operation, server_address, server_port,
|
161
|
+
environment, application_name, metrics, start_time, span,
|
162
|
+
capture_message_content=False, disable_metrics=False,
|
163
|
+
version="1.0.0", instance=None, args=None, **kwargs):
|
164
|
+
"""
|
165
|
+
Process vector database response and generate telemetry following OpenTelemetry conventions.
|
166
|
+
"""
|
167
|
+
|
168
|
+
scope = type("GenericScope", (), {})()
|
169
|
+
|
170
|
+
scope._start_time = start_time
|
171
|
+
scope._span = span
|
172
|
+
scope._kwargs = kwargs
|
173
|
+
scope._args = args or []
|
174
|
+
scope._db_operation = db_operation
|
175
|
+
scope._response = response
|
176
|
+
scope._server_address = server_address
|
177
|
+
scope._server_port = server_port
|
178
|
+
|
179
|
+
common_vectordb_logic(scope, environment, application_name,
|
180
|
+
metrics, capture_message_content, disable_metrics, version, instance)
|
181
|
+
|
182
|
+
return response
|
openlit/semcov/__init__.py
CHANGED
@@ -23,6 +23,7 @@ class SemanticConvention:
|
|
23
23
|
|
24
24
|
# GenAI Metric Names (OTel Semconv)
|
25
25
|
GEN_AI_CLIENT_TOKEN_USAGE = "gen_ai.client.token.usage"
|
26
|
+
DB_CLIENT_TOKEN_USAGE = "db.client.token.usage"
|
26
27
|
GEN_AI_CLIENT_OPERATION_DURATION = "gen_ai.client.operation.duration"
|
27
28
|
GEN_AI_SERVER_REQUEST_DURATION = "gen_ai.server.request.duration"
|
28
29
|
GEN_AI_SERVER_TBT = "gen_ai.server.time_per_output_token"
|
@@ -56,9 +57,12 @@ class SemanticConvention:
|
|
56
57
|
GEN_AI_RESPONSE_FINISH_REASON = "gen_ai.response.finish_reasons"
|
57
58
|
GEN_AI_RESPONSE_ID = "gen_ai.response.id"
|
58
59
|
GEN_AI_RESPONSE_MODEL = "gen_ai.response.model"
|
60
|
+
|
59
61
|
GEN_AI_USAGE_INPUT_TOKENS = "gen_ai.usage.input_tokens"
|
60
62
|
GEN_AI_USAGE_OUTPUT_TOKENS = "gen_ai.usage.output_tokens"
|
61
63
|
GEN_AI_USAGE_REASONING_TOKENS = "gen_ai.usage.reasoning_tokens"
|
64
|
+
GEN_AI_USAGE_READ_UNITS = "gen_ai.usage.read_units"
|
65
|
+
GEN_AI_USAGE_RERANK_UNITS = "gen_ai.usage.rerank_units"
|
62
66
|
GEN_AI_TOOL_CALL_ID = "gen_ai.tool.call.id"
|
63
67
|
GEN_AI_TOOL_NAME = "gen_ai.tool.name"
|
64
68
|
GEN_AI_TOOL_ARGS = "gen_ai.tool.args"
|
@@ -190,6 +194,7 @@ class SemanticConvention:
|
|
190
194
|
DB_NAMESPACE = "db.namespace"
|
191
195
|
DB_OPERATION_NAME = "db.operation.name"
|
192
196
|
DB_QUERY_TEXT = "db.query.text"
|
197
|
+
DB_QUERY_SUMMARY = "db.query.summary"
|
193
198
|
DB_RESPONSE_RETURNED_ROWS = "db.response.returned_rows"
|
194
199
|
|
195
200
|
|
@@ -208,6 +213,8 @@ class SemanticConvention:
|
|
208
213
|
DB_OPERATION_INSERT = "INSERT"
|
209
214
|
DB_OPERATION_SELECT = "SELECT"
|
210
215
|
DB_OPERATION_QUERY = "QUERY"
|
216
|
+
DB_OPERATION_SEARCH = "SEARCH"
|
217
|
+
DB_OPERATION_FETCH = "FETCH"
|
211
218
|
DB_OPERATION_REPLACE = "findAndModify"
|
212
219
|
DB_OPERATION_FIND_AND_DELETE = "findAndDelete"
|
213
220
|
DB_OPERATION_DELETE = "DELETE"
|
@@ -217,7 +224,7 @@ class SemanticConvention:
|
|
217
224
|
DB_OPERATION_ADD = "ADD"
|
218
225
|
DB_OPERATION_PEEK = "peePEEKk"
|
219
226
|
DB_ID_COUNT = "db.ids_count"
|
220
|
-
DB_VECTOR_COUNT = "db.
|
227
|
+
DB_VECTOR_COUNT = "db.vector.count"
|
221
228
|
DB_METADATA = "db.metadata"
|
222
229
|
DB_METADATA_COUNT = "db.metadatas_count"
|
223
230
|
DB_DOCUMENTS_COUNT = "db.documents_count"
|
@@ -230,15 +237,20 @@ class SemanticConvention:
|
|
230
237
|
DB_N_RESULTS = "db.n_results"
|
231
238
|
DB_DELETE_ALL = "db.delete_all"
|
232
239
|
DB_INDEX_NAME = "db.index.name"
|
240
|
+
DB_COLLECTION_DIMENSION = "db.collection.dimension"
|
233
241
|
DB_INDEX_DIMENSION = "db.index.dimension"
|
234
242
|
DB_COLLECTION_DIMENSION = "db.collection.dimension"
|
243
|
+
DB_SEARCH_SIMILARITY_METRIC = "db.search.similarity_metric"
|
235
244
|
DB_INDEX_METRIC = "db.create_index.metric"
|
245
|
+
DB_COLLECTION_SPEC = "db.collection.spec"
|
236
246
|
DB_INDEX_SPEC = "db.create_index.spec"
|
237
247
|
DB_NAMESPACE = "db.query.namespace"
|
238
248
|
DB_UPDATE_METADATA = "db.update.metadata"
|
239
249
|
DB_UPDATE_VALUES = "db.update.values"
|
240
250
|
DB_UPDATE_ID = "db.update.id"
|
241
251
|
DB_DELETE_ID = "db.delete.id"
|
252
|
+
DB_VECTOR_QUERY_TOP_K = "db.vector.query.top_k"
|
253
|
+
DB_VECTOR_QUERY_FILTER = "db.vector.query.filter"
|
242
254
|
|
243
255
|
DB_SYSTEM_CHROMA = "chroma"
|
244
256
|
DB_SYSTEM_PINECONE = "pinecone"
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: openlit
|
3
|
-
Version: 1.34.
|
3
|
+
Version: 1.34.24
|
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
|
License: Apache-2.0
|
6
6
|
Keywords: OpenTelemetry,otel,otlp,llm,tracing,openai,anthropic,claude,cohere,llm monitoring,observability,monitoring,gpt,Generative AI,chatGPT,gpu
|
@@ -1,5 +1,5 @@
|
|
1
|
-
openlit/__helpers.py,sha256=
|
2
|
-
openlit/__init__.py,sha256=
|
1
|
+
openlit/__helpers.py,sha256=kfbLD_rtiOGhd79MuaRK6jjEvbrN8fhZ8b0DACEKkw4,18518
|
2
|
+
openlit/__init__.py,sha256=tYsR2OkDOq7Zf3wBOd3kFfosqUKgZxljMm6mZagMUiI,24296
|
3
3
|
openlit/evals/__init__.py,sha256=nJe99nuLo1b5rf7pt9U9BCdSDedzbVi2Fj96cgl7msM,380
|
4
4
|
openlit/evals/all.py,sha256=oWrue3PotE-rB5WePG3MRYSA-ro6WivkclSHjYlAqGs,7154
|
5
5
|
openlit/evals/bias_detection.py,sha256=mCdsfK7x1vX7S3psC3g641IMlZ-7df3h-V6eiICj5N8,8154
|
@@ -12,8 +12,10 @@ openlit/guard/prompt_injection.py,sha256=3e4DKxB7QDzM-xPCpwEuureiH_2s_OTJ9BSckkn
|
|
12
12
|
openlit/guard/restrict_topic.py,sha256=KTuWa7XeMsV4oXxOrD1CYZV0wXWxTfA0H3p_6q_IOsk,6444
|
13
13
|
openlit/guard/sensitive_topic.py,sha256=RgVw_laFERv0nNdzBsAd2_3yLomMOK-gVq-P7oj1bTk,5552
|
14
14
|
openlit/guard/utils.py,sha256=6hE3rCRjFXYjKRQYUo8YsqUSlvod48nOWp8MwoQEYdw,7670
|
15
|
-
openlit/instrumentation/ag2/__init__.py,sha256=
|
16
|
-
openlit/instrumentation/ag2/ag2.py,sha256=
|
15
|
+
openlit/instrumentation/ag2/__init__.py,sha256=vHKx7ybxwtNMGoIyU3lPp8t33m3lWyA_B-1HtJoW0v4,1880
|
16
|
+
openlit/instrumentation/ag2/ag2.py,sha256=ebsBWrXf7apjLumTB4hWw19-q9V0zacyDcJ-7oZoxew,3955
|
17
|
+
openlit/instrumentation/ag2/async_ag2.py,sha256=5OnM7tos-T5O6mmxhOVI1EO3J47wodC_HSJPWpvmauM,4031
|
18
|
+
openlit/instrumentation/ag2/utils.py,sha256=HwOqUQE4HqHLDLGf8nIPc_aiOVoV7iz30piw31F9pys,7073
|
17
19
|
openlit/instrumentation/ai21/__init__.py,sha256=tKX643fwxPWPJq1EXEZd0Xpd6B0jl_ViPFmJ87f5B08,2539
|
18
20
|
openlit/instrumentation/ai21/ai21.py,sha256=zyQMfCLcOFG1tQWrZmGeMaVAmj8MtCUeXQtPHmlUAO0,6533
|
19
21
|
openlit/instrumentation/ai21/async_ai21.py,sha256=q1Dhxru4tUJu0U1Px3PptNqrSGW0-VfRGcqkLKFR8vQ,6659
|
@@ -76,9 +78,14 @@ openlit/instrumentation/haystack/haystack.py,sha256=kPkuCJDrccNgAg3yDAHbvEytzyfM
|
|
76
78
|
openlit/instrumentation/julep/__init__.py,sha256=g-hwXjvXAb5IDs5DR_P8rKsnD4beB9tupAzuuviQT3k,3216
|
77
79
|
openlit/instrumentation/julep/async_julep.py,sha256=fPUOGAOIxelBt4cw-PGp5zj_B1nfj5ly3Dj0kelw3-s,5327
|
78
80
|
openlit/instrumentation/julep/julep.py,sha256=6rGgDOB7UzisgYsm12vnTy39dl9HAlRVBVByEr2116g,5330
|
79
|
-
openlit/instrumentation/langchain/__init__.py,sha256=
|
80
|
-
openlit/instrumentation/langchain/async_langchain.py,sha256=
|
81
|
-
openlit/instrumentation/langchain/langchain.py,sha256=
|
81
|
+
openlit/instrumentation/langchain/__init__.py,sha256=idjeMAL8tCf1KimrS82D4RERbicSxBj82e8WNuaZWs8,2996
|
82
|
+
openlit/instrumentation/langchain/async_langchain.py,sha256=5RtaBLifJoDYBPL3d53dT2GDmDzOh5oqyZeJIXAmWxg,3426
|
83
|
+
openlit/instrumentation/langchain/langchain.py,sha256=6jO5QAZz_jYyauEyQ76nbTpiNrTLPwLNPKzXmlBn75Y,3336
|
84
|
+
openlit/instrumentation/langchain/utils.py,sha256=ermEFuOY9Djh4Np4EHeh7XRzZc-B24A_CPLqkJhvzpY,10470
|
85
|
+
openlit/instrumentation/langchain_community/__init__.py,sha256=DGNxMj6RAMQtTFD0plU826D3G-KupROwexN4GjmAFmk,2717
|
86
|
+
openlit/instrumentation/langchain_community/async_langchain_community.py,sha256=BX6ErjSX9-RXBxB5cFwDrhVKpb3OGzwpzzw5VPMpp80,1590
|
87
|
+
openlit/instrumentation/langchain_community/langchain_community.py,sha256=J-sN5eGC7r-OkPAU-lnbdG7-b_jtYs0esmFy51xdFIk,1560
|
88
|
+
openlit/instrumentation/langchain_community/utils.py,sha256=v_QWgSbGZm4PIiInz6Ul4dz3h0lrWfLOX1Hj9pDERUI,3334
|
82
89
|
openlit/instrumentation/letta/__init__.py,sha256=K8PtRKxuueyqEYE3LzxWJ74IieNKSI6dmk9sNRd8Mt0,3031
|
83
90
|
openlit/instrumentation/letta/letta.py,sha256=SCIpJ4tdB1l1BmeQx4raaTS4MQO5X15pLvS4PepEKBE,8481
|
84
91
|
openlit/instrumentation/litellm/__init__.py,sha256=D47yfDLLEKpkaRAy7_Yif70kj88AGqLQYZAABpTN4sE,2284
|
@@ -110,8 +117,10 @@ openlit/instrumentation/openai_agents/__init__.py,sha256=tRTSIrUtkXc_lfQnVanXmQL
|
|
110
117
|
openlit/instrumentation/openai_agents/openai_agents.py,sha256=kRWPgjofcOviMi3w7CsRvJO3SCjqPmuq-PM800vIM7g,2678
|
111
118
|
openlit/instrumentation/phidata/__init__.py,sha256=tqls5-UI6FzbjxYgq_qqAfALhWJm8dHn2NtgqiQA4f8,1557
|
112
119
|
openlit/instrumentation/phidata/phidata.py,sha256=ohrxs6i0Oik75P2BrjNGbK71tdZg94ZMmaXixrXwV5M,4834
|
113
|
-
openlit/instrumentation/pinecone/__init__.py,sha256=
|
114
|
-
openlit/instrumentation/pinecone/
|
120
|
+
openlit/instrumentation/pinecone/__init__.py,sha256=DaWkIeG_ukn_JkBfz11TgPjORUUE9vPPjt42dH_26Jk,7210
|
121
|
+
openlit/instrumentation/pinecone/async_pinecone.py,sha256=JBQgro4GYQhnp7IMGnk0xmJQJrQZjuVyOwTRc8x3qQU,2098
|
122
|
+
openlit/instrumentation/pinecone/pinecone.py,sha256=_Jo_xh44sWDnqv2pA2Jx1ptDol25epJASfxKfHDHrzI,2056
|
123
|
+
openlit/instrumentation/pinecone/utils.py,sha256=_Ims5EwmuVd3r2OBg5If2JY7HqsPA_luhmLW9AMsUjw,8995
|
115
124
|
openlit/instrumentation/premai/__init__.py,sha256=3YlqyV-eNA_4aVUHDVUQUvGJRW8iVVcRtREw91yhbyw,1728
|
116
125
|
openlit/instrumentation/premai/premai.py,sha256=rWRqfoIZUbTz-M7zgC2Z92gTVv9fCj1Z4iJcsG86YeI,6438
|
117
126
|
openlit/instrumentation/premai/utils.py,sha256=K7EKGRDDh1X3OznG4z8H506zzFOHN6MH3oqtxM5eUyM,11409
|
@@ -142,8 +151,8 @@ openlit/instrumentation/vllm/vllm.py,sha256=VzazF2f4LLwjZDO_G8lIN_d622oSJM0fIO9w
|
|
142
151
|
openlit/otel/events.py,sha256=VrMjTpvnLtYRBHCiFwJojTQqqNpRCxoD4yJYeQrtPsk,3560
|
143
152
|
openlit/otel/metrics.py,sha256=GM2PDloBGRhBTkHHkYaqmOwIAQkY124ZhW4sEqW1Fgk,7086
|
144
153
|
openlit/otel/tracing.py,sha256=tjV2bEbEDPUB1Z46gE-UsJsb04sRdFrfbhIDkxViZc0,3103
|
145
|
-
openlit/semcov/__init__.py,sha256=
|
146
|
-
openlit-1.34.
|
147
|
-
openlit-1.34.
|
148
|
-
openlit-1.34.
|
149
|
-
openlit-1.34.
|
154
|
+
openlit/semcov/__init__.py,sha256=9QRSBwOvUS6z7T0HZkE9XlTEnqp-76R_BXM2o4IaEA8,14070
|
155
|
+
openlit-1.34.24.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
156
|
+
openlit-1.34.24.dist-info/METADATA,sha256=NKUgBOoqkr6scsH-Y8H6DVnjV6cf1Cqx0X5MVx1OPHk,23470
|
157
|
+
openlit-1.34.24.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
158
|
+
openlit-1.34.24.dist-info/RECORD,,
|
File without changes
|
File without changes
|