openlit 1.33.18__py3-none-any.whl → 1.33.20__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 +11 -41
- openlit/__init__.py +3 -3
- openlit/evals/utils.py +7 -7
- openlit/guard/utils.py +7 -7
- openlit/instrumentation/ag2/ag2.py +24 -24
- openlit/instrumentation/ai21/ai21.py +3 -3
- openlit/instrumentation/ai21/async_ai21.py +3 -3
- openlit/instrumentation/ai21/utils.py +59 -59
- openlit/instrumentation/anthropic/anthropic.py +2 -2
- openlit/instrumentation/anthropic/async_anthropic.py +2 -2
- openlit/instrumentation/anthropic/utils.py +34 -34
- openlit/instrumentation/assemblyai/assemblyai.py +24 -24
- openlit/instrumentation/astra/astra.py +3 -3
- openlit/instrumentation/astra/async_astra.py +3 -3
- openlit/instrumentation/astra/utils.py +39 -39
- openlit/instrumentation/azure_ai_inference/async_azure_ai_inference.py +10 -10
- openlit/instrumentation/azure_ai_inference/azure_ai_inference.py +10 -10
- openlit/instrumentation/azure_ai_inference/utils.py +38 -38
- openlit/instrumentation/bedrock/__init__.py +2 -1
- openlit/instrumentation/bedrock/bedrock.py +32 -214
- openlit/instrumentation/bedrock/utils.py +252 -0
- openlit/instrumentation/chroma/chroma.py +57 -57
- openlit/instrumentation/cohere/async_cohere.py +88 -88
- openlit/instrumentation/cohere/cohere.py +88 -88
- openlit/instrumentation/controlflow/controlflow.py +15 -15
- openlit/instrumentation/crawl4ai/async_crawl4ai.py +14 -14
- openlit/instrumentation/crawl4ai/crawl4ai.py +14 -14
- openlit/instrumentation/crewai/crewai.py +22 -22
- openlit/instrumentation/dynamiq/dynamiq.py +19 -19
- openlit/instrumentation/elevenlabs/async_elevenlabs.py +24 -25
- openlit/instrumentation/elevenlabs/elevenlabs.py +23 -25
- openlit/instrumentation/embedchain/embedchain.py +15 -15
- openlit/instrumentation/firecrawl/firecrawl.py +10 -10
- openlit/instrumentation/google_ai_studio/async_google_ai_studio.py +33 -33
- openlit/instrumentation/google_ai_studio/google_ai_studio.py +33 -33
- openlit/instrumentation/gpt4all/gpt4all.py +78 -78
- openlit/instrumentation/gpu/__init__.py +8 -8
- openlit/instrumentation/groq/async_groq.py +74 -74
- openlit/instrumentation/groq/groq.py +74 -74
- openlit/instrumentation/haystack/haystack.py +6 -6
- openlit/instrumentation/julep/async_julep.py +14 -14
- openlit/instrumentation/julep/julep.py +14 -14
- openlit/instrumentation/langchain/async_langchain.py +39 -39
- openlit/instrumentation/langchain/langchain.py +39 -39
- openlit/instrumentation/letta/letta.py +26 -26
- openlit/instrumentation/litellm/async_litellm.py +94 -94
- openlit/instrumentation/litellm/litellm.py +94 -94
- openlit/instrumentation/llamaindex/llamaindex.py +7 -7
- openlit/instrumentation/mem0/mem0.py +13 -13
- openlit/instrumentation/milvus/milvus.py +47 -47
- openlit/instrumentation/mistral/async_mistral.py +88 -88
- openlit/instrumentation/mistral/mistral.py +88 -88
- openlit/instrumentation/multion/async_multion.py +21 -21
- openlit/instrumentation/multion/multion.py +21 -21
- openlit/instrumentation/ollama/async_ollama.py +3 -3
- openlit/instrumentation/ollama/ollama.py +3 -3
- openlit/instrumentation/ollama/utils.py +50 -50
- openlit/instrumentation/openai/async_openai.py +225 -225
- openlit/instrumentation/openai/openai.py +225 -225
- openlit/instrumentation/openai_agents/openai_agents.py +11 -11
- openlit/instrumentation/phidata/phidata.py +15 -15
- openlit/instrumentation/pinecone/pinecone.py +43 -43
- openlit/instrumentation/premai/premai.py +86 -86
- openlit/instrumentation/qdrant/async_qdrant.py +95 -95
- openlit/instrumentation/qdrant/qdrant.py +99 -99
- openlit/instrumentation/reka/async_reka.py +33 -33
- openlit/instrumentation/reka/reka.py +33 -33
- openlit/instrumentation/together/async_together.py +90 -90
- openlit/instrumentation/together/together.py +90 -90
- openlit/instrumentation/transformers/transformers.py +26 -26
- openlit/instrumentation/vertexai/async_vertexai.py +64 -64
- openlit/instrumentation/vertexai/vertexai.py +64 -64
- openlit/instrumentation/vllm/vllm.py +24 -24
- openlit/otel/metrics.py +11 -11
- openlit/semcov/__init__.py +3 -3
- {openlit-1.33.18.dist-info → openlit-1.33.20.dist-info}/METADATA +8 -8
- openlit-1.33.20.dist-info/RECORD +131 -0
- {openlit-1.33.18.dist-info → openlit-1.33.20.dist-info}/WHEEL +1 -1
- openlit-1.33.18.dist-info/RECORD +0 -130
- {openlit-1.33.18.dist-info → openlit-1.33.20.dist-info}/LICENSE +0 -0
@@ -7,7 +7,7 @@ import logging
|
|
7
7
|
from opentelemetry.trace import SpanKind, Status, StatusCode
|
8
8
|
from opentelemetry.sdk.resources import SERVICE_NAME, TELEMETRY_SDK_NAME, DEPLOYMENT_ENVIRONMENT
|
9
9
|
from openlit.__helpers import handle_exception
|
10
|
-
from openlit.semcov import
|
10
|
+
from openlit.semcov import SemanticConvention
|
11
11
|
|
12
12
|
# Initialize logger for logging potential issues and operations
|
13
13
|
logger = logging.getLogger(__name__)
|
@@ -71,168 +71,168 @@ def async_general_wrap(gen_ai_endpoint, version, environment, application_name,
|
|
71
71
|
|
72
72
|
try:
|
73
73
|
span.set_attribute(TELEMETRY_SDK_NAME, "openlit")
|
74
|
-
span.set_attribute(
|
74
|
+
span.set_attribute(SemanticConvention.GEN_AI_ENDPOINT,
|
75
75
|
gen_ai_endpoint)
|
76
76
|
span.set_attribute(DEPLOYMENT_ENVIRONMENT,
|
77
77
|
environment)
|
78
78
|
span.set_attribute(SERVICE_NAME,
|
79
79
|
application_name)
|
80
|
-
span.set_attribute(
|
81
|
-
|
82
|
-
span.set_attribute(
|
83
|
-
|
80
|
+
span.set_attribute(SemanticConvention.GEN_AI_OPERATION,
|
81
|
+
SemanticConvention.GEN_AI_OPERATION_TYPE_VECTORDB)
|
82
|
+
span.set_attribute(SemanticConvention.DB_SYSTEM_NAME,
|
83
|
+
SemanticConvention.DB_SYSTEM_QDRANT)
|
84
84
|
|
85
85
|
if gen_ai_endpoint == "qdrant.create_collection":
|
86
|
-
db_operation =
|
87
|
-
span.set_attribute(
|
88
|
-
|
89
|
-
span.set_attribute(
|
86
|
+
db_operation = SemanticConvention.DB_OPERATION_CREATE_COLLECTION
|
87
|
+
span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
|
88
|
+
SemanticConvention.DB_OPERATION_CREATE_COLLECTION)
|
89
|
+
span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
|
90
90
|
kwargs.get("collection_name", ""))
|
91
91
|
|
92
92
|
elif gen_ai_endpoint == "qdrant.upload_collection":
|
93
|
-
db_operation =
|
94
|
-
span.set_attribute(
|
95
|
-
|
96
|
-
span.set_attribute(
|
93
|
+
db_operation = SemanticConvention.DB_OPERATION_CREATE_COLLECTION
|
94
|
+
span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
|
95
|
+
SemanticConvention.DB_OPERATION_CREATE_COLLECTION)
|
96
|
+
span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
|
97
97
|
kwargs.get("collection_name", ""))
|
98
98
|
|
99
99
|
elif gen_ai_endpoint == "qdrant.delete_collection":
|
100
|
-
db_operation =
|
101
|
-
span.set_attribute(
|
102
|
-
|
103
|
-
span.set_attribute(
|
100
|
+
db_operation = SemanticConvention.DB_OPERATION_DELETE_COLLECTION
|
101
|
+
span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
|
102
|
+
SemanticConvention.DB_OPERATION_DELETE_COLLECTION)
|
103
|
+
span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
|
104
104
|
kwargs.get("collection_name", ""))
|
105
105
|
|
106
106
|
elif gen_ai_endpoint == "qdrant.update_collection":
|
107
|
-
db_operation =
|
108
|
-
span.set_attribute(
|
109
|
-
|
110
|
-
span.set_attribute(
|
107
|
+
db_operation = SemanticConvention.DB_OPERATION_UPDATE_COLLECTION
|
108
|
+
span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
|
109
|
+
SemanticConvention.DB_OPERATION_UPDATE_COLLECTION)
|
110
|
+
span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
|
111
111
|
kwargs.get("collection_name", ""))
|
112
112
|
|
113
113
|
elif gen_ai_endpoint == "qdrant.set_payload":
|
114
|
-
db_operation =
|
115
|
-
span.set_attribute(
|
116
|
-
|
117
|
-
span.set_attribute(
|
114
|
+
db_operation = SemanticConvention.DB_OPERATION_ADD
|
115
|
+
span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
|
116
|
+
SemanticConvention.DB_OPERATION_ADD)
|
117
|
+
span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
|
118
118
|
kwargs.get("collection_name", ""))
|
119
|
-
span.set_attribute(
|
119
|
+
span.set_attribute(SemanticConvention.DB_OPERATION_STATUS,
|
120
120
|
response.status)
|
121
|
-
span.set_attribute(
|
121
|
+
span.set_attribute(SemanticConvention.DB_VECTOR_COUNT,
|
122
122
|
object_count(kwargs.get("points", [])))
|
123
|
-
span.set_attribute(
|
123
|
+
span.set_attribute(SemanticConvention.DB_PAYLOAD_COUNT,
|
124
124
|
object_count(kwargs.get("payload", [])))
|
125
125
|
|
126
126
|
elif gen_ai_endpoint == "qdrant.retrieve":
|
127
|
-
db_operation =
|
128
|
-
span.set_attribute(
|
129
|
-
|
130
|
-
span.set_attribute(
|
127
|
+
db_operation = SemanticConvention.DB_OPERATION_QUERY
|
128
|
+
span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
|
129
|
+
SemanticConvention.DB_OPERATION_QUERY)
|
130
|
+
span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
|
131
131
|
kwargs.get("collection_name", ""))
|
132
|
-
span.set_attribute(
|
132
|
+
span.set_attribute(SemanticConvention.DB_STATEMENT,
|
133
133
|
str(kwargs.get("ids", "")))
|
134
134
|
|
135
135
|
elif gen_ai_endpoint == "qdrant.scroll":
|
136
|
-
db_operation =
|
137
|
-
span.set_attribute(
|
138
|
-
|
139
|
-
span.set_attribute(
|
136
|
+
db_operation = SemanticConvention.DB_OPERATION_QUERY
|
137
|
+
span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
|
138
|
+
SemanticConvention.DB_OPERATION_QUERY)
|
139
|
+
span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
|
140
140
|
kwargs.get("collection_name", ""))
|
141
|
-
span.set_attribute(
|
141
|
+
span.set_attribute(SemanticConvention.DB_STATEMENT,
|
142
142
|
str(kwargs.get("scroll_filter", "")))
|
143
143
|
|
144
144
|
elif gen_ai_endpoint in ["qdrant.search", "qdrant.search_groups"]:
|
145
|
-
db_operation =
|
146
|
-
span.set_attribute(
|
147
|
-
|
148
|
-
span.set_attribute(
|
145
|
+
db_operation = SemanticConvention.DB_OPERATION_QUERY
|
146
|
+
span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
|
147
|
+
SemanticConvention.DB_OPERATION_QUERY)
|
148
|
+
span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
|
149
149
|
kwargs.get("collection_name", ""))
|
150
|
-
span.set_attribute(
|
150
|
+
span.set_attribute(SemanticConvention.DB_STATEMENT,
|
151
151
|
str(kwargs.get("query_vector", "")))
|
152
152
|
|
153
153
|
elif gen_ai_endpoint == "qdrant.recommend":
|
154
|
-
db_operation =
|
155
|
-
span.set_attribute(
|
156
|
-
|
157
|
-
span.set_attribute(
|
154
|
+
db_operation = SemanticConvention.DB_OPERATION_QUERY
|
155
|
+
span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
|
156
|
+
SemanticConvention.DB_OPERATION_QUERY)
|
157
|
+
span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
|
158
158
|
kwargs.get("collection_name", ""))
|
159
|
-
span.set_attribute(
|
159
|
+
span.set_attribute(SemanticConvention.DB_STATEMENT,
|
160
160
|
"positive:" + str(kwargs.get("positive", "")) +
|
161
161
|
" negative:" + str(kwargs.get("negative", "")))
|
162
162
|
|
163
163
|
elif gen_ai_endpoint == "qdrant.upload_points":
|
164
|
-
db_operation =
|
165
|
-
span.set_attribute(
|
166
|
-
|
167
|
-
span.set_attribute(
|
164
|
+
db_operation = SemanticConvention.DB_OPERATION_ADD
|
165
|
+
span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
|
166
|
+
SemanticConvention.DB_OPERATION_ADD)
|
167
|
+
span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
|
168
168
|
kwargs.get("collection_name", ""))
|
169
|
-
span.set_attribute(
|
169
|
+
span.set_attribute(SemanticConvention.DB_VECTOR_COUNT,
|
170
170
|
object_count(kwargs.get("points")))
|
171
171
|
|
172
172
|
elif gen_ai_endpoint == "qdrant.update_vectors":
|
173
|
-
db_operation =
|
174
|
-
span.set_attribute(
|
175
|
-
|
176
|
-
span.set_attribute(
|
173
|
+
db_operation = SemanticConvention.DB_OPERATION_UPDATE
|
174
|
+
span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
|
175
|
+
SemanticConvention.DB_OPERATION_UPDATE)
|
176
|
+
span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
|
177
177
|
kwargs.get("collection_name", ""))
|
178
|
-
span.set_attribute(
|
178
|
+
span.set_attribute(SemanticConvention.DB_OPERATION_STATUS,
|
179
179
|
response.status)
|
180
|
-
span.set_attribute(
|
180
|
+
span.set_attribute(SemanticConvention.DB_VECTOR_COUNT,
|
181
181
|
object_count(kwargs.get("points")))
|
182
182
|
|
183
183
|
elif gen_ai_endpoint == "qdrant.overwrite_payload":
|
184
|
-
db_operation =
|
185
|
-
span.set_attribute(
|
186
|
-
|
187
|
-
span.set_attribute(
|
184
|
+
db_operation = SemanticConvention.DB_OPERATION_UPDATE
|
185
|
+
span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
|
186
|
+
SemanticConvention.DB_OPERATION_UPDATE)
|
187
|
+
span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
|
188
188
|
kwargs.get("collection_name", ""))
|
189
|
-
span.set_attribute(
|
189
|
+
span.set_attribute(SemanticConvention.DB_OPERATION_STATUS,
|
190
190
|
response.status)
|
191
|
-
span.set_attribute(
|
191
|
+
span.set_attribute(SemanticConvention.DB_VECTOR_COUNT,
|
192
192
|
object_count(kwargs.get("points")))
|
193
|
-
span.set_attribute(
|
193
|
+
span.set_attribute(SemanticConvention.DB_PAYLOAD_COUNT,
|
194
194
|
object_count(kwargs.get("payload")))
|
195
195
|
|
196
196
|
elif gen_ai_endpoint == "qdrant.upsert":
|
197
|
-
db_operation =
|
198
|
-
span.set_attribute(
|
197
|
+
db_operation = SemanticConvention.DB_OPERATION_UPSERT
|
198
|
+
span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
|
199
199
|
kwargs.get("collection_name", ""))
|
200
|
-
span.set_attribute(
|
201
|
-
|
202
|
-
span.set_attribute(
|
200
|
+
span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
|
201
|
+
SemanticConvention.DB_OPERATION_UPSERT)
|
202
|
+
span.set_attribute(SemanticConvention.DB_OPERATION_STATUS,
|
203
203
|
response.status)
|
204
|
-
span.set_attribute(
|
204
|
+
span.set_attribute(SemanticConvention.DB_VECTOR_COUNT,
|
205
205
|
object_count(kwargs.get("points")))
|
206
206
|
|
207
207
|
elif gen_ai_endpoint in ["qdrant.delete_payload", "qdrant.delete_vectors"]:
|
208
|
-
db_operation =
|
209
|
-
span.set_attribute(
|
210
|
-
|
211
|
-
span.set_attribute(
|
208
|
+
db_operation = SemanticConvention.DB_OPERATION_DELETE
|
209
|
+
span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
|
210
|
+
SemanticConvention.DB_OPERATION_DELETE)
|
211
|
+
span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
|
212
212
|
kwargs.get("collection_name", ""))
|
213
|
-
span.set_attribute(
|
213
|
+
span.set_attribute(SemanticConvention.DB_OPERATION_STATUS,
|
214
214
|
response.status)
|
215
|
-
span.set_attribute(
|
215
|
+
span.set_attribute(SemanticConvention.DB_VECTOR_COUNT,
|
216
216
|
object_count(kwargs.get("points")))
|
217
217
|
|
218
218
|
elif gen_ai_endpoint in ["qdrant.clear_payload", "qdrant.delete"]:
|
219
|
-
db_operation =
|
220
|
-
span.set_attribute(
|
221
|
-
|
222
|
-
span.set_attribute(
|
219
|
+
db_operation = SemanticConvention.DB_OPERATION_DELETE
|
220
|
+
span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
|
221
|
+
SemanticConvention.DB_OPERATION_DELETE)
|
222
|
+
span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
|
223
223
|
kwargs.get("collection_name", ""))
|
224
|
-
span.set_attribute(
|
224
|
+
span.set_attribute(SemanticConvention.DB_OPERATION_STATUS,
|
225
225
|
response.status)
|
226
|
-
span.set_attribute(
|
226
|
+
span.set_attribute(SemanticConvention.DB_VECTOR_COUNT,
|
227
227
|
object_count(kwargs.get("points_selector")))
|
228
228
|
|
229
229
|
elif gen_ai_endpoint == "qdrant.create_payload_index":
|
230
|
-
db_operation =
|
231
|
-
span.set_attribute(
|
232
|
-
|
233
|
-
span.set_attribute(
|
230
|
+
db_operation = SemanticConvention.DB_OPERATION_CREATE_INDEX
|
231
|
+
span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
|
232
|
+
SemanticConvention.DB_OPERATION_CREATE_INDEX)
|
233
|
+
span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
|
234
234
|
kwargs.get("collection_name", ""))
|
235
|
-
span.set_attribute(
|
235
|
+
span.set_attribute(SemanticConvention.DB_STATEMENT,
|
236
236
|
str(kwargs.get("query", "")))
|
237
237
|
|
238
238
|
span.set_status(Status(StatusCode.OK))
|
@@ -243,13 +243,13 @@ def async_general_wrap(gen_ai_endpoint, version, environment, application_name,
|
|
243
243
|
"openlit",
|
244
244
|
SERVICE_NAME:
|
245
245
|
application_name,
|
246
|
-
|
247
|
-
|
246
|
+
SemanticConvention.DB_SYSTEM_NAME:
|
247
|
+
SemanticConvention.DB_SYSTEM_QDRANT,
|
248
248
|
DEPLOYMENT_ENVIRONMENT:
|
249
249
|
environment,
|
250
|
-
|
251
|
-
|
252
|
-
|
250
|
+
SemanticConvention.GEN_AI_OPERATION:
|
251
|
+
SemanticConvention.GEN_AI_OPERATION_TYPE_VECTORDB,
|
252
|
+
SemanticConvention.DB_OPERATION_NAME:
|
253
253
|
db_operation
|
254
254
|
}
|
255
255
|
|
@@ -7,7 +7,7 @@ import logging
|
|
7
7
|
from opentelemetry.trace import SpanKind, Status, StatusCode
|
8
8
|
from opentelemetry.sdk.resources import SERVICE_NAME, TELEMETRY_SDK_NAME, DEPLOYMENT_ENVIRONMENT
|
9
9
|
from openlit.__helpers import handle_exception
|
10
|
-
from openlit.semcov import
|
10
|
+
from openlit.semcov import SemanticConvention
|
11
11
|
|
12
12
|
# Initialize logger for logging potential issues and operations
|
13
13
|
logger = logging.getLogger(__name__)
|
@@ -71,175 +71,175 @@ def general_wrap(gen_ai_endpoint, version, environment, application_name,
|
|
71
71
|
|
72
72
|
try:
|
73
73
|
span.set_attribute(TELEMETRY_SDK_NAME, "openlit")
|
74
|
-
span.set_attribute(
|
74
|
+
span.set_attribute(SemanticConvention.GEN_AI_ENDPOINT,
|
75
75
|
gen_ai_endpoint)
|
76
76
|
span.set_attribute(DEPLOYMENT_ENVIRONMENT,
|
77
77
|
environment)
|
78
78
|
span.set_attribute(SERVICE_NAME,
|
79
79
|
application_name)
|
80
|
-
span.set_attribute(
|
81
|
-
|
82
|
-
span.set_attribute(
|
83
|
-
|
80
|
+
span.set_attribute(SemanticConvention.GEN_AI_OPERATION,
|
81
|
+
SemanticConvention.GEN_AI_OPERATION_TYPE_VECTORDB)
|
82
|
+
span.set_attribute(SemanticConvention.DB_SYSTEM_NAME,
|
83
|
+
SemanticConvention.DB_SYSTEM_QDRANT)
|
84
84
|
|
85
85
|
if gen_ai_endpoint == "qdrant.create_collection":
|
86
|
-
db_operation =
|
87
|
-
span.set_attribute(
|
88
|
-
|
89
|
-
span.set_attribute(
|
86
|
+
db_operation = SemanticConvention.DB_OPERATION_CREATE_COLLECTION
|
87
|
+
span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
|
88
|
+
SemanticConvention.DB_OPERATION_CREATE_COLLECTION)
|
89
|
+
span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
|
90
90
|
kwargs.get("collection_name", ""))
|
91
91
|
|
92
92
|
elif gen_ai_endpoint == "qdrant.upload_collection":
|
93
|
-
db_operation =
|
94
|
-
span.set_attribute(
|
95
|
-
|
96
|
-
span.set_attribute(
|
93
|
+
db_operation = SemanticConvention.DB_OPERATION_CREATE_COLLECTION
|
94
|
+
span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
|
95
|
+
SemanticConvention.DB_OPERATION_CREATE_COLLECTION)
|
96
|
+
span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
|
97
97
|
kwargs.get("collection_name", ""))
|
98
98
|
|
99
99
|
elif gen_ai_endpoint == "qdrant.delete_collection":
|
100
|
-
db_operation =
|
101
|
-
span.set_attribute(
|
102
|
-
|
103
|
-
span.set_attribute(
|
100
|
+
db_operation = SemanticConvention.DB_OPERATION_DELETE_COLLECTION
|
101
|
+
span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
|
102
|
+
SemanticConvention.DB_OPERATION_DELETE_COLLECTION)
|
103
|
+
span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
|
104
104
|
kwargs.get("collection_name", ""))
|
105
105
|
|
106
106
|
elif gen_ai_endpoint == "qdrant.update_collection":
|
107
|
-
db_operation =
|
108
|
-
span.set_attribute(
|
109
|
-
|
110
|
-
span.set_attribute(
|
107
|
+
db_operation = SemanticConvention.DB_OPERATION_UPDATE_COLLECTION
|
108
|
+
span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
|
109
|
+
SemanticConvention.DB_OPERATION_UPDATE_COLLECTION)
|
110
|
+
span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
|
111
111
|
kwargs.get("collection_name", ""))
|
112
112
|
|
113
113
|
elif gen_ai_endpoint == "qdrant.set_payload":
|
114
|
-
db_operation =
|
115
|
-
span.set_attribute(
|
116
|
-
|
117
|
-
span.set_attribute(
|
114
|
+
db_operation = SemanticConvention.DB_OPERATION_ADD
|
115
|
+
span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
|
116
|
+
SemanticConvention.DB_OPERATION_ADD)
|
117
|
+
span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
|
118
118
|
kwargs.get("collection_name", ""))
|
119
|
-
span.set_attribute(
|
119
|
+
span.set_attribute(SemanticConvention.DB_OPERATION_STATUS,
|
120
120
|
response.status)
|
121
|
-
span.set_attribute(
|
121
|
+
span.set_attribute(SemanticConvention.DB_VECTOR_COUNT,
|
122
122
|
object_count(kwargs.get("points", [])))
|
123
|
-
span.set_attribute(
|
123
|
+
span.set_attribute(SemanticConvention.DB_PAYLOAD_COUNT,
|
124
124
|
object_count(kwargs.get("payload", [])))
|
125
125
|
|
126
126
|
elif gen_ai_endpoint == "qdrant.retrieve":
|
127
|
-
db_operation =
|
128
|
-
span.set_attribute(
|
129
|
-
|
130
|
-
span.set_attribute(
|
127
|
+
db_operation = SemanticConvention.DB_OPERATION_QUERY
|
128
|
+
span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
|
129
|
+
SemanticConvention.DB_OPERATION_QUERY)
|
130
|
+
span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
|
131
131
|
kwargs.get("collection_name", ""))
|
132
|
-
span.set_attribute(
|
132
|
+
span.set_attribute(SemanticConvention.DB_STATEMENT,
|
133
133
|
str(kwargs.get("ids", "")))
|
134
134
|
|
135
135
|
elif gen_ai_endpoint == "qdrant.scroll":
|
136
|
-
db_operation =
|
137
|
-
span.set_attribute(
|
138
|
-
|
139
|
-
span.set_attribute(
|
136
|
+
db_operation = SemanticConvention.DB_OPERATION_QUERY
|
137
|
+
span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
|
138
|
+
SemanticConvention.DB_OPERATION_QUERY)
|
139
|
+
span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
|
140
140
|
kwargs.get("collection_name", ""))
|
141
|
-
span.set_attribute(
|
141
|
+
span.set_attribute(SemanticConvention.DB_STATEMENT,
|
142
142
|
str(kwargs.get("scroll_filter", "")))
|
143
143
|
|
144
144
|
elif gen_ai_endpoint in ["qdrant.search", "qdrant.search_groups"]:
|
145
|
-
db_operation =
|
146
|
-
span.set_attribute(
|
147
|
-
|
148
|
-
span.set_attribute(
|
145
|
+
db_operation = SemanticConvention.DB_OPERATION_QUERY
|
146
|
+
span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
|
147
|
+
SemanticConvention.DB_OPERATION_QUERY)
|
148
|
+
span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
|
149
149
|
kwargs.get("collection_name", ""))
|
150
|
-
span.set_attribute(
|
150
|
+
span.set_attribute(SemanticConvention.DB_STATEMENT,
|
151
151
|
str(kwargs.get("query_vector", "")))
|
152
152
|
|
153
153
|
elif gen_ai_endpoint == "qdrant.recommend":
|
154
|
-
db_operation =
|
155
|
-
span.set_attribute(
|
156
|
-
|
157
|
-
span.set_attribute(
|
154
|
+
db_operation = SemanticConvention.DB_OPERATION_QUERY
|
155
|
+
span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
|
156
|
+
SemanticConvention.DB_OPERATION_QUERY)
|
157
|
+
span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
|
158
158
|
kwargs.get("collection_name", ""))
|
159
|
-
span.set_attribute(
|
159
|
+
span.set_attribute(SemanticConvention.DB_STATEMENT,
|
160
160
|
"positive:" + str(kwargs.get("positive", "")) +
|
161
161
|
" negative:" + str(kwargs.get("negative", "")))
|
162
162
|
|
163
163
|
elif gen_ai_endpoint == "qdrant.upload_points":
|
164
|
-
db_operation =
|
165
|
-
span.set_attribute(
|
166
|
-
|
167
|
-
span.set_attribute(
|
164
|
+
db_operation = SemanticConvention.DB_OPERATION_ADD
|
165
|
+
span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
|
166
|
+
SemanticConvention.DB_OPERATION_ADD)
|
167
|
+
span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
|
168
168
|
kwargs.get("collection_name", ""))
|
169
|
-
span.set_attribute(
|
169
|
+
span.set_attribute(SemanticConvention.DB_VECTOR_COUNT,
|
170
170
|
object_count(kwargs.get("points")))
|
171
171
|
|
172
172
|
elif gen_ai_endpoint == "qdrant.update_vectors":
|
173
|
-
db_operation =
|
174
|
-
span.set_attribute(
|
175
|
-
|
176
|
-
span.set_attribute(
|
173
|
+
db_operation = SemanticConvention.DB_OPERATION_UPDATE
|
174
|
+
span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
|
175
|
+
SemanticConvention.DB_OPERATION_UPDATE)
|
176
|
+
span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
|
177
177
|
kwargs.get("collection_name", ""))
|
178
|
-
span.set_attribute(
|
178
|
+
span.set_attribute(SemanticConvention.DB_OPERATION_STATUS,
|
179
179
|
response.status)
|
180
|
-
span.set_attribute(
|
180
|
+
span.set_attribute(SemanticConvention.DB_VECTOR_COUNT,
|
181
181
|
object_count(kwargs.get("points")))
|
182
182
|
|
183
183
|
elif gen_ai_endpoint == "qdrant.overwrite_payload":
|
184
|
-
db_operation =
|
185
|
-
span.set_attribute(
|
186
|
-
|
187
|
-
span.set_attribute(
|
184
|
+
db_operation = SemanticConvention.DB_OPERATION_UPDATE
|
185
|
+
span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
|
186
|
+
SemanticConvention.DB_OPERATION_UPDATE)
|
187
|
+
span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
|
188
188
|
kwargs.get("collection_name", ""))
|
189
|
-
span.set_attribute(
|
189
|
+
span.set_attribute(SemanticConvention.DB_OPERATION_STATUS,
|
190
190
|
response.status)
|
191
|
-
span.set_attribute(
|
191
|
+
span.set_attribute(SemanticConvention.DB_VECTOR_COUNT,
|
192
192
|
object_count(kwargs.get("points")))
|
193
|
-
span.set_attribute(
|
193
|
+
span.set_attribute(SemanticConvention.DB_PAYLOAD_COUNT,
|
194
194
|
object_count(kwargs.get("payload")))
|
195
195
|
|
196
196
|
elif gen_ai_endpoint == "qdrant.upsert":
|
197
|
-
db_operation =
|
198
|
-
span.set_attribute(
|
197
|
+
db_operation = SemanticConvention.DB_OPERATION_UPSERT
|
198
|
+
span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
|
199
199
|
kwargs.get("collection_name", ""))
|
200
|
-
span.set_attribute(
|
201
|
-
|
202
|
-
span.set_attribute(
|
200
|
+
span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
|
201
|
+
SemanticConvention.DB_OPERATION_UPSERT)
|
202
|
+
span.set_attribute(SemanticConvention.DB_OPERATION_STATUS,
|
203
203
|
response.status)
|
204
|
-
span.set_attribute(
|
204
|
+
span.set_attribute(SemanticConvention.DB_VECTOR_COUNT,
|
205
205
|
object_count(kwargs.get("points")))
|
206
206
|
|
207
207
|
elif gen_ai_endpoint in ["qdrant.delete_payload", "qdrant.delete_vectors"]:
|
208
|
-
db_operation =
|
209
|
-
span.set_attribute(
|
210
|
-
|
211
|
-
span.set_attribute(
|
208
|
+
db_operation = SemanticConvention.DB_OPERATION_DELETE
|
209
|
+
span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
|
210
|
+
SemanticConvention.DB_OPERATION_DELETE)
|
211
|
+
span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
|
212
212
|
kwargs.get("collection_name", ""))
|
213
|
-
span.set_attribute(
|
213
|
+
span.set_attribute(SemanticConvention.DB_OPERATION_STATUS,
|
214
214
|
response.status)
|
215
|
-
span.set_attribute(
|
215
|
+
span.set_attribute(SemanticConvention.DB_VECTOR_COUNT,
|
216
216
|
object_count(kwargs.get("points")))
|
217
217
|
|
218
218
|
elif gen_ai_endpoint in ["qdrant.clear_payload", "qdrant.delete"]:
|
219
|
-
db_operation =
|
220
|
-
span.set_attribute(
|
221
|
-
|
222
|
-
span.set_attribute(
|
219
|
+
db_operation = SemanticConvention.DB_OPERATION_DELETE
|
220
|
+
span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
|
221
|
+
SemanticConvention.DB_OPERATION_DELETE)
|
222
|
+
span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
|
223
223
|
kwargs.get("collection_name", ""))
|
224
|
-
span.set_attribute(
|
224
|
+
span.set_attribute(SemanticConvention.DB_OPERATION_STATUS,
|
225
225
|
response.status)
|
226
|
-
span.set_attribute(
|
226
|
+
span.set_attribute(SemanticConvention.DB_VECTOR_COUNT,
|
227
227
|
object_count(kwargs.get("points_selector")))
|
228
228
|
|
229
229
|
elif gen_ai_endpoint == "qdrant.create_payload_index":
|
230
|
-
db_operation =
|
231
|
-
span.set_attribute(
|
232
|
-
|
233
|
-
span.set_attribute(
|
230
|
+
db_operation = SemanticConvention.DB_OPERATION_CREATE_INDEX
|
231
|
+
span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
|
232
|
+
SemanticConvention.DB_OPERATION_CREATE_INDEX)
|
233
|
+
span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
|
234
234
|
kwargs.get("collection_name", ""))
|
235
235
|
|
236
236
|
elif gen_ai_endpoint == "qdrant.query_points":
|
237
|
-
db_operation =
|
238
|
-
span.set_attribute(
|
239
|
-
|
240
|
-
span.set_attribute(
|
237
|
+
db_operation = SemanticConvention.DB_OPERATION_QUERY
|
238
|
+
span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
|
239
|
+
SemanticConvention.DB_OPERATION_QUERY)
|
240
|
+
span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
|
241
241
|
kwargs.get("collection_name", ""))
|
242
|
-
span.set_attribute(
|
242
|
+
span.set_attribute(SemanticConvention.DB_STATEMENT,
|
243
243
|
str(kwargs.get("query", "")))
|
244
244
|
|
245
245
|
span.set_status(Status(StatusCode.OK))
|
@@ -250,13 +250,13 @@ def general_wrap(gen_ai_endpoint, version, environment, application_name,
|
|
250
250
|
"openlit",
|
251
251
|
SERVICE_NAME:
|
252
252
|
application_name,
|
253
|
-
|
254
|
-
|
253
|
+
SemanticConvention.DB_SYSTEM_NAME:
|
254
|
+
SemanticConvention.DB_SYSTEM_QDRANT,
|
255
255
|
DEPLOYMENT_ENVIRONMENT:
|
256
256
|
environment,
|
257
|
-
|
258
|
-
|
259
|
-
|
257
|
+
SemanticConvention.GEN_AI_OPERATION:
|
258
|
+
SemanticConvention.GEN_AI_OPERATION_TYPE_VECTORDB,
|
259
|
+
SemanticConvention.DB_OPERATION_NAME:
|
260
260
|
db_operation
|
261
261
|
}
|
262
262
|
|