def METHOD_NAME(self, query, vars=None):  # noqa: A002
    """just wrap the cursor execution in a span"""
    if not self._datadog_tracer:
        return psycopg_module.extensions.cursor.METHOD_NAME(self, query, vars)
    with self._datadog_tracer.trace(
        schematize_database_operation("postgres.query", database_provider="postgresql"),
        service=self._datadog_service,
        span_type=SpanTypes.SQL,
    ) as s:
        s.set_tag_str(COMPONENT, config.psycopg.integration_name)
        s.set_tag_str(db.SYSTEM, config.psycopg.dbms_name)
        # set span.kind to the type of operation being performed
        s.set_tag_str(SPAN_KIND, SpanKind.CLIENT)
        s.set_tag(SPAN_MEASURED_KEY)
        if not s.sampled:
            return super(TracedCursor, self).METHOD_NAME(query, vars)
        s.resource = query
        s.set_tags(self._datadog_tags)
        try:
            return super(TracedCursor, self).METHOD_NAME(query, vars)
        finally:
            s.set_metric(db.ROWCOUNT, self.rowcount)