Monitoring and Observability

1. Checking Index Statistics

Example: Stats

s = index.describe_index_stats()
print(s["total_vector_count"], s["dimension"], s.get("index_fullness"))

2. Monitoring Vector Count

MetricSource
Total vectorstotal_vector_count
Growth trendRecord over time
AlertingThreshold-based on fullness

3. Tracking Namespace Statistics

Example: Per-Namespace

for ns, info in s["namespaces"].items():
    push_metric("pinecone.ns.vector_count",
                value=info["vector_count"], tags={"ns": ns})

4. Measuring Query Latency

Example: Histogram

from prometheus_client import Histogram
qlat = Histogram("pinecone_query_latency_seconds", "...")

with qlat.time():
    res = index.query(vector=qv, top_k=10)

5. Monitoring Upsert Throughput

MetricDetail
Vectors/secClient timer / total batch size
Failed batchesCounter
Bytes/secFor storage growth

6. Tracking API Error Rates

Example: Error Counter

from prometheus_client import Counter
err = Counter("pinecone_errors_total", "...", ["op", "code"])

try:
    index.upsert(vectors=batch)
except Exception as e:
    err.labels(op="upsert", code=getattr(e, "status", "unknown")).inc()
    raise

7. Monitoring Index Fullness

ValueAction
< 0.7Healthy
0.7 – 0.85Plan scale-up
> 0.85Scale immediately
1.0Upserts rejected

8. Implementing Request Logging

Example: Structured Log

import logging, time
log = logging.getLogger("pinecone")

def query_logged(qv, top_k):
    t = time.perf_counter()
    res = index.query(vector=qv, top_k=top_k)
    log.info("query", extra={"top_k": top_k,
        "matches": len(res["matches"]),
        "ms": (time.perf_counter()-t)*1000})
    return res

9. Setting Up Alerting

AlertThreshold
Error rate > 1%5-min window
p99 latency > 500ms5-min window
Fullness > 0.85Immediate
QPS dropoff > 50%Anomaly detection

10. Using Metrics Dashboards

DashboardSource
Pinecone consoleBuilt-in metrics
Datadog/GrafanaCustom from SDK
Prometheus + GrafanaSelf-hosted

11. Tracking Cost Metrics

MetricWhy
Storage GBPredict serverless storage bill
Read unitsQuery cost projection
Write unitsUpsert cost projection
Pod-hoursPod-based pricing

12. Understanding Usage Limits

LimitApprox (plan-dependent)
RPMPlan-tiered; soft
Concurrent connectionsPlan-tiered
Index count20 (Standard)