Skip to main content

OpenTelemetry instrumentation for MongoDB Atlas Vector Search

Project description

traceAI-mongodb

OpenTelemetry instrumentation for MongoDB Atlas Vector Search.

Installation

pip install traceAI-mongodb

Quick Start

from fi_instrumentation import register
from traceai_mongodb import MongoDBInstrumentor
from pymongo import MongoClient

trace_provider = register(project_name="my-rag-app")
MongoDBInstrumentor().instrument(tracer_provider=trace_provider)

client = MongoClient("mongodb+srv://...")
db = client["mydb"]
collection = db["documents"]

# Vector search operations are traced
results = collection.aggregate([
    {
        "$vectorSearch": {
            "index": "vector_index",
            "path": "embedding",
            "queryVector": [0.1, 0.2, ...],
            "numCandidates": 100,
            "limit": 5
        }
    }
])

Instrumented Operations

Operation Span Name Description
aggregate mongodb aggregate Aggregation pipeline (includes $vectorSearch)
insert_one mongodb insert_one Insert single document
insert_many mongodb insert_many Batch insert
update_one mongodb update_one Update single document
update_many mongodb update_many Batch update
delete_one mongodb delete_one Delete single document
delete_many mongodb delete_many Batch delete
find mongodb find Query documents
find_one mongodb find_one Find single document

Vector Search Detection

The instrumentor automatically detects $vectorSearch stages in aggregation pipelines and captures:

  • Vector index name
  • Query vector dimensions
  • numCandidates
  • limit

License

Apache License 2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

traceai_mongodb-0.1.0.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

traceai_mongodb-0.1.0-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file traceai_mongodb-0.1.0.tar.gz.

File metadata

  • Download URL: traceai_mongodb-0.1.0.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for traceai_mongodb-0.1.0.tar.gz
Algorithm Hash digest
SHA256 fedf680e02234c48ec3d4ac45af43f8bc78a8390d8dac26a2251fc1fa91d343b
MD5 8cec9fd0e456a17a65a385d1c49eea04
BLAKE2b-256 b2bdc2f3561dbf3484870f770f7fee8e335a4cf08f3b3867c6898521463a28ca

See more details on using hashes here.

File details

Details for the file traceai_mongodb-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: traceai_mongodb-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for traceai_mongodb-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f700c771999741adb0e2e7bf647f4e52504de2d3aa144e59a5db64e80630dfc1
MD5 92b3d8207a6e04126809e633321dc5ed
BLAKE2b-256 b61b6eec0d6e420cd4eebcf050a8e6bd72a32d61093d306b0b8d995bd7790258

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page