Pinecone

Trace Pinecone vector database operations with Respan.
  1. Sign up — Create an account at platform.respan.ai
  2. Create an API key — Generate one on the API keys page
  3. Add credits or a provider key — Add credits on the Credits page or connect your own provider key on the Integrations page

Add the Docs MCP to your AI coding tool to get help building with Respan. No API key needed.

1{
2 "mcpServers": {
3 "respan-docs": {
4 "url": "https://mcp.respan.ai/mcp/docs"
5 }
6 }
7}

What is Pinecone?

Pinecone is a managed vector database designed for machine learning applications. It provides low-latency vector search at scale with features like namespaces, metadata filtering, and serverless deployment.

Setup

1

Install packages

$pip install respan-ai opentelemetry-instrumentation-pinecone pinecone
2

Set environment variables

$export RESPAN_API_KEY="YOUR_RESPAN_API_KEY"
$export PINECONE_API_KEY="YOUR_PINECONE_API_KEY"
$export OTEL_EXPORTER_OTLP_ENDPOINT="https://api.respan.ai/api"
$export OTEL_EXPORTER_OTLP_HEADERS="Authorization=Bearer $RESPAN_API_KEY"
3

Run a traced example

1from respan import Respan
2
3# Auto-discover and activate all installed instrumentors
4respan = Respan(is_auto_instrument=True)
5
6from pinecone import Pinecone, ServerlessSpec
7
8# Initialize Pinecone
9pc = Pinecone()
10
11# Create an index
12pc.create_index(
13 name="documents",
14 dimension=4,
15 metric="cosine",
16 spec=ServerlessSpec(cloud="aws", region="us-east-1"),
17)
18index = pc.Index("documents")
19
20# Upsert vectors with metadata
21index.upsert(
22 vectors=[
23 {"id": "doc1", "values": [0.1, 0.2, 0.3, 0.4], "metadata": {"topic": "observability"}},
24 {"id": "doc2", "values": [0.5, 0.6, 0.7, 0.8], "metadata": {"topic": "search"}},
25 {"id": "doc3", "values": [0.2, 0.3, 0.4, 0.5], "metadata": {"topic": "embeddings"}},
26 ],
27 namespace="articles",
28)
29
30# Query for similar vectors
31results = index.query(
32 vector=[0.1, 0.2, 0.3, 0.4],
33 top_k=2,
34 namespace="articles",
35 include_metadata=True,
36)
37for match in results["matches"]:
38 print(f"{match['id']} (score: {match['score']:.4f}) — {match['metadata']['topic']}")
39
40respan.flush()
4

View your trace

Open the Traces page to see your Pinecone operation spans.

Always call respan.flush() before your process exits. Without it, pending spans may be lost.

What gets traced

  • Index creation and management
  • Vector upsert and delete operations
  • Similarity search queries and scores
  • Namespace operations
  • Metadata filtering
  • Operation latency

Learn more