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")
    with tracer.start_as_current_span(name) as span:
        span.set_attribute(SpanAttributes.DB_SYSTEM, "milvus")
        span.set_attribute(SpanAttributes.DB_OPERATION, to_wrap.get("method"))

        if to_wrap.get("method") == "insert":
            _set_insert_attributes(span, kwargs)
        elif to_wrap.get("method") == "upsert":
            _set_upsert_attributes(span, kwargs)
        elif to_wrap.get("method") == "delete":
            _set_delete_attributes(span, kwargs)
        elif to_wrap.get("method") == "search":
            _set_search_attributes(span, kwargs)
        elif to_wrap.get("method") == "get":
            _set_get_attributes(span, kwargs)
        elif to_wrap.get("method") == "query":
            _set_query_attributes(span, kwargs)
        elif to_wrap.get("method") == "create_collection":
            _set_create_collection_attributes(span, kwargs)
        elif to_wrap.get("method") == "hybrid_search":
            _set_hybrid_search_attributes(span, kwargs)

        return_value = wrapped(*args, **kwargs)

        if to_wrap.get("method") == "query":
            _add_query_result_events(span, return_value)

        if (
            to_wrap.get("method") == "search"
            or to_wrap.get("method") == "hybrid_search"
        ):
            _add_search_result_events(span, return_value)

    return return_value
Instruments and calls every function defined in TO_WRAP.
packages/opentelemetry-instrumentation-milvus/opentelemetry/instrumentation/milvus/wrapper.py