{"id":2641,"library":"opentelemetry-instrumentation-pinecone","title":"OpenTelemetry Pinecone Instrumentation","description":"This library provides OpenTelemetry instrumentation for the Pinecone vector database client. It automatically captures spans and traces for operations, adhering to OpenTelemetry's Generative AI Semantic Conventions. As part of the `openllmetry` project, it follows a rapid release cycle, with the current version being 0.58.0.","status":"active","version":"0.58.0","language":"en","source_language":"en","source_url":"https://github.com/traceloop/openllmetry/tree/main/packages/opentelemetry-instrumentation-pinecone","tags":["opentelemetry","observability","tracing","pinecone","vector database","LLM","AI","instrumentation"],"install":[{"cmd":"pip install opentelemetry-instrumentation-pinecone pinecone opentelemetry-sdk","lang":"bash","label":"Install with Pinecone client and OTel SDK"}],"dependencies":[{"reason":"The instrumentation targets the `pinecone` client library. It must be installed separately for the instrumentation to function.","package":"pinecone","optional":false},{"reason":"Required for configuring tracing providers and exporters to process and send telemetry data.","package":"opentelemetry-sdk","optional":false},{"reason":"Core OpenTelemetry API, usually pulled in by the SDK.","package":"opentelemetry-api","optional":false}],"imports":[{"symbol":"PineconeInstrumentor","correct":"from opentelemetry.instrumentation.pinecone import PineconeInstrumentor"}],"quickstart":{"code":"import os\nfrom opentelemetry import trace\nfrom opentelemetry.sdk.resources import Resource\nfrom opentelemetry.sdk.trace import TracerProvider\nfrom opentelemetry.sdk.trace.export import ConsoleSpanExporter, SimpleSpanProcessor\nfrom opentelemetry.instrumentation.pinecone import PineconeInstrumentor\nimport pinecone\n\n# 1. Setup OpenTelemetry Tracer Provider (for console output)\nresource = Resource.create({\"service.name\": \"my-pinecone-app\"})\nprovider = TracerProvider(resource=resource)\nspan_processor = SimpleSpanProcessor(ConsoleSpanExporter())\nprovider.add_span_processor(span_processor)\ntrace.set_tracer_provider(provider)\n\n# 2. Instrument Pinecone client calls\nPineconeInstrumentor().instrument()\n\n# 3. Use Pinecone as usual\napi_key = os.environ.get(\"PINECONE_API_KEY\", \"YOUR_API_KEY\")\nenvironment = os.environ.get(\"PINECONE_ENVIRONMENT\", \"YOUR_ENVIRONMENT\")\n\nif api_key == \"YOUR_API_KEY\" or environment == \"YOUR_ENVIRONMENT\":\n    print(\"Please set PINECONE_API_KEY and PINECONE_ENVIRONMENT environment variables.\")\n    print(\"Skipping Pinecone client interaction due to missing credentials.\")\nelif not pinecone.list_indexes: # Check if the package is the new pinecone library\n    print(\"It appears you are using the old `pinecone-client` library. This instrumentation requires `pinecone` (v2+).\")\n    print(\"Skipping Pinecone client interaction.\")\nelse:\n    try:\n        pinecone.init(api_key=api_key, environment=environment)\n        \n        # This operation will be traced\n        indexes = pinecone.list_indexes()\n        print(f\"Pinecone Indexes: {indexes}\")\n        print(\"Check your console for OpenTelemetry traces!\")\n    except Exception as e:\n        print(f\"Error interacting with Pinecone: {e}\")\n        print(\"Ensure your Pinecone API Key and Environment are correct and that you are using `pinecone` v2+.\")","lang":"python","description":"This quickstart demonstrates how to set up basic OpenTelemetry console tracing and instrument the Pinecone client. Ensure you have the `pinecone` library (v2+) and OpenTelemetry SDK installed. Set `PINECONE_API_KEY` and `PINECONE_ENVIRONMENT` environment variables for a runnable example."},"warnings":[{"fix":"Upgrade your Pinecone client to `pinecone` (version 2.x.x or higher) and install `opentelemetry-instrumentation-pinecone` 0.53.0 or higher. If you must use `pinecone-client`, pin your instrumentation version to <0.53.0.","message":"Starting from version 0.53.0, this instrumentation switched from supporting the deprecated `pinecone-client` package to the newer `pinecone` (v2.x.x) package. If you are using an older version of the instrumentation or the older Pinecone client, ensure compatibility.","severity":"breaking","affected_versions":">=0.53.0"},{"fix":"Refer to the OpenTelemetry Python SDK documentation for full setup instructions, including configuring exporters like OTLP, Jaeger, or Zipkin.","message":"The `PineconeInstrumentor().instrument()` call only patches the `pinecone` library methods. To actually collect, process, and export telemetry data, you must configure an OpenTelemetry `TracerProvider` with appropriate `SpanProcessors` and `SpanExporters`.","severity":"gotcha","affected_versions":"All"},{"fix":"Ensure `pip install pinecone` is run in your environment alongside the instrumentation package. Verify you are using `pinecone` v2.x.x+.","message":"The `pinecone` library itself is a peer dependency and is not installed automatically with `opentelemetry-instrumentation-pinecone`. You must explicitly install it.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-10T00:00:00.000Z","next_check":"2026-07-09T00:00:00.000Z"}