Skip to content

Commit 3b8224f

Browse files
Anush008nirga
andauthored
feat: Qdrant instrumentation (#278)
Co-authored-by: Nir Gazit <[email protected]>
1 parent 1b1aa3d commit 3b8224f

20 files changed

+840
-18
lines changed

.github/dependabot.yml

+6
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ updates:
4646
interval: "weekly"
4747
labels:
4848
- "instrumentation-pinecone"
49+
- package-ecosystem: "npm"
50+
directory: "/packages/instrumentation-qdrant"
51+
schedule:
52+
interval: "weekly"
53+
labels:
54+
- "instrumentation-qdrant"
4955
- package-ecosystem: "npm"
5056
directory: "/packages/instrumentation-vertexai"
5157
schedule:

.github/workflows/ci.yml

+5
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ jobs:
2828
build-and-test:
2929
name: Build and test
3030
runs-on: ubuntu-latest
31+
services:
32+
qdrant:
33+
image: qdrant/qdrant
34+
ports:
35+
- 6333:6333
3136
permissions:
3237
contents: "read"
3338
id-token: "write"

.python-version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.10.13

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ OpenLLMetry-JS can instrument everything that [OpenTelemetry already instruments
119119

120120
- ✅ Pinecone
121121
- ✅ Chroma
122+
- ✅ Qdrant
122123
- ⏳ Weaviate
123124
- ⏳ Milvus
124125

package-lock.json

+57-18
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/ai-semantic-conventions/src/SemanticAttributes.ts

+8
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@ export const SpanAttributes = {
3838
// Vector DB
3939
VECTOR_DB_VENDOR: "db.system",
4040
VECTOR_DB_QUERY_TOP_K: "db.vector.query.top_k",
41+
VECTOR_DB_TABLE_NAME: "db.vector.table_name",
42+
VECTOR_DB_ADD_COUNT: "db.vector.add.count",
43+
VECTOR_DB_DELETE_SELECTOR: "db.vector.delete.selector",
44+
VECTOR_DB_DELETE_COUNT: "db.vector.delete.count",
45+
VECTOR_DB_GET_SELECTOR: "db.vector.get.selector",
46+
VECTOR_DB_GET_COUNT: "db.vector.get.count",
47+
VECTOR_DB_GET_INCLUDE_METADATA: "db.vector.get.include_metadata",
48+
VECTOR_DB_GET_INCLUDE_VALUES: "db.vector.get.include_values",
4149

4250
// LLM Workflows
4351
TRACELOOP_SPAN_KIND: "traceloop.span.kind",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"extends": ["../../.eslintrc.json"],
3+
"ignorePatterns": ["!**/*"],
4+
"overrides": [
5+
{
6+
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
7+
"rules": {}
8+
},
9+
{
10+
"files": ["*.ts", "*.tsx"],
11+
"rules": {}
12+
},
13+
{
14+
"files": ["*.js", "*.jsx"],
15+
"rules": {}
16+
}
17+
]
18+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/dist
2+
/coverage
+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# OpenTelemetry Qdrant instrumentation for Node.js
2+
3+
[![NPM Published Version][npm-img]][npm-url]
4+
[![Apache License][license-image]][license-image]
5+
6+
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.
7+
8+
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.
9+
10+
Compatible with OpenTelemetry JS API and SDK `1.0+`.
11+
12+
## Installation
13+
14+
```bash
15+
npm install --save @traceloop/instrumentation-qdrant
16+
```
17+
18+
## Supported Versions
19+
20+
- `>=1.9.0`
21+
22+
## Usage
23+
24+
To load a specific plugin, specify it in the registerInstrumentations's configuration:
25+
26+
```js
27+
const { NodeTracerProvider } = require("@opentelemetry/sdk-trace-node");
28+
const { QdrantInstrumentation } = require("@traceloop/instrumentation-qdrant");
29+
const { registerInstrumentations } = require("@opentelemetry/instrumentation");
30+
31+
const provider = new NodeTracerProvider();
32+
provider.register();
33+
34+
registerInstrumentations({
35+
instrumentations: [new QdrantInstrumentation()],
36+
});
37+
```
38+
39+
## Useful links
40+
41+
- For more information on OpenTelemetry, visit: <https://opentelemetry.io/>
42+
- For more about OpenTelemetry JavaScript: <https://github.com/open-telemetry/opentelemetry-js>
43+
- For help or feedback on this project, join us on [Slack][slack-url]
44+
45+
## License
46+
47+
Apache 2.0 - See [LICENSE][license-url] for more information.
48+
49+
[slack-url]: https://traceloop.com/slack
50+
[license-url]: https://github.com/traceloop/openllmetry-js/blob/main/LICENSE
51+
[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
52+
[npm-url]: https://www.npmjs.com/package/@traceloop/instrumentation-qdrant
53+
[npm-img]: https://badge.fury.io/js/%40traceloop%2Finstrumentation-qdrant.svg
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{
2+
"name": "@traceloop/instrumentation-qdrant",
3+
"version": "0.8.8",
4+
"description": "Qdrant Instrumentation",
5+
"main": "dist/src/index.js",
6+
"types": "dist/src/index.d.ts",
7+
"repository": "traceloop/openllmetry-js",
8+
"scripts": {
9+
"build": "rollup -c",
10+
"lint": "eslint . --ext .ts",
11+
"lint:fix": "eslint . --ext .ts --fix",
12+
"test": "ts-mocha -p tsconfig.json 'tests/**/*.test.ts' --timeout 20000"
13+
},
14+
"keywords": [
15+
"opentelemetry",
16+
"nodejs",
17+
"tracing",
18+
"attributes",
19+
"semantic conventions"
20+
],
21+
"author": "Qdrant Team <[email protected]>",
22+
"license": "Apache-2.0",
23+
"engines": {
24+
"node": ">=14"
25+
},
26+
"files": [
27+
"dist/src/**/*.js",
28+
"dist/src/**/*.js.map",
29+
"dist/src/**/*.d.ts",
30+
"doc",
31+
"LICENSE",
32+
"README.md",
33+
"package.json"
34+
],
35+
"publishConfig": {
36+
"access": "public"
37+
},
38+
"dependencies": {
39+
"@opentelemetry/core": "^1.8.0",
40+
"@opentelemetry/instrumentation": "^0.52.0",
41+
"@traceloop/ai-semantic-conventions": "^0.8.0"
42+
},
43+
"devDependencies": {
44+
"@pollyjs/adapter-node-http": "^6.0.6",
45+
"@pollyjs/core": "^6.0.6",
46+
"@pollyjs/persister-fs": "^6.0.6",
47+
"@qdrant/js-client-rest": "^1.9.0",
48+
"uuid": "^10.0.0"
49+
},
50+
"homepage": "https://github.com/traceloop/openllmetry-js/tree/main/packages/instrumentation-qdrant",
51+
"gitHead": "ef1e70d6037f7b5c061056ef2be16e3f55f02ed5"
52+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
const dts = require("rollup-plugin-dts");
2+
const typescript = require("@rollup/plugin-typescript");
3+
const json = require("@rollup/plugin-json");
4+
5+
// eslint-disable-next-line @typescript-eslint/no-var-requires
6+
const name = require("./package.json").main.replace(/\.js$/, "");
7+
8+
const bundle = (config) => ({
9+
...config,
10+
input: "src/index.ts",
11+
external: (id) => !/^[./]/.test(id),
12+
});
13+
14+
exports.default = [
15+
bundle({
16+
plugins: [typescript.default(), json.default()],
17+
output: [
18+
{
19+
file: `${name}.js`,
20+
format: "cjs",
21+
sourcemap: true,
22+
},
23+
{
24+
file: `${name}.mjs`,
25+
format: "es",
26+
sourcemap: true,
27+
},
28+
],
29+
}),
30+
bundle({
31+
plugins: [dts.default()],
32+
output: {
33+
file: `${name}.d.ts`,
34+
format: "es",
35+
},
36+
}),
37+
];
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
* Copyright Traceloop
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
export * from "./instrumentation";
18+
export * from "./types";

0 commit comments

Comments
 (0)