Only allow DNS and block all direct IP addresses

In addition to DNS connection, is it possible to see how much connection is made with direct IP addresses?

Not with Pi-hole. If a client has an IP, it has no need to resolve a domain name to the IP, and no request will be sent to Pi-hole. Pi-hole can only show the queries it receives, and they will all be for domain names.

You need a firewall to block or count at the IP level.

Unfortunately. Thanks for the quick response. Have a nice new year.