def _wrap(tracer, 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")
    method = to_wrap.get("method")
    with tracer.start_as_current_span(
        name,
        kind=SpanKind.CLIENT,
        attributes={
            SpanAttributes.VECTOR_DB_VENDOR: "Qdrant",
        },
    ) as span:
        _set_collection_name_attribute(
            span, method, args, kwargs
        )  # Set the collection name attribute for all traced methods

        # Begin setting addional attributes for specific methods
        if method == "upsert":
            _set_upsert_attributes(span, args, kwargs)
        elif method == "add":
            _set_upload_attributes(span, args, kwargs, method, "documents")
        elif method == "upload_points":
            _set_upload_attributes(span, args, kwargs, method, "points")
        elif method == "upload_records":
            _set_upload_attributes(span, args, kwargs, method, "records")
        elif method == "upload_collection":
            _set_upload_attributes(span, args, kwargs, method, "vectors")
        elif method in [
            "search",
            "search_groups",
            "query",
            "discover",
            "recommend",
            "recommend_groups",
        ]:
            _set_search_attributes(span, args, kwargs)
        elif method in ["search_batch", "recommend_batch", "discover_batch"]:
            _set_batch_search_attributes(span, args, kwargs, method)

        response = wrapped(*args, **kwargs)
        if response:
            span.set_status(Status(StatusCode.OK))
    return response
Instruments and calls every function defined in TO_WRAP.
packages/opentelemetry-instrumentation-qdrant/opentelemetry/instrumentation/qdrant/wrapper.py