def _wrap(
    tracer,
    query_duration_metric,
    read_units_metric,
    write_units_metric,
    scores_metric,
    to_wrap,
    wrapped,
    instance,
    args,
    kwargs,
):
    """Instruments and calls every function defined in TO_WRAP."""
    if context_api.get_value(_SUPPRESS_INSTRUMENTATION_KEY):
        return wrapped(*args, **kwargs)

    name = to_wrap.get("span_name")
    with tracer.start_as_current_span(
        name,
        kind=SpanKind.CLIENT,
        attributes={
            AISpanAttributes.VECTOR_DB_VENDOR: "Pinecone",
        },
    ) as span:
        if span.is_recording():
            _set_input_attributes(span, instance, kwargs)
            if to_wrap.get("method") == "query":
                set_query_input_attributes(span, kwargs)

        shared_attributes = {}
        if hasattr(instance, "_config"):
            shared_attributes["server.address"] = instance._config.host

        start_time = time.time()
        response = wrapped(*args, **kwargs)
        end_time = time.time()

        duration = end_time - start_time
        if duration > 0 and query_duration_metric and to_wrap.get("method") == "query":
            query_duration_metric.record(duration, shared_attributes)

        if response:
            if span.is_recording():
                if to_wrap.get("method") == "query":
                    set_query_response(span, scores_metric, shared_attributes, response)

                _set_response_attributes(
                    span,
                    read_units_metric,
                    write_units_metric,
                    shared_attributes,
                    response,
                )

                span.set_status(Status(StatusCode.OK))

        return response
Instruments and calls every function defined in TO_WRAP.
packages/opentelemetry-instrumentation-pinecone/opentelemetry/instrumentation/pinecone/__init__.py