Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Qdrant instrumentation #278

Merged
merged 24 commits into from
Jun 23, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.10.13
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ OpenLLMetry-JS can instrument everything that [OpenTelemetry already instruments

- ✅ Pinecone
- ✅ Chroma
- ✅ Qdrant
- ⏳ Weaviate
- ⏳ Milvus

Expand Down
45 changes: 35 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/instrumentation-qdrant/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
18 changes: 18 additions & 0 deletions packages/instrumentation-qdrant/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
}
]
}
2 changes: 2 additions & 0 deletions packages/instrumentation-qdrant/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/dist
/coverage
55 changes: 55 additions & 0 deletions packages/instrumentation-qdrant/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# 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: <https://opentelemetry.io/>
- For more about OpenTelemetry JavaScript: <https://github.com/open-telemetry/opentelemetry-js>
- 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
51 changes: 51 additions & 0 deletions packages/instrumentation-qdrant/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"name": "@traceloop/instrumentation-qdrant",
"version": "0.8.1",
"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 <info@qdrant.tech>",
"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.44.0",
"@opentelemetry/semantic-conventions": "^1.22.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"
},
"homepage": "https://github.com/traceloop/openllmetry-js/tree/main/packages/instrumentation-qdrant",
"gitHead": "ef1e70d6037f7b5c061056ef2be16e3f55f02ed5"
}
37 changes: 37 additions & 0 deletions packages/instrumentation-qdrant/rollup.config.js
Original file line number Diff line number Diff line change
@@ -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",
},
}),
];
18 changes: 18 additions & 0 deletions packages/instrumentation-qdrant/src/index.ts
Original file line number Diff line number Diff line change
@@ -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";
Loading
Loading