If this field is extracted try this.
your base search | stats count by uripath
your base search | chart count by uripath
and use pie chart as visualisation.
Then (based on your example, your just need first part of uri, '/foo' and '/bar'), try this.
your base search| rex field=uripath "^(?<uriprefix>.*)\/"| stats count by uri_prefix
I don't think that does what I need. I'm expecting two figures: one for all uripaths that start with /foo and another for all uripaths that start with /bar.
It seems slashes were removed in the comment field. try this.
your base search| rex field=uripath "^/(?<uriprefix>[^/]*)"| stats count by uri_prefix