diff --git a/.github/dependabot.yml b/.github/dependabot.yml
index 01d2901e..425d305c 100644
--- a/.github/dependabot.yml
+++ b/.github/dependabot.yml
@@ -46,6 +46,12 @@ updates:
interval: "weekly"
labels:
- "instrumentation-pinecone"
+ - package-ecosystem: "npm"
+ directory: "/packages/instrumentation-qdrant"
+ schedule:
+ interval: "weekly"
+ labels:
+ - "instrumentation-qdrant"
- package-ecosystem: "npm"
directory: "/packages/instrumentation-vertexai"
schedule:
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 8607705d..03b28312 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -28,6 +28,11 @@ jobs:
build-and-test:
name: Build and test
runs-on: ubuntu-latest
+ services:
+ qdrant:
+ image: qdrant/qdrant
+ ports:
+ - 6333:6333
permissions:
contents: "read"
id-token: "write"
diff --git a/.python-version b/.python-version
new file mode 100644
index 00000000..9919bf8c
--- /dev/null
+++ b/.python-version
@@ -0,0 +1 @@
+3.10.13
diff --git a/CHANGELOG.md b/CHANGELOG.md
index bc48c1fc..08f75ede 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+# [0.9.0](https://github.com/traceloop/openllmetry-js/compare/v0.8.9...v0.9.0) (2024-07-04)
+
+### Bug Fixes
+
+- **sdk:** option to silence initialization message ([#343](https://github.com/traceloop/openllmetry-js/issues/343)) ([75c68ce](https://github.com/traceloop/openllmetry-js/commit/75c68ceb09dec3766f30ed413bdeee637e1734a6))
+- **sdk:** versions on workflows & tasks ([#353](https://github.com/traceloop/openllmetry-js/issues/353)) ([eb6211f](https://github.com/traceloop/openllmetry-js/commit/eb6211f5cc9a2930c6bff1d9ffe3cb995eaf6669))
+
+### Features
+
+- Qdrant instrumentation ([#278](https://github.com/traceloop/openllmetry-js/issues/278)) ([3b8224f](https://github.com/traceloop/openllmetry-js/commit/3b8224fac062b6da3f84311569a5ffcc2e3b8744))
+
## [0.8.9](https://github.com/traceloop/openllmetry-js/compare/v0.8.8...v0.8.9) (2024-06-17)
### Bug Fixes
diff --git a/README.md b/README.md
index 01378e2b..67461906 100644
--- a/README.md
+++ b/README.md
@@ -119,6 +119,7 @@ OpenLLMetry-JS can instrument everything that [OpenTelemetry already instruments
- ✅ Pinecone
- ✅ Chroma
+- ✅ Qdrant
- ⏳ Weaviate
- ⏳ Milvus
diff --git a/lerna.json b/lerna.json
index c4d725fa..69efa029 100644
--- a/lerna.json
+++ b/lerna.json
@@ -1,6 +1,6 @@
{
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
- "version": "0.8.9",
+ "version": "0.9.0",
"packages": ["packages/*"],
"useNx": true
}
diff --git a/package-lock.json b/package-lock.json
index bccf91be..905fe9c7 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -6034,13 +6034,13 @@
}
},
"node_modules/@opentelemetry/instrumentation": {
- "version": "0.52.0",
- "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation/-/instrumentation-0.52.0.tgz",
- "integrity": "sha512-LPwSIrw+60cheWaXsfGL8stBap/AppKQJFE+qqRvzYrgttXFH2ofoIMxWadeqPTq4BYOXM/C7Bdh/T+B60xnlQ==",
+ "version": "0.52.1",
+ "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation/-/instrumentation-0.52.1.tgz",
+ "integrity": "sha512-uXJbYU/5/MBHjMp1FqrILLRuiJCs3Ofk0MeRDk8g1S1gD47U8X3JnSwcMO1rtRo1x1a7zKaQHaoYu49p/4eSKw==",
"dependencies": {
- "@opentelemetry/api-logs": "0.52.0",
+ "@opentelemetry/api-logs": "0.52.1",
"@types/shimmer": "^1.0.2",
- "import-in-the-middle": "1.8.0",
+ "import-in-the-middle": "^1.8.1",
"require-in-the-middle": "^7.1.1",
"semver": "^7.5.2",
"shimmer": "^1.2.1"
@@ -6053,9 +6053,9 @@
}
},
"node_modules/@opentelemetry/instrumentation/node_modules/@opentelemetry/api-logs": {
- "version": "0.52.0",
- "resolved": "https://registry.npmjs.org/@opentelemetry/api-logs/-/api-logs-0.52.0.tgz",
- "integrity": "sha512-HxjD7xH9iAE4OyhNaaSec65i1H6QZYBWSwWkowFfsc5YAcDvJG30/J1sRKXEQqdmUcKTXEAnA66UciqZha/4+Q==",
+ "version": "0.52.1",
+ "resolved": "https://registry.npmjs.org/@opentelemetry/api-logs/-/api-logs-0.52.1.tgz",
+ "integrity": "sha512-qnSqB2DQ9TPP96dl8cDubDvrUyWc0/sK81xHTK8eSUspzDM3bsewX903qclQFvVhgStjRWdC5bLb3kQqMkfV5A==",
"dependencies": {
"@opentelemetry/api": "^1.0.0"
},
@@ -6526,20 +6526,20 @@
"integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw=="
},
"node_modules/@qdrant/js-client-rest": {
- "version": "1.7.0",
- "resolved": "https://registry.npmjs.org/@qdrant/js-client-rest/-/js-client-rest-1.7.0.tgz",
- "integrity": "sha512-16O0EQfrrybcPVipodxykr6dMUlBzKW7a63cSDUFVgc5a1AWESwERykwjuvW5KqvKdkPcxZ2NssrvgUO1W3MgA==",
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/@qdrant/js-client-rest/-/js-client-rest-1.9.0.tgz",
+ "integrity": "sha512-YiX/IskbRCoAY2ujyPDI6FBcO0ygAS4pgkGaJ7DcrJFh4SZV2XHs+u0KM7mO72RWJn1eJQFF2PQwxG+401xxJg==",
"dependencies": {
- "@qdrant/openapi-typescript-fetch": "^1.2.1",
- "@sevinf/maybe": "^0.5.0",
- "undici": "^5.26.2"
+ "@qdrant/openapi-typescript-fetch": "1.2.6",
+ "@sevinf/maybe": "0.5.0",
+ "undici": "~5.28.4"
},
"engines": {
"node": ">=18.0.0",
"pnpm": ">=8"
},
"peerDependencies": {
- "typescript": ">=4.1"
+ "typescript": ">=4.7"
}
},
"node_modules/@qdrant/openapi-typescript-fetch": {
@@ -8044,6 +8044,10 @@
"resolved": "packages/instrumentation-pinecone",
"link": true
},
+ "node_modules/@traceloop/instrumentation-qdrant": {
+ "resolved": "packages/instrumentation-qdrant",
+ "link": true
+ },
"node_modules/@traceloop/instrumentation-vertexai": {
"resolved": "packages/instrumentation-vertexai",
"link": true
@@ -13492,9 +13496,9 @@
}
},
"node_modules/import-in-the-middle": {
- "version": "1.8.0",
- "resolved": "https://registry.npmjs.org/import-in-the-middle/-/import-in-the-middle-1.8.0.tgz",
- "integrity": "sha512-/xQjze8szLNnJ5rvHSzn+dcVXqCAU6Plbk4P24U/jwPmg1wy7IIp9OjKIO5tYue8GSPhDpPDiApQjvBUmWwhsQ==",
+ "version": "1.8.1",
+ "resolved": "https://registry.npmjs.org/import-in-the-middle/-/import-in-the-middle-1.8.1.tgz",
+ "integrity": "sha512-yhRwoHtiLGvmSozNOALgjRPFI6uYsds60EoMqqnXyyv+JOIW/BrrLejuTGBt+bq0T5tLzOHrN0T7xYTm4Qt/ng==",
"dependencies": {
"acorn": "^8.8.2",
"acorn-import-attributes": "^1.9.5",
@@ -22914,7 +22918,7 @@
},
"packages/ai-semantic-conventions": {
"name": "@traceloop/ai-semantic-conventions",
- "version": "0.8.0",
+ "version": "0.9.0",
"license": "Apache-2.0",
"dependencies": {
"@opentelemetry/api": "^1.7.0"
@@ -22925,13 +22929,13 @@
},
"packages/instrumentation-anthropic": {
"name": "@traceloop/instrumentation-anthropic",
- "version": "0.8.8",
+ "version": "0.9.0",
"license": "Apache-2.0",
"dependencies": {
"@opentelemetry/core": "^1.25.0",
"@opentelemetry/instrumentation": "^0.52.0",
"@opentelemetry/semantic-conventions": "^1.25.0",
- "@traceloop/ai-semantic-conventions": "^0.8.0"
+ "@traceloop/ai-semantic-conventions": "^0.9.0"
},
"devDependencies": {
"@anthropic-ai/sdk": "^0.20.1",
@@ -22994,13 +22998,13 @@
},
"packages/instrumentation-azure": {
"name": "@traceloop/instrumentation-azure",
- "version": "0.8.8",
+ "version": "0.9.0",
"license": "Apache-2.0",
"dependencies": {
"@opentelemetry/core": "^1.25.0",
"@opentelemetry/instrumentation": "^0.52.0",
"@opentelemetry/semantic-conventions": "^1.25.0",
- "@traceloop/ai-semantic-conventions": "^0.8.0"
+ "@traceloop/ai-semantic-conventions": "^0.9.0"
},
"devDependencies": {
"@azure/openai": "^1.0.0-beta.10",
@@ -23038,13 +23042,13 @@
},
"packages/instrumentation-bedrock": {
"name": "@traceloop/instrumentation-bedrock",
- "version": "0.8.8",
+ "version": "0.9.0",
"license": "Apache-2.0",
"dependencies": {
"@opentelemetry/core": "^1.25.0",
"@opentelemetry/instrumentation": "^0.52.0",
"@opentelemetry/semantic-conventions": "^1.25.0",
- "@traceloop/ai-semantic-conventions": "^0.8.0"
+ "@traceloop/ai-semantic-conventions": "^0.9.0"
},
"devDependencies": {
"@aws-sdk/client-bedrock-runtime": "^3.499.0",
@@ -23080,13 +23084,13 @@
},
"packages/instrumentation-chromadb": {
"name": "@traceloop/instrumentation-chromadb",
- "version": "0.8.8",
+ "version": "0.9.0",
"license": "Apache-2.0",
"dependencies": {
"@opentelemetry/core": "^1.25.0",
"@opentelemetry/instrumentation": "^0.52.0",
"@opentelemetry/semantic-conventions": "^1.25.0",
- "@traceloop/ai-semantic-conventions": "^0.8.0"
+ "@traceloop/ai-semantic-conventions": "^0.9.0"
},
"devDependencies": {
"@pollyjs/adapter-node-http": "^6.0.6",
@@ -23151,13 +23155,13 @@
},
"packages/instrumentation-cohere": {
"name": "@traceloop/instrumentation-cohere",
- "version": "0.8.8",
+ "version": "0.9.0",
"license": "Apache-2.0",
"dependencies": {
"@opentelemetry/core": "^1.25.0",
"@opentelemetry/instrumentation": "^0.52.0",
"@opentelemetry/semantic-conventions": "^1.25.0",
- "@traceloop/ai-semantic-conventions": "^0.8.0"
+ "@traceloop/ai-semantic-conventions": "^0.9.0"
},
"devDependencies": {
"@pollyjs/adapter-node-http": "^6.0.6",
@@ -23193,13 +23197,13 @@
},
"packages/instrumentation-langchain": {
"name": "@traceloop/instrumentation-langchain",
- "version": "0.8.8",
+ "version": "0.9.0",
"license": "Apache-2.0",
"dependencies": {
"@opentelemetry/core": "^1.25.0",
"@opentelemetry/instrumentation": "^0.52.0",
"@opentelemetry/semantic-conventions": "^1.25.0",
- "@traceloop/ai-semantic-conventions": "^0.8.0"
+ "@traceloop/ai-semantic-conventions": "^0.9.0"
},
"devDependencies": {
"@langchain/community": "^0.0.34",
@@ -23775,13 +23779,13 @@
},
"packages/instrumentation-llamaindex": {
"name": "@traceloop/instrumentation-llamaindex",
- "version": "0.8.8",
+ "version": "0.9.0",
"license": "Apache-2.0",
"dependencies": {
"@opentelemetry/core": "^1.25.0",
"@opentelemetry/instrumentation": "^0.52.0",
"@opentelemetry/semantic-conventions": "^1.25.0",
- "@traceloop/ai-semantic-conventions": "^0.8.0",
+ "@traceloop/ai-semantic-conventions": "^0.9.0",
"lodash": "^4.17.21"
},
"devDependencies": {
@@ -23820,13 +23824,13 @@
},
"packages/instrumentation-openai": {
"name": "@traceloop/instrumentation-openai",
- "version": "0.8.8",
+ "version": "0.9.0",
"license": "Apache-2.0",
"dependencies": {
"@opentelemetry/core": "^1.25.0",
"@opentelemetry/instrumentation": "^0.52.0",
"@opentelemetry/semantic-conventions": "^1.25.0",
- "@traceloop/ai-semantic-conventions": "^0.8.0",
+ "@traceloop/ai-semantic-conventions": "^0.9.0",
"js-tiktoken": "^1.0.12"
},
"devDependencies": {
@@ -23866,13 +23870,13 @@
},
"packages/instrumentation-pinecone": {
"name": "@traceloop/instrumentation-pinecone",
- "version": "0.8.8",
+ "version": "0.9.0",
"license": "Apache-2.0",
"dependencies": {
"@opentelemetry/core": "^1.25.0",
"@opentelemetry/instrumentation": "^0.52.0",
"@opentelemetry/semantic-conventions": "^1.25.0",
- "@traceloop/ai-semantic-conventions": "^0.8.0"
+ "@traceloop/ai-semantic-conventions": "^0.9.0"
},
"devDependencies": {
"@pinecone-database/pinecone": "^2.0.1",
@@ -23906,15 +23910,48 @@
"node": ">=14"
}
},
+ "packages/instrumentation-qdrant": {
+ "name": "@traceloop/instrumentation-qdrant",
+ "version": "0.9.0",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@opentelemetry/core": "^1.8.0",
+ "@opentelemetry/instrumentation": "^0.52.0",
+ "@traceloop/ai-semantic-conventions": "^0.9.0"
+ },
+ "devDependencies": {
+ "@pollyjs/adapter-node-http": "^6.0.6",
+ "@pollyjs/core": "^6.0.6",
+ "@pollyjs/persister-fs": "^6.0.6",
+ "@qdrant/js-client-rest": "^1.9.0",
+ "uuid": "^10.0.0"
+ },
+ "engines": {
+ "node": ">=14"
+ }
+ },
+ "packages/instrumentation-qdrant/node_modules/uuid": {
+ "version": "10.0.0",
+ "resolved": "https://registry.npmjs.org/uuid/-/uuid-10.0.0.tgz",
+ "integrity": "sha512-8XkAphELsDnEGrDxUOHB3RGvXz6TeuYSGEZBOjtTtPm2lwhGBjLgOzLHB63IUWfBpNucQjND6d3AOudO+H3RWQ==",
+ "dev": true,
+ "funding": [
+ "https://github.com/sponsors/broofa",
+ "https://github.com/sponsors/ctavan"
+ ],
+ "bin": {
+ "uuid": "dist/bin/uuid"
+ }
+ },
"packages/instrumentation-vertexai": {
"name": "@traceloop/instrumentation-vertexai",
- "version": "0.8.8",
+ "version": "0.9.0",
"license": "Apache-2.0",
"dependencies": {
"@opentelemetry/core": "^1.25.0",
"@opentelemetry/instrumentation": "^0.52.0",
"@opentelemetry/semantic-conventions": "^1.25.0",
- "@traceloop/ai-semantic-conventions": "^0.8.0"
+ "@traceloop/ai-semantic-conventions": "^0.9.0"
},
"devDependencies": {
"@google-cloud/aiplatform": "^3.10.0",
@@ -24539,23 +24576,24 @@
},
"packages/traceloop-sdk": {
"name": "@traceloop/node-server-sdk",
- "version": "0.8.9",
+ "version": "0.9.0",
"license": "Apache-2.0",
"dependencies": {
"@opentelemetry/exporter-trace-otlp-proto": "^0.49.1",
"@opentelemetry/sdk-node": "^0.49.1",
"@sentry/node": "^7.111.0",
- "@traceloop/ai-semantic-conventions": "^0.8.0",
- "@traceloop/instrumentation-anthropic": "^0.8.8",
- "@traceloop/instrumentation-azure": "^0.8.8",
- "@traceloop/instrumentation-bedrock": "^0.8.8",
- "@traceloop/instrumentation-chromadb": "^0.8.8",
- "@traceloop/instrumentation-cohere": "^0.8.8",
- "@traceloop/instrumentation-langchain": "^0.8.8",
- "@traceloop/instrumentation-llamaindex": "^0.8.8",
- "@traceloop/instrumentation-openai": "^0.8.8",
- "@traceloop/instrumentation-pinecone": "^0.8.8",
- "@traceloop/instrumentation-vertexai": "^0.8.8",
+ "@traceloop/ai-semantic-conventions": "^0.9.0",
+ "@traceloop/instrumentation-anthropic": "^0.9.0",
+ "@traceloop/instrumentation-azure": "^0.9.0",
+ "@traceloop/instrumentation-bedrock": "^0.9.0",
+ "@traceloop/instrumentation-chromadb": "^0.9.0",
+ "@traceloop/instrumentation-cohere": "^0.9.0",
+ "@traceloop/instrumentation-langchain": "^0.9.0",
+ "@traceloop/instrumentation-llamaindex": "^0.9.0",
+ "@traceloop/instrumentation-openai": "^0.9.0",
+ "@traceloop/instrumentation-pinecone": "^0.9.0",
+ "@traceloop/instrumentation-qdrant": "^0.9.0",
+ "@traceloop/instrumentation-vertexai": "^0.9.0",
"@types/nunjucks": "^3.2.5",
"cross-fetch": "^4.0.0",
"fetch-retry": "^5.0.6",
@@ -24574,6 +24612,7 @@
"@pollyjs/adapter-node-http": "^6.0.6",
"@pollyjs/core": "^6.0.6",
"@pollyjs/persister-fs": "^6.0.6",
+ "@qdrant/js-client-rest": "^1.9.0",
"@types/mocha": "^10.0.6",
"@types/node": "^20.9.0",
"@types/uuid": "^9.0.7",
diff --git a/packages/ai-semantic-conventions/CHANGELOG.md b/packages/ai-semantic-conventions/CHANGELOG.md
index 51b71340..23245fed 100644
--- a/packages/ai-semantic-conventions/CHANGELOG.md
+++ b/packages/ai-semantic-conventions/CHANGELOG.md
@@ -3,6 +3,16 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+# [0.9.0](https://github.com/traceloop/openllmetry-js/compare/v0.8.9...v0.9.0) (2024-07-04)
+
+### Bug Fixes
+
+- **sdk:** versions on workflows & tasks ([#353](https://github.com/traceloop/openllmetry-js/issues/353)) ([eb6211f](https://github.com/traceloop/openllmetry-js/commit/eb6211f5cc9a2930c6bff1d9ffe3cb995eaf6669))
+
+### Features
+
+- Qdrant instrumentation ([#278](https://github.com/traceloop/openllmetry-js/issues/278)) ([3b8224f](https://github.com/traceloop/openllmetry-js/commit/3b8224fac062b6da3f84311569a5ffcc2e3b8744))
+
# [0.8.0](https://github.com/traceloop/openllmetry-js/compare/v0.7.0...v0.8.0) (2024-04-29)
### Features
diff --git a/packages/ai-semantic-conventions/package.json b/packages/ai-semantic-conventions/package.json
index c92d30de..9f44ec06 100644
--- a/packages/ai-semantic-conventions/package.json
+++ b/packages/ai-semantic-conventions/package.json
@@ -1,6 +1,6 @@
{
"name": "@traceloop/ai-semantic-conventions",
- "version": "0.8.0",
+ "version": "0.9.0",
"description": "OpenTelemetry ai-specific semantic conventions",
"main": "dist/src/index.js",
"types": "dist/src/index.d.ts",
diff --git a/packages/ai-semantic-conventions/src/SemanticAttributes.ts b/packages/ai-semantic-conventions/src/SemanticAttributes.ts
index 49aeb998..828cbd76 100644
--- a/packages/ai-semantic-conventions/src/SemanticAttributes.ts
+++ b/packages/ai-semantic-conventions/src/SemanticAttributes.ts
@@ -38,11 +38,20 @@ export const SpanAttributes = {
// Vector DB
VECTOR_DB_VENDOR: "db.system",
VECTOR_DB_QUERY_TOP_K: "db.vector.query.top_k",
+ VECTOR_DB_TABLE_NAME: "db.vector.table_name",
+ VECTOR_DB_ADD_COUNT: "db.vector.add.count",
+ VECTOR_DB_DELETE_SELECTOR: "db.vector.delete.selector",
+ VECTOR_DB_DELETE_COUNT: "db.vector.delete.count",
+ VECTOR_DB_GET_SELECTOR: "db.vector.get.selector",
+ VECTOR_DB_GET_COUNT: "db.vector.get.count",
+ VECTOR_DB_GET_INCLUDE_METADATA: "db.vector.get.include_metadata",
+ VECTOR_DB_GET_INCLUDE_VALUES: "db.vector.get.include_values",
// LLM Workflows
TRACELOOP_SPAN_KIND: "traceloop.span.kind",
TRACELOOP_WORKFLOW_NAME: "traceloop.workflow.name",
TRACELOOP_ENTITY_NAME: "traceloop.entity.name",
+ TRACELOOP_ENTITY_VERSION: "traceloop.entity.version",
TRACELOOP_ASSOCIATION_PROPERTIES: "traceloop.association.properties",
TRACELOOP_ENTITY_INPUT: "traceloop.entity.input",
TRACELOOP_ENTITY_OUTPUT: "traceloop.entity.output",
diff --git a/packages/instrumentation-anthropic/CHANGELOG.md b/packages/instrumentation-anthropic/CHANGELOG.md
index f4b6c651..29dc7113 100644
--- a/packages/instrumentation-anthropic/CHANGELOG.md
+++ b/packages/instrumentation-anthropic/CHANGELOG.md
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+# [0.9.0](https://github.com/traceloop/openllmetry-js/compare/v0.8.9...v0.9.0) (2024-07-04)
+
+**Note:** Version bump only for package @traceloop/instrumentation-anthropic
+
## [0.8.8](https://github.com/traceloop/openllmetry-js/compare/v0.8.7...v0.8.8) (2024-06-16)
**Note:** Version bump only for package @traceloop/instrumentation-anthropic
diff --git a/packages/instrumentation-anthropic/package.json b/packages/instrumentation-anthropic/package.json
index 630141f3..8d4a934e 100644
--- a/packages/instrumentation-anthropic/package.json
+++ b/packages/instrumentation-anthropic/package.json
@@ -1,6 +1,6 @@
{
"name": "@traceloop/instrumentation-anthropic",
- "version": "0.8.8",
+ "version": "0.9.0",
"description": "Anthropic Instrumentaion",
"main": "dist/index.js",
"module": "dist/index.mjs",
@@ -40,7 +40,7 @@
"@opentelemetry/core": "^1.25.0",
"@opentelemetry/instrumentation": "^0.52.0",
"@opentelemetry/semantic-conventions": "^1.25.0",
- "@traceloop/ai-semantic-conventions": "^0.8.0"
+ "@traceloop/ai-semantic-conventions": "^0.9.0"
},
"devDependencies": {
"@anthropic-ai/sdk": "^0.20.1",
diff --git a/packages/instrumentation-azure/CHANGELOG.md b/packages/instrumentation-azure/CHANGELOG.md
index e36094c6..a47b37eb 100644
--- a/packages/instrumentation-azure/CHANGELOG.md
+++ b/packages/instrumentation-azure/CHANGELOG.md
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+# [0.9.0](https://github.com/traceloop/openllmetry-js/compare/v0.8.9...v0.9.0) (2024-07-04)
+
+**Note:** Version bump only for package @traceloop/instrumentation-azure
+
## [0.8.8](https://github.com/traceloop/openllmetry-js/compare/v0.8.7...v0.8.8) (2024-06-16)
**Note:** Version bump only for package @traceloop/instrumentation-azure
diff --git a/packages/instrumentation-azure/package.json b/packages/instrumentation-azure/package.json
index a3886008..8ef69ad6 100644
--- a/packages/instrumentation-azure/package.json
+++ b/packages/instrumentation-azure/package.json
@@ -1,6 +1,6 @@
{
"name": "@traceloop/instrumentation-azure",
- "version": "0.8.8",
+ "version": "0.9.0",
"description": "Azure OpenAI Instrumentaion",
"main": "dist/index.js",
"module": "dist/index.mjs",
@@ -40,7 +40,7 @@
"@opentelemetry/core": "^1.25.0",
"@opentelemetry/instrumentation": "^0.52.0",
"@opentelemetry/semantic-conventions": "^1.25.0",
- "@traceloop/ai-semantic-conventions": "^0.8.0"
+ "@traceloop/ai-semantic-conventions": "^0.9.0"
},
"devDependencies": {
"@azure/openai": "^1.0.0-beta.10",
diff --git a/packages/instrumentation-bedrock/CHANGELOG.md b/packages/instrumentation-bedrock/CHANGELOG.md
index 1189221c..5e86073b 100644
--- a/packages/instrumentation-bedrock/CHANGELOG.md
+++ b/packages/instrumentation-bedrock/CHANGELOG.md
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+# [0.9.0](https://github.com/traceloop/openllmetry-js/compare/v0.8.9...v0.9.0) (2024-07-04)
+
+**Note:** Version bump only for package @traceloop/instrumentation-bedrock
+
## [0.8.8](https://github.com/traceloop/openllmetry-js/compare/v0.8.7...v0.8.8) (2024-06-16)
**Note:** Version bump only for package @traceloop/instrumentation-bedrock
diff --git a/packages/instrumentation-bedrock/package.json b/packages/instrumentation-bedrock/package.json
index daeaa60e..aa9f48c9 100644
--- a/packages/instrumentation-bedrock/package.json
+++ b/packages/instrumentation-bedrock/package.json
@@ -1,6 +1,6 @@
{
"name": "@traceloop/instrumentation-bedrock",
- "version": "0.8.8",
+ "version": "0.9.0",
"description": "Amazon Bedrock Instrumentation",
"main": "dist/index.js",
"module": "dist/index.mjs",
@@ -40,7 +40,7 @@
"@opentelemetry/core": "^1.25.0",
"@opentelemetry/instrumentation": "^0.52.0",
"@opentelemetry/semantic-conventions": "^1.25.0",
- "@traceloop/ai-semantic-conventions": "^0.8.0"
+ "@traceloop/ai-semantic-conventions": "^0.9.0"
},
"devDependencies": {
"@aws-sdk/client-bedrock-runtime": "^3.499.0",
diff --git a/packages/instrumentation-chromadb/CHANGELOG.md b/packages/instrumentation-chromadb/CHANGELOG.md
index de87e3d1..1a7f3b72 100644
--- a/packages/instrumentation-chromadb/CHANGELOG.md
+++ b/packages/instrumentation-chromadb/CHANGELOG.md
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+# [0.9.0](https://github.com/traceloop/openllmetry-js/compare/v0.8.9...v0.9.0) (2024-07-04)
+
+**Note:** Version bump only for package @traceloop/instrumentation-chromadb
+
## [0.8.8](https://github.com/traceloop/openllmetry-js/compare/v0.8.7...v0.8.8) (2024-06-16)
**Note:** Version bump only for package @traceloop/instrumentation-chromadb
diff --git a/packages/instrumentation-chromadb/package.json b/packages/instrumentation-chromadb/package.json
index 48a1f2be..2914d7d5 100644
--- a/packages/instrumentation-chromadb/package.json
+++ b/packages/instrumentation-chromadb/package.json
@@ -1,6 +1,6 @@
{
"name": "@traceloop/instrumentation-chromadb",
- "version": "0.8.8",
+ "version": "0.9.0",
"description": "ChromaDB Instrumentation",
"main": "dist/src/index.js",
"types": "dist/src/index.d.ts",
@@ -39,7 +39,7 @@
"@opentelemetry/core": "^1.25.0",
"@opentelemetry/instrumentation": "^0.52.0",
"@opentelemetry/semantic-conventions": "^1.25.0",
- "@traceloop/ai-semantic-conventions": "^0.8.0"
+ "@traceloop/ai-semantic-conventions": "^0.9.0"
},
"devDependencies": {
"@pollyjs/adapter-node-http": "^6.0.6",
diff --git a/packages/instrumentation-cohere/CHANGELOG.md b/packages/instrumentation-cohere/CHANGELOG.md
index 4eb531d3..c35d8971 100644
--- a/packages/instrumentation-cohere/CHANGELOG.md
+++ b/packages/instrumentation-cohere/CHANGELOG.md
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+# [0.9.0](https://github.com/traceloop/openllmetry-js/compare/v0.8.9...v0.9.0) (2024-07-04)
+
+**Note:** Version bump only for package @traceloop/instrumentation-cohere
+
## [0.8.8](https://github.com/traceloop/openllmetry-js/compare/v0.8.7...v0.8.8) (2024-06-16)
**Note:** Version bump only for package @traceloop/instrumentation-cohere
diff --git a/packages/instrumentation-cohere/package.json b/packages/instrumentation-cohere/package.json
index 97baf7d7..f768e836 100644
--- a/packages/instrumentation-cohere/package.json
+++ b/packages/instrumentation-cohere/package.json
@@ -1,6 +1,6 @@
{
"name": "@traceloop/instrumentation-cohere",
- "version": "0.8.8",
+ "version": "0.9.0",
"description": "Cohere Instrumentation",
"main": "dist/index.js",
"module": "dist/index.mjs",
@@ -40,7 +40,7 @@
"@opentelemetry/core": "^1.25.0",
"@opentelemetry/instrumentation": "^0.52.0",
"@opentelemetry/semantic-conventions": "^1.25.0",
- "@traceloop/ai-semantic-conventions": "^0.8.0"
+ "@traceloop/ai-semantic-conventions": "^0.9.0"
},
"devDependencies": {
"@pollyjs/adapter-node-http": "^6.0.6",
diff --git a/packages/instrumentation-langchain/CHANGELOG.md b/packages/instrumentation-langchain/CHANGELOG.md
index 796a57a6..da8727ca 100644
--- a/packages/instrumentation-langchain/CHANGELOG.md
+++ b/packages/instrumentation-langchain/CHANGELOG.md
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+# [0.9.0](https://github.com/traceloop/openllmetry-js/compare/v0.8.9...v0.9.0) (2024-07-04)
+
+**Note:** Version bump only for package @traceloop/instrumentation-langchain
+
## [0.8.8](https://github.com/traceloop/openllmetry-js/compare/v0.8.7...v0.8.8) (2024-06-16)
**Note:** Version bump only for package @traceloop/instrumentation-langchain
diff --git a/packages/instrumentation-langchain/package.json b/packages/instrumentation-langchain/package.json
index bf8df02c..27e92000 100644
--- a/packages/instrumentation-langchain/package.json
+++ b/packages/instrumentation-langchain/package.json
@@ -1,6 +1,6 @@
{
"name": "@traceloop/instrumentation-langchain",
- "version": "0.8.8",
+ "version": "0.9.0",
"description": "OpenTelemetry instrumentation for LangchainJS",
"main": "dist/index.js",
"module": "dist/index.mjs",
@@ -40,7 +40,7 @@
"@opentelemetry/core": "^1.25.0",
"@opentelemetry/instrumentation": "^0.52.0",
"@opentelemetry/semantic-conventions": "^1.25.0",
- "@traceloop/ai-semantic-conventions": "^0.8.0"
+ "@traceloop/ai-semantic-conventions": "^0.9.0"
},
"devDependencies": {
"@langchain/community": "^0.0.34",
diff --git a/packages/instrumentation-llamaindex/CHANGELOG.md b/packages/instrumentation-llamaindex/CHANGELOG.md
index b5222d86..7f766386 100644
--- a/packages/instrumentation-llamaindex/CHANGELOG.md
+++ b/packages/instrumentation-llamaindex/CHANGELOG.md
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+# [0.9.0](https://github.com/traceloop/openllmetry-js/compare/v0.8.9...v0.9.0) (2024-07-04)
+
+**Note:** Version bump only for package @traceloop/instrumentation-llamaindex
+
## [0.8.8](https://github.com/traceloop/openllmetry-js/compare/v0.8.7...v0.8.8) (2024-06-16)
**Note:** Version bump only for package @traceloop/instrumentation-llamaindex
diff --git a/packages/instrumentation-llamaindex/package.json b/packages/instrumentation-llamaindex/package.json
index 61c1d08a..dd8d8a95 100644
--- a/packages/instrumentation-llamaindex/package.json
+++ b/packages/instrumentation-llamaindex/package.json
@@ -1,6 +1,6 @@
{
"name": "@traceloop/instrumentation-llamaindex",
- "version": "0.8.8",
+ "version": "0.9.0",
"description": "Llamaindex Instrumentation",
"main": "dist/index.js",
"module": "dist/index.mjs",
@@ -39,7 +39,7 @@
"@opentelemetry/core": "^1.25.0",
"@opentelemetry/instrumentation": "^0.52.0",
"@opentelemetry/semantic-conventions": "^1.25.0",
- "@traceloop/ai-semantic-conventions": "^0.8.0",
+ "@traceloop/ai-semantic-conventions": "^0.9.0",
"lodash": "^4.17.21"
},
"devDependencies": {
diff --git a/packages/instrumentation-openai/CHANGELOG.md b/packages/instrumentation-openai/CHANGELOG.md
index 05d8dfe7..528f1fb3 100644
--- a/packages/instrumentation-openai/CHANGELOG.md
+++ b/packages/instrumentation-openai/CHANGELOG.md
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+# [0.9.0](https://github.com/traceloop/openllmetry-js/compare/v0.8.9...v0.9.0) (2024-07-04)
+
+**Note:** Version bump only for package @traceloop/instrumentation-openai
+
## [0.8.8](https://github.com/traceloop/openllmetry-js/compare/v0.8.7...v0.8.8) (2024-06-16)
**Note:** Version bump only for package @traceloop/instrumentation-openai
diff --git a/packages/instrumentation-openai/package.json b/packages/instrumentation-openai/package.json
index 03e860b3..c520b91a 100644
--- a/packages/instrumentation-openai/package.json
+++ b/packages/instrumentation-openai/package.json
@@ -1,6 +1,6 @@
{
"name": "@traceloop/instrumentation-openai",
- "version": "0.8.8",
+ "version": "0.9.0",
"description": "OpenAI Instrumentaion",
"main": "dist/index.js",
"module": "dist/index.mjs",
@@ -39,7 +39,7 @@
"@opentelemetry/core": "^1.25.0",
"@opentelemetry/instrumentation": "^0.52.0",
"@opentelemetry/semantic-conventions": "^1.25.0",
- "@traceloop/ai-semantic-conventions": "^0.8.0",
+ "@traceloop/ai-semantic-conventions": "^0.9.0",
"js-tiktoken": "^1.0.12"
},
"devDependencies": {
diff --git a/packages/instrumentation-pinecone/CHANGELOG.md b/packages/instrumentation-pinecone/CHANGELOG.md
index a58e844b..3684e7f4 100644
--- a/packages/instrumentation-pinecone/CHANGELOG.md
+++ b/packages/instrumentation-pinecone/CHANGELOG.md
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+# [0.9.0](https://github.com/traceloop/openllmetry-js/compare/v0.8.9...v0.9.0) (2024-07-04)
+
+**Note:** Version bump only for package @traceloop/instrumentation-pinecone
+
## [0.8.8](https://github.com/traceloop/openllmetry-js/compare/v0.8.7...v0.8.8) (2024-06-16)
**Note:** Version bump only for package @traceloop/instrumentation-pinecone
diff --git a/packages/instrumentation-pinecone/package.json b/packages/instrumentation-pinecone/package.json
index acfd4ae5..3c197783 100644
--- a/packages/instrumentation-pinecone/package.json
+++ b/packages/instrumentation-pinecone/package.json
@@ -1,6 +1,6 @@
{
"name": "@traceloop/instrumentation-pinecone",
- "version": "0.8.8",
+ "version": "0.9.0",
"description": "OpenTelemetry instrumentation for pinecone vector DB",
"main": "dist/index.js",
"module": "dist/index.mjs",
@@ -40,7 +40,7 @@
"@opentelemetry/core": "^1.25.0",
"@opentelemetry/instrumentation": "^0.52.0",
"@opentelemetry/semantic-conventions": "^1.25.0",
- "@traceloop/ai-semantic-conventions": "^0.8.0"
+ "@traceloop/ai-semantic-conventions": "^0.9.0"
},
"devDependencies": {
"@pinecone-database/pinecone": "^2.0.1",
diff --git a/packages/instrumentation-qdrant/.eslintignore b/packages/instrumentation-qdrant/.eslintignore
new file mode 100644
index 00000000..b512c09d
--- /dev/null
+++ b/packages/instrumentation-qdrant/.eslintignore
@@ -0,0 +1 @@
+node_modules
\ No newline at end of file
diff --git a/packages/instrumentation-qdrant/.eslintrc.json b/packages/instrumentation-qdrant/.eslintrc.json
new file mode 100644
index 00000000..9d9c0db5
--- /dev/null
+++ b/packages/instrumentation-qdrant/.eslintrc.json
@@ -0,0 +1,18 @@
+{
+ "extends": ["../../.eslintrc.json"],
+ "ignorePatterns": ["!**/*"],
+ "overrides": [
+ {
+ "files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
+ "rules": {}
+ },
+ {
+ "files": ["*.ts", "*.tsx"],
+ "rules": {}
+ },
+ {
+ "files": ["*.js", "*.jsx"],
+ "rules": {}
+ }
+ ]
+}
diff --git a/packages/instrumentation-qdrant/.prettierignore b/packages/instrumentation-qdrant/.prettierignore
new file mode 100644
index 00000000..258e27f6
--- /dev/null
+++ b/packages/instrumentation-qdrant/.prettierignore
@@ -0,0 +1,2 @@
+/dist
+/coverage
\ No newline at end of file
diff --git a/packages/instrumentation-qdrant/CHANGELOG.md b/packages/instrumentation-qdrant/CHANGELOG.md
new file mode 100644
index 00000000..50c5a11e
--- /dev/null
+++ b/packages/instrumentation-qdrant/CHANGELOG.md
@@ -0,0 +1,10 @@
+# Change Log
+
+All notable changes to this project will be documented in this file.
+See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+
+# [0.9.0](https://github.com/traceloop/openllmetry-js/compare/v0.8.9...v0.9.0) (2024-07-04)
+
+### Features
+
+- Qdrant instrumentation ([#278](https://github.com/traceloop/openllmetry-js/issues/278)) ([3b8224f](https://github.com/traceloop/openllmetry-js/commit/3b8224fac062b6da3f84311569a5ffcc2e3b8744))
diff --git a/packages/instrumentation-qdrant/README.md b/packages/instrumentation-qdrant/README.md
new file mode 100644
index 00000000..963bcfa6
--- /dev/null
+++ b/packages/instrumentation-qdrant/README.md
@@ -0,0 +1,53 @@
+# OpenTelemetry Qdrant instrumentation for Node.js
+
+[![NPM Published Version][npm-img]][npm-url]
+[![Apache License][license-image]][license-image]
+
+This module provides automatic instrumentation for [`@qdrant/js-client-rest`](https://www.npmjs.com/package/@qdrant/js-client-rest) module, which may be loaded using the [`@opentelemetry/sdk-trace-node`](https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-sdk-trace-node) package and is included in the [`@traceloop/node-server-sdk`](https://www.npmjs.com/package/@traceloop/node-server-sdk) bundle.
+
+If total installation size is not constrained, it is recommended to use the [`@traceloop/node-server-sdk`](https://www.npmjs.com/package/@traceloop/node-server-sdk) bundle for the most seamless instrumentation experience.
+
+Compatible with OpenTelemetry JS API and SDK `1.0+`.
+
+## Installation
+
+```bash
+npm install --save @traceloop/instrumentation-qdrant
+```
+
+## Supported Versions
+
+- `>=1.9.0`
+
+## Usage
+
+To load a specific plugin, specify it in the registerInstrumentations's configuration:
+
+```js
+const { NodeTracerProvider } = require("@opentelemetry/sdk-trace-node");
+const { QdrantInstrumentation } = require("@traceloop/instrumentation-qdrant");
+const { registerInstrumentations } = require("@opentelemetry/instrumentation");
+
+const provider = new NodeTracerProvider();
+provider.register();
+
+registerInstrumentations({
+ instrumentations: [new QdrantInstrumentation()],
+});
+```
+
+## Useful links
+
+- For more information on OpenTelemetry, visit:
+- For more about OpenTelemetry JavaScript:
+- For help or feedback on this project, join us on [Slack][slack-url]
+
+## License
+
+Apache 2.0 - See [LICENSE][license-url] for more information.
+
+[slack-url]: https://traceloop.com/slack
+[license-url]: https://github.com/traceloop/openllmetry-js/blob/main/LICENSE
+[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
+[npm-url]: https://www.npmjs.com/package/@traceloop/instrumentation-qdrant
+[npm-img]: https://badge.fury.io/js/%40traceloop%2Finstrumentation-qdrant.svg
diff --git a/packages/instrumentation-qdrant/package.json b/packages/instrumentation-qdrant/package.json
new file mode 100644
index 00000000..4ac1d66f
--- /dev/null
+++ b/packages/instrumentation-qdrant/package.json
@@ -0,0 +1,52 @@
+{
+ "name": "@traceloop/instrumentation-qdrant",
+ "version": "0.9.0",
+ "description": "Qdrant Instrumentation",
+ "main": "dist/src/index.js",
+ "types": "dist/src/index.d.ts",
+ "repository": "traceloop/openllmetry-js",
+ "scripts": {
+ "build": "rollup -c",
+ "lint": "eslint . --ext .ts",
+ "lint:fix": "eslint . --ext .ts --fix",
+ "test": "ts-mocha -p tsconfig.json 'tests/**/*.test.ts' --timeout 20000"
+ },
+ "keywords": [
+ "opentelemetry",
+ "nodejs",
+ "tracing",
+ "attributes",
+ "semantic conventions"
+ ],
+ "author": "Qdrant Team ",
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">=14"
+ },
+ "files": [
+ "dist/src/**/*.js",
+ "dist/src/**/*.js.map",
+ "dist/src/**/*.d.ts",
+ "doc",
+ "LICENSE",
+ "README.md",
+ "package.json"
+ ],
+ "publishConfig": {
+ "access": "public"
+ },
+ "dependencies": {
+ "@opentelemetry/core": "^1.8.0",
+ "@opentelemetry/instrumentation": "^0.52.0",
+ "@traceloop/ai-semantic-conventions": "^0.9.0"
+ },
+ "devDependencies": {
+ "@pollyjs/adapter-node-http": "^6.0.6",
+ "@pollyjs/core": "^6.0.6",
+ "@pollyjs/persister-fs": "^6.0.6",
+ "@qdrant/js-client-rest": "^1.9.0",
+ "uuid": "^10.0.0"
+ },
+ "homepage": "https://github.com/traceloop/openllmetry-js/tree/main/packages/instrumentation-qdrant",
+ "gitHead": "ef1e70d6037f7b5c061056ef2be16e3f55f02ed5"
+}
diff --git a/packages/instrumentation-qdrant/rollup.config.js b/packages/instrumentation-qdrant/rollup.config.js
new file mode 100644
index 00000000..691c0ca5
--- /dev/null
+++ b/packages/instrumentation-qdrant/rollup.config.js
@@ -0,0 +1,37 @@
+const dts = require("rollup-plugin-dts");
+const typescript = require("@rollup/plugin-typescript");
+const json = require("@rollup/plugin-json");
+
+// eslint-disable-next-line @typescript-eslint/no-var-requires
+const name = require("./package.json").main.replace(/\.js$/, "");
+
+const bundle = (config) => ({
+ ...config,
+ input: "src/index.ts",
+ external: (id) => !/^[./]/.test(id),
+});
+
+exports.default = [
+ bundle({
+ plugins: [typescript.default(), json.default()],
+ output: [
+ {
+ file: `${name}.js`,
+ format: "cjs",
+ sourcemap: true,
+ },
+ {
+ file: `${name}.mjs`,
+ format: "es",
+ sourcemap: true,
+ },
+ ],
+ }),
+ bundle({
+ plugins: [dts.default()],
+ output: {
+ file: `${name}.d.ts`,
+ format: "es",
+ },
+ }),
+];
diff --git a/packages/instrumentation-qdrant/src/index.ts b/packages/instrumentation-qdrant/src/index.ts
new file mode 100644
index 00000000..f104515f
--- /dev/null
+++ b/packages/instrumentation-qdrant/src/index.ts
@@ -0,0 +1,18 @@
+/*
+ * Copyright Traceloop
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+export * from "./instrumentation";
+export * from "./types";
diff --git a/packages/instrumentation-qdrant/src/instrumentation.ts b/packages/instrumentation-qdrant/src/instrumentation.ts
new file mode 100644
index 00000000..09bb427e
--- /dev/null
+++ b/packages/instrumentation-qdrant/src/instrumentation.ts
@@ -0,0 +1,355 @@
+/*
+ * Copyright Traceloop
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import {
+ Span,
+ SpanKind,
+ SpanStatusCode,
+ context,
+ trace,
+} from "@opentelemetry/api";
+import {
+ InstrumentationBase,
+ InstrumentationModuleDefinition,
+ InstrumentationNodeModuleDefinition,
+ safeExecuteInTheMiddle,
+} from "@opentelemetry/instrumentation";
+import { QdrantInstrumentationConfig } from "./types";
+import type * as qdrant from "@qdrant/js-client-rest";
+import { version } from "../package.json";
+import {
+ SpanAttributes,
+ EventAttributes,
+} from "@traceloop/ai-semantic-conventions";
+
+const UPSERT = "upsert";
+const DELETE = "delete";
+const RETRIEVE = "retrieve";
+const SEARCH = "search";
+
+type UpsertRequest = qdrant.Schemas["PointInsertOperations"];
+type DeleteRequest = qdrant.Schemas["PointsSelector"];
+type RetrieveRequest = qdrant.Schemas["PointRequest"];
+type SearchRequest = qdrant.Schemas["SearchRequest"];
+type SearchResponse = Awaited<
+ ReturnType
+>;
+
+export class QdrantInstrumentation extends InstrumentationBase {
+ protected declare _config: QdrantInstrumentationConfig;
+
+ constructor(config: QdrantInstrumentationConfig = {}) {
+ super("@traceloop/instrumentation-qdrant", version, config);
+ }
+
+ public override setConfig(config: QdrantInstrumentationConfig = {}) {
+ super.setConfig(config);
+ }
+
+ protected init(): InstrumentationModuleDefinition {
+ const module = new InstrumentationNodeModuleDefinition(
+ "@qdrant/js-client-rest",
+ ["^1.9"],
+ this.wrap.bind(this),
+ this.unwrap.bind(this),
+ );
+
+ return module;
+ }
+
+ public manuallyInstrument(module: typeof qdrant) {
+ this._diag.debug(`Manually patching Qdrant`);
+ this.wrap(module);
+ }
+
+ private wrap(module: typeof qdrant) {
+ this._wrap(module.QdrantClient.prototype, UPSERT, this.wrapperMethod());
+ this._wrap(module.QdrantClient.prototype, RETRIEVE, this.wrapperMethod());
+ this._wrap(module.QdrantClient.prototype, SEARCH, this.wrapperMethod());
+ this._wrap(module.QdrantClient.prototype, DELETE, this.wrapperMethod());
+
+ return module;
+ }
+
+ private unwrap(module: typeof qdrant) {
+ this._unwrap(module.QdrantClient.prototype, UPSERT);
+ this._unwrap(module.QdrantClient.prototype, RETRIEVE);
+ this._unwrap(module.QdrantClient.prototype, SEARCH);
+ this._unwrap(module.QdrantClient.prototype, DELETE);
+
+ return module;
+ }
+
+ private wrapperMethod() {
+ // eslint-disable-next-line @typescript-eslint/no-this-alias
+ const plugin = this;
+ // eslint-disable-next-line @typescript-eslint/ban-types
+ return (original: Function) => {
+ return function method(this: any, ...args: any) {
+ const span = plugin._startSpan({
+ collectionName: args[0],
+ params: args.length > 1 ? args[1] : {},
+ methodName: original.name,
+ });
+ const execContext = trace.setSpan(context.active(), span);
+ const execPromise = safeExecuteInTheMiddle(
+ () => {
+ return context.with(execContext, () => {
+ return original.apply(this, args);
+ });
+ },
+ (e) => {
+ if (e) {
+ plugin._diag.error(`Error in Qdrant instrumentation`, e);
+ }
+ },
+ );
+ const wrappedPromise = execPromise
+ .then((result: any) => {
+ return new Promise((resolve) => {
+ plugin._endSpan({ methodName: original.name, span, result });
+ resolve(result);
+ });
+ })
+ .catch((error: Error) => {
+ return new Promise((_, reject) => {
+ span.setStatus({
+ code: SpanStatusCode.ERROR,
+ message: error.message,
+ });
+ span.end();
+ reject(error);
+ });
+ });
+ return context.bind(execContext, wrappedPromise as any);
+ };
+ };
+ }
+ private _startSpan({
+ collectionName,
+ params,
+ methodName,
+ }: {
+ collectionName: string;
+ params: UpsertRequest | DeleteRequest | RetrieveRequest | SearchRequest;
+ methodName: string;
+ }): Span {
+ const spanName = `qdrant.${methodName}`;
+ const span = this.tracer.startSpan(spanName, {
+ kind: SpanKind.CLIENT,
+ });
+ span.setAttribute(SpanAttributes.VECTOR_DB_VENDOR, "Qdrant");
+
+ try {
+ if (this._config.traceContent) {
+ switch (methodName) {
+ case UPSERT:
+ this._setUpsertAttributes(
+ span,
+ collectionName,
+ params as UpsertRequest,
+ );
+ break;
+ case DELETE:
+ this._setDeleteAttributes(
+ span,
+ collectionName,
+ params as DeleteRequest,
+ );
+ break;
+ case RETRIEVE:
+ this._setRetrieveAttributes(
+ span,
+ collectionName,
+ params as RetrieveRequest,
+ );
+ break;
+ case SEARCH:
+ this._setSearchAttributes(
+ span,
+ collectionName,
+ params as SearchRequest,
+ );
+ break;
+ default:
+ break;
+ }
+ }
+ } catch (e) {
+ this._diag.warn(e);
+ this._config.exceptionLogger?.(e);
+ }
+
+ return span;
+ }
+
+ private _endSpan({
+ methodName,
+ span,
+ result,
+ }: {
+ methodName: string;
+ span: Span;
+ result: any;
+ }) {
+ try {
+ switch (methodName) {
+ case SEARCH:
+ this._setSearchResultAttributes(span, result as SearchResponse);
+ break;
+ default:
+ break;
+ }
+ span.setStatus({ code: SpanStatusCode.OK });
+ span.end();
+ } catch (e) {
+ this._diag.debug(e);
+ this._config.exceptionLogger?.(e);
+ }
+ }
+
+ private _setUpsertAttributes(
+ span: Span,
+ collectionName: string,
+ params: UpsertRequest,
+ ) {
+ span.setAttribute(SpanAttributes.VECTOR_DB_TABLE_NAME, collectionName);
+ if ("batch" in params) {
+ span.setAttribute(
+ SpanAttributes.VECTOR_DB_ADD_COUNT,
+ params.batch.ids.length,
+ );
+ } else {
+ span.setAttribute(
+ SpanAttributes.VECTOR_DB_ADD_COUNT,
+ params.points.length,
+ );
+ }
+ }
+
+ private _setDeleteAttributes(
+ span: Span,
+ collectionName: string,
+ params: DeleteRequest,
+ ) {
+ span.setAttribute(SpanAttributes.VECTOR_DB_TABLE_NAME, collectionName);
+ if ("filter" in params) {
+ span.setAttribute(
+ SpanAttributes.VECTOR_DB_DELETE_SELECTOR,
+ JSON.stringify(params.filter),
+ );
+ } else {
+ span.setAttribute(
+ SpanAttributes.VECTOR_DB_DELETE_SELECTOR,
+ JSON.stringify(params.points),
+ );
+ span.setAttribute(
+ SpanAttributes.VECTOR_DB_DELETE_COUNT,
+ params.points.length,
+ );
+ }
+ }
+
+ private _setRetrieveAttributes(
+ span: Span,
+ collectionName: string,
+ params: RetrieveRequest,
+ ) {
+ span.setAttribute(SpanAttributes.VECTOR_DB_TABLE_NAME, collectionName);
+ span.setAttribute(
+ SpanAttributes.VECTOR_DB_GET_SELECTOR,
+ JSON.stringify(params.ids),
+ );
+ span.setAttribute(SpanAttributes.VECTOR_DB_GET_COUNT, params.ids.length);
+ span.setAttribute(
+ SpanAttributes.VECTOR_DB_GET_INCLUDE_METADATA,
+ !!params.with_payload,
+ );
+ span.setAttribute(
+ SpanAttributes.VECTOR_DB_GET_INCLUDE_VALUES,
+ !!params.with_vector,
+ );
+ }
+
+ private _setSearchAttributes(
+ span: Span,
+ collectionName: string,
+ params: SearchRequest,
+ ) {
+ span.setAttribute(SpanAttributes.VECTOR_DB_TABLE_NAME, collectionName);
+ const query_request_event = span.addEvent("qdrant.search.request");
+ query_request_event.setAttribute(
+ EventAttributes.VECTOR_DB_QUERY_TOP_K,
+ params.limit,
+ );
+ query_request_event.setAttribute(
+ EventAttributes.VECTOR_DB_QUERY_INCLUDE_VALUES,
+ !!params.with_vector,
+ );
+ query_request_event.setAttribute(
+ EventAttributes.VECTOR_DB_QUERY_INCLUDE_METADATA,
+ !!params.with_payload,
+ );
+ query_request_event.setAttribute(
+ EventAttributes.VECTOR_DB_QUERY_EMBEDDINGS_VECTOR,
+ JSON.stringify(params.vector),
+ );
+ query_request_event.setAttribute(
+ EventAttributes.VECTOR_DB_QUERY_METADATA_FILTER,
+ JSON.stringify(params.filter ?? {}),
+ );
+ }
+
+ private _setSearchResultAttributes(span: Span, result: SearchResponse) {
+ const qdrant_result_event = span.addEvent("qdrant.search.result");
+
+ qdrant_result_event.setAttribute(
+ EventAttributes.VECTOR_DB_QUERY_RESULT_MATCHES_LENGTH,
+ result.length,
+ );
+
+ for (let i = 0; i < result.length; i++) {
+ const match = result[i];
+ const search_result_match_event = qdrant_result_event.addEvent(
+ `qdrant.search.result.${i}`,
+ );
+ search_result_match_event.setAttribute(
+ EventAttributes.VECTOR_DB_QUERY_RESULT_SCORE.replace(
+ "{i}",
+ i.toString(),
+ ),
+ match.score,
+ );
+ search_result_match_event.setAttribute(
+ EventAttributes.VECTOR_DB_QUERY_RESULT_ID.replace("{i}", i.toString()),
+ match.id,
+ );
+ search_result_match_event.setAttribute(
+ EventAttributes.VECTOR_DB_QUERY_RESULT_VALUES.replace(
+ "{i}",
+ i.toString(),
+ ),
+ JSON.stringify(match.vector),
+ );
+ search_result_match_event.setAttribute(
+ EventAttributes.VECTOR_DB_QUERY_RESULT_METADATA.replace(
+ "{i}",
+ i.toString(),
+ ),
+ JSON.stringify(match.payload),
+ );
+ }
+ }
+}
diff --git a/packages/instrumentation-qdrant/src/types.ts b/packages/instrumentation-qdrant/src/types.ts
new file mode 100644
index 00000000..45c0b60e
--- /dev/null
+++ b/packages/instrumentation-qdrant/src/types.ts
@@ -0,0 +1,14 @@
+import { InstrumentationConfig } from "@opentelemetry/instrumentation";
+
+export interface QdrantInstrumentationConfig extends InstrumentationConfig {
+ /**
+ * Whether to log prompts, completions and embeddings on traces.
+ * @default true
+ */
+ traceContent?: boolean;
+
+ /**
+ * A custom logger to log any exceptions that happen during span creation.
+ */
+ exceptionLogger?: (e: Error) => void;
+}
diff --git a/packages/instrumentation-qdrant/tests/instrumentation.test.ts b/packages/instrumentation-qdrant/tests/instrumentation.test.ts
new file mode 100755
index 00000000..c95423af
--- /dev/null
+++ b/packages/instrumentation-qdrant/tests/instrumentation.test.ts
@@ -0,0 +1,187 @@
+/*
+ * Copyright Traceloop
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { context } from "@opentelemetry/api";
+import { AsyncHooksContextManager } from "@opentelemetry/context-async-hooks";
+import { QdrantInstrumentation } from "../src/instrumentation";
+import {
+ BasicTracerProvider,
+ InMemorySpanExporter,
+ SimpleSpanProcessor,
+} from "@opentelemetry/sdk-trace-base";
+import type * as qdrant_types from "@qdrant/js-client-rest";
+import * as assert from "assert";
+import { SpanAttributes } from "@traceloop/ai-semantic-conventions";
+import { v4 as uuidv4 } from "uuid";
+
+const COLLECTION_NAME = uuidv4();
+
+const memoryExporter = new InMemorySpanExporter();
+
+describe("Test Qdrant instrumentation", function () {
+ const provider = new BasicTracerProvider();
+ let instrumentation: QdrantInstrumentation;
+ let contextManager: AsyncHooksContextManager;
+ let qdrantClient: qdrant_types.QdrantClient;
+
+ before(async () => {
+ provider.addSpanProcessor(new SimpleSpanProcessor(memoryExporter));
+ instrumentation = new QdrantInstrumentation({ traceContent: true });
+ instrumentation.setTracerProvider(provider);
+
+ const qdrant_module = await import("@qdrant/js-client-rest");
+ qdrantClient = new qdrant_module.QdrantClient({
+ url: "http://127.0.0.1:6333",
+ });
+
+ await qdrantClient.createCollection(COLLECTION_NAME, {
+ vectors: {
+ size: 3,
+ distance: "Cosine",
+ },
+ });
+ });
+
+ beforeEach(async function () {
+ contextManager = new AsyncHooksContextManager().enable();
+ context.setGlobalContextManager(contextManager);
+ memoryExporter.reset();
+ });
+
+ afterEach(async () => {
+ memoryExporter.reset();
+ context.disable();
+ });
+
+ this.afterAll(async () => {
+ await qdrantClient.deleteCollection(COLLECTION_NAME);
+ });
+
+ it("should set span attributes for upsert", async () => {
+ const points = {
+ batch: {
+ ids: [32, 23, 42, 24, 25, 26],
+ vectors: [
+ [1.5, 2.9, 3.4],
+ [9.8, 2.3, 2.9],
+ [0.3, 0.3, 0.3],
+ [1.5, 2.9, 3.4],
+ [9.8, 2.3, 2.9],
+ [0.3, 0.3, 0.3],
+ ],
+ payloads: [
+ { style: "style3" },
+ { style: "style4" },
+ { style: "style5" },
+ { style: "style6" },
+ { style: "style7" },
+ { style: "style8" },
+ ],
+ },
+ };
+
+ await qdrantClient.upsert(COLLECTION_NAME, points);
+
+ const spans = memoryExporter.getFinishedSpans();
+ assert.strictEqual(spans.length, 1);
+ assert.strictEqual(spans[0].name, `qdrant.upsert`);
+
+ const attributes = spans[0].attributes;
+ assert.strictEqual(attributes[SpanAttributes.VECTOR_DB_VENDOR], "Qdrant");
+ assert.strictEqual(
+ attributes[SpanAttributes.VECTOR_DB_TABLE_NAME],
+ COLLECTION_NAME,
+ );
+ assert.strictEqual(
+ attributes[SpanAttributes.VECTOR_DB_ADD_COUNT],
+ points.batch.ids.length,
+ );
+ });
+
+ it("should set attributes in span for search", async () => {
+ await qdrantClient.search(COLLECTION_NAME, {
+ vector: [0.3, 0.3, 0.3],
+ limit: 3,
+ with_payload: true,
+ with_vector: true,
+ });
+
+ const spans = memoryExporter.getFinishedSpans();
+ assert.strictEqual(spans.length, 1);
+ assert.strictEqual(spans[0].name, `qdrant.search`);
+
+ const attributes = spans[0].attributes;
+ assert.strictEqual(attributes[SpanAttributes.VECTOR_DB_VENDOR], "Qdrant");
+ assert.strictEqual(
+ attributes[SpanAttributes.VECTOR_DB_TABLE_NAME],
+ COLLECTION_NAME,
+ );
+
+ const span = spans[0];
+ assert.strictEqual(span.events.length, 5);
+ assert.strictEqual(span.events[0].name, "qdrant.search.request");
+ assert.strictEqual(span.events[1].name, "qdrant.search.result");
+ assert.strictEqual(span.events[2].name, "qdrant.search.result.0");
+ assert.strictEqual(span.events[3].name, "qdrant.search.result.1");
+ assert.strictEqual(span.events[4].name, "qdrant.search.result.2");
+ });
+
+ it("should set span attributes for retrieve", async () => {
+ await qdrantClient.retrieve(COLLECTION_NAME, {
+ ids: [32, 23, 42],
+ with_payload: true,
+ with_vector: true,
+ });
+
+ const spans = memoryExporter.getFinishedSpans();
+ assert.strictEqual(spans.length, 1);
+ assert.strictEqual(spans[0].name, `qdrant.retrieve`);
+
+ const attributes = spans[0].attributes;
+ assert.strictEqual(attributes[SpanAttributes.VECTOR_DB_VENDOR], "Qdrant");
+ assert.strictEqual(
+ attributes[SpanAttributes.VECTOR_DB_TABLE_NAME],
+ COLLECTION_NAME,
+ );
+ assert.strictEqual(attributes[SpanAttributes.VECTOR_DB_GET_COUNT], 3);
+ assert.strictEqual(
+ attributes[SpanAttributes.VECTOR_DB_GET_INCLUDE_METADATA],
+ true,
+ );
+ assert.strictEqual(
+ attributes[SpanAttributes.VECTOR_DB_GET_INCLUDE_VALUES],
+ true,
+ );
+ });
+
+ it("should set span attributes for delete", async () => {
+ await qdrantClient.delete(COLLECTION_NAME, {
+ points: [32, 23, 42, 24, 25, 26],
+ });
+
+ const spans = memoryExporter.getFinishedSpans();
+ assert.strictEqual(spans.length, 1);
+ assert.strictEqual(spans[0].name, `qdrant.delete`);
+
+ const attributes = spans[0].attributes;
+ assert.strictEqual(attributes[SpanAttributes.VECTOR_DB_VENDOR], "Qdrant");
+ assert.strictEqual(
+ attributes[SpanAttributes.VECTOR_DB_TABLE_NAME],
+ COLLECTION_NAME,
+ );
+ assert.strictEqual(attributes[SpanAttributes.VECTOR_DB_DELETE_COUNT], 6);
+ });
+});
diff --git a/packages/instrumentation-qdrant/tsconfig.json b/packages/instrumentation-qdrant/tsconfig.json
new file mode 100644
index 00000000..3c3ab535
--- /dev/null
+++ b/packages/instrumentation-qdrant/tsconfig.json
@@ -0,0 +1,10 @@
+{
+ "extends": "../../tsconfig.base.json",
+ "compilerOptions": {
+ "outDir": "dist",
+ "rootDir": "."
+ },
+ "files": [],
+ "include": ["src/**/*.ts", "test/**/*.ts"],
+ "references": []
+}
diff --git a/packages/instrumentation-vertexai/CHANGELOG.md b/packages/instrumentation-vertexai/CHANGELOG.md
index f4e31676..3e48d47a 100644
--- a/packages/instrumentation-vertexai/CHANGELOG.md
+++ b/packages/instrumentation-vertexai/CHANGELOG.md
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+# [0.9.0](https://github.com/traceloop/openllmetry-js/compare/v0.8.9...v0.9.0) (2024-07-04)
+
+**Note:** Version bump only for package @traceloop/instrumentation-vertexai
+
## [0.8.8](https://github.com/traceloop/openllmetry-js/compare/v0.8.7...v0.8.8) (2024-06-16)
**Note:** Version bump only for package @traceloop/instrumentation-vertexai
diff --git a/packages/instrumentation-vertexai/package.json b/packages/instrumentation-vertexai/package.json
index 19786ebc..63f1ce52 100644
--- a/packages/instrumentation-vertexai/package.json
+++ b/packages/instrumentation-vertexai/package.json
@@ -1,6 +1,6 @@
{
"name": "@traceloop/instrumentation-vertexai",
- "version": "0.8.8",
+ "version": "0.9.0",
"description": "Google's VertexAI Instrumentation",
"main": "dist/index.js",
"module": "dist/index.mjs",
@@ -39,7 +39,7 @@
"@opentelemetry/core": "^1.25.0",
"@opentelemetry/instrumentation": "^0.52.0",
"@opentelemetry/semantic-conventions": "^1.25.0",
- "@traceloop/ai-semantic-conventions": "^0.8.0"
+ "@traceloop/ai-semantic-conventions": "^0.9.0"
},
"devDependencies": {
"@google-cloud/aiplatform": "^3.10.0",
diff --git a/packages/traceloop-sdk/CHANGELOG.md b/packages/traceloop-sdk/CHANGELOG.md
index 699aef62..a7b6e00b 100644
--- a/packages/traceloop-sdk/CHANGELOG.md
+++ b/packages/traceloop-sdk/CHANGELOG.md
@@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+# [0.9.0](https://github.com/traceloop/openllmetry-js/compare/v0.8.9...v0.9.0) (2024-07-04)
+
+### Bug Fixes
+
+- **sdk:** option to silence initialization message ([#343](https://github.com/traceloop/openllmetry-js/issues/343)) ([75c68ce](https://github.com/traceloop/openllmetry-js/commit/75c68ceb09dec3766f30ed413bdeee637e1734a6))
+- **sdk:** versions on workflows & tasks ([#353](https://github.com/traceloop/openllmetry-js/issues/353)) ([eb6211f](https://github.com/traceloop/openllmetry-js/commit/eb6211f5cc9a2930c6bff1d9ffe3cb995eaf6669))
+
+### Features
+
+- Qdrant instrumentation ([#278](https://github.com/traceloop/openllmetry-js/issues/278)) ([3b8224f](https://github.com/traceloop/openllmetry-js/commit/3b8224fac062b6da3f84311569a5ffcc2e3b8744))
+
## [0.8.9](https://github.com/traceloop/openllmetry-js/compare/v0.8.8...v0.8.9) (2024-06-17)
### Bug Fixes
diff --git a/packages/traceloop-sdk/package.json b/packages/traceloop-sdk/package.json
index 51251280..75c6cdc6 100644
--- a/packages/traceloop-sdk/package.json
+++ b/packages/traceloop-sdk/package.json
@@ -1,6 +1,6 @@
{
"name": "@traceloop/node-server-sdk",
- "version": "0.8.9",
+ "version": "0.9.0",
"description": "Traceloop Software Development Kit (SDK) for Node.js",
"main": "dist/index.js",
"module": "dist/index.mjs",
@@ -38,17 +38,18 @@
"@opentelemetry/exporter-trace-otlp-proto": "^0.49.1",
"@opentelemetry/sdk-node": "^0.49.1",
"@sentry/node": "^7.111.0",
- "@traceloop/ai-semantic-conventions": "^0.8.0",
- "@traceloop/instrumentation-anthropic": "^0.8.8",
- "@traceloop/instrumentation-azure": "^0.8.8",
- "@traceloop/instrumentation-bedrock": "^0.8.8",
- "@traceloop/instrumentation-chromadb": "^0.8.8",
- "@traceloop/instrumentation-cohere": "^0.8.8",
- "@traceloop/instrumentation-langchain": "^0.8.8",
- "@traceloop/instrumentation-llamaindex": "^0.8.8",
- "@traceloop/instrumentation-openai": "^0.8.8",
- "@traceloop/instrumentation-pinecone": "^0.8.8",
- "@traceloop/instrumentation-vertexai": "^0.8.8",
+ "@traceloop/ai-semantic-conventions": "^0.9.0",
+ "@traceloop/instrumentation-anthropic": "^0.9.0",
+ "@traceloop/instrumentation-azure": "^0.9.0",
+ "@traceloop/instrumentation-bedrock": "^0.9.0",
+ "@traceloop/instrumentation-chromadb": "^0.9.0",
+ "@traceloop/instrumentation-cohere": "^0.9.0",
+ "@traceloop/instrumentation-langchain": "^0.9.0",
+ "@traceloop/instrumentation-llamaindex": "^0.9.0",
+ "@traceloop/instrumentation-openai": "^0.9.0",
+ "@traceloop/instrumentation-pinecone": "^0.9.0",
+ "@traceloop/instrumentation-qdrant": "^0.9.0",
+ "@traceloop/instrumentation-vertexai": "^0.9.0",
"@types/nunjucks": "^3.2.5",
"cross-fetch": "^4.0.0",
"fetch-retry": "^5.0.6",
@@ -69,6 +70,7 @@
"@pollyjs/adapter-node-http": "^6.0.6",
"@pollyjs/core": "^6.0.6",
"@pollyjs/persister-fs": "^6.0.6",
+ "@qdrant/js-client-rest": "^1.9.0",
"@types/mocha": "^10.0.6",
"@types/node": "^20.9.0",
"@types/uuid": "^9.0.7",
diff --git a/packages/traceloop-sdk/src/lib/configuration/index.ts b/packages/traceloop-sdk/src/lib/configuration/index.ts
index 64c749a1..184d8df3 100644
--- a/packages/traceloop-sdk/src/lib/configuration/index.ts
+++ b/packages/traceloop-sdk/src/lib/configuration/index.ts
@@ -70,11 +70,14 @@ export const initialize = (options: InitializeOptions) => {
logLevelToOtelLogLevel(options.logLevel),
);
}
- console.log(
- `Traceloop exporting traces to ${
- _configuration.exporter ? "a custom exporter" : _configuration.baseUrl
- }`,
- );
+
+ if (!options.silenceInitializationMessage) {
+ console.log(
+ `Traceloop exporting traces to ${
+ _configuration.exporter ? "a custom exporter" : _configuration.baseUrl
+ }`,
+ );
+ }
startTracing(_configuration);
initializeRegistry(_configuration);
diff --git a/packages/traceloop-sdk/src/lib/interfaces/initialize-options.interface.ts b/packages/traceloop-sdk/src/lib/interfaces/initialize-options.interface.ts
index 61c2f57b..5df379eb 100644
--- a/packages/traceloop-sdk/src/lib/interfaces/initialize-options.interface.ts
+++ b/packages/traceloop-sdk/src/lib/interfaces/initialize-options.interface.ts
@@ -13,6 +13,7 @@ import type * as AgentsModule from "langchain/agents";
import type * as ToolsModule from "langchain/tools";
import type * as llamaindex from "llamaindex";
import type * as chromadb from "chromadb";
+import type * as qdrant from "@qdrant/js-client-rest";
/**
* Options for initializing the Traceloop SDK.
@@ -86,6 +87,7 @@ export interface InitializeOptions {
};
llamaIndex?: typeof llamaindex;
chromadb?: typeof chromadb;
+ qdrant?: typeof qdrant;
};
/**
@@ -111,4 +113,10 @@ export interface InitializeOptions {
* Defaults to TRACELOOP_SYNC_DEV_POLLING_INTERVAL environment variable or 5 if not set.
*/
traceloopSyncDevPollingInterval?: number;
+
+ /**
+ * Whether to silence the initialization message. Optional.
+ * Defaults to false.
+ */
+ silenceInitializationMessage?: boolean;
}
diff --git a/packages/traceloop-sdk/src/lib/tracing/decorators.ts b/packages/traceloop-sdk/src/lib/tracing/decorators.ts
index a0675db1..c6bf2879 100644
--- a/packages/traceloop-sdk/src/lib/tracing/decorators.ts
+++ b/packages/traceloop-sdk/src/lib/tracing/decorators.ts
@@ -14,6 +14,7 @@ import { Telemetry } from "../telemetry/telemetry";
export type DecoratorConfig = {
name: string;
+ version?: number;
associationProperties?: { [name: string]: string };
traceContent?: boolean;
inputParameters?: unknown[];
@@ -26,6 +27,7 @@ function withEntity<
type: TraceloopSpanKindValues,
{
name,
+ version,
associationProperties,
traceContent: overrideTraceContent,
inputParameters,
@@ -69,6 +71,10 @@ function withEntity<
span.setAttribute(SpanAttributes.TRACELOOP_SPAN_KIND, type);
span.setAttribute(SpanAttributes.TRACELOOP_ENTITY_NAME, name);
+ if (version) {
+ span.setAttribute(SpanAttributes.TRACELOOP_ENTITY_VERSION, version);
+ }
+
if (shouldSendTraces()) {
try {
const input = inputParameters ?? args;
diff --git a/packages/traceloop-sdk/src/lib/tracing/index.ts b/packages/traceloop-sdk/src/lib/tracing/index.ts
index 3b11e5ea..99f1671e 100644
--- a/packages/traceloop-sdk/src/lib/tracing/index.ts
+++ b/packages/traceloop-sdk/src/lib/tracing/index.ts
@@ -30,6 +30,7 @@ import { CohereInstrumentation } from "@traceloop/instrumentation-cohere";
import { PineconeInstrumentation } from "@traceloop/instrumentation-pinecone";
import { LangChainInstrumentation } from "@traceloop/instrumentation-langchain";
import { ChromaDBInstrumentation } from "@traceloop/instrumentation-chromadb";
+import { QdrantInstrumentation } from "@traceloop/instrumentation-qdrant";
let _sdk: NodeSDK;
let _spanProcessor: SimpleSpanProcessor | BatchSpanProcessor;
@@ -44,6 +45,7 @@ let langchainInstrumentation: LangChainInstrumentation | undefined;
let llamaIndexInstrumentation: LlamaIndexInstrumentation | undefined;
let pineconeInstrumentation: PineconeInstrumentation | undefined;
let chromadbInstrumentation: ChromaDBInstrumentation | undefined;
+let qdrantInstrumentation: QdrantInstrumentation | undefined;
const instrumentations: Instrumentation[] = [];
@@ -93,6 +95,9 @@ export const initInstrumentations = () => {
chromadbInstrumentation = new ChromaDBInstrumentation({ exceptionLogger });
instrumentations.push(chromadbInstrumentation);
+
+ qdrantInstrumentation = new QdrantInstrumentation({ exceptionLogger });
+ instrumentations.push(qdrantInstrumentation);
};
export const manuallyInitInstrumentations = (
@@ -186,6 +191,12 @@ export const manuallyInitInstrumentations = (
instrumentations.push(chromadbInstrumentation);
chromadbInstrumentation.manuallyInstrument(instrumentModules.chromadb);
}
+
+ if (instrumentModules?.qdrant) {
+ qdrantInstrumentation = new QdrantInstrumentation({ exceptionLogger });
+ instrumentations.push(qdrantInstrumentation);
+ qdrantInstrumentation.manuallyInstrument(instrumentModules.qdrant);
+ }
};
/**
diff --git a/packages/traceloop-sdk/test/decorators.test.ts b/packages/traceloop-sdk/test/decorators.test.ts
index 7db6d038..6ac40c08 100644
--- a/packages/traceloop-sdk/test/decorators.test.ts
+++ b/packages/traceloop-sdk/test/decorators.test.ts
@@ -147,7 +147,7 @@ describe("Test SDK Decorators", () => {
it("should create spans for workflows using decoration syntax", async () => {
class TestOpenAI {
- @traceloop.workflow({ name: "sample_chat" })
+ @traceloop.workflow({ name: "sample_chat", version: 2 })
async chat(things: Map) {
const generations: Map = new Map();
for await (const [key, value] of things) {
@@ -195,6 +195,10 @@ describe("Test SDK Decorators", () => {
workflowSpan.attributes[`${SpanAttributes.TRACELOOP_ENTITY_NAME}`],
"sample_chat",
);
+ assert.strictEqual(
+ workflowSpan.attributes[`${SpanAttributes.TRACELOOP_ENTITY_VERSION}`],
+ 2,
+ );
assert.strictEqual(
workflowSpan.attributes[`${SpanAttributes.TRACELOOP_ENTITY_INPUT}`],
JSON.stringify({