In the "Transactions duration distribution" histogram, hover over the buckets (latency ranges) and you will see how many transactions were captured for that latency range.
When you click on a bucket, you'll be presented with a single sample trace/transaction which falls into that bucket. There is another ongoing Discuss thread regarding being able to look at multiple trace samples: Look at more than one sampled trace
so for the above statement it means that we have to modify the application code to include the public API correct ?
Correct.
is there any other way to do it from the elastic UI (Kibana) or through the agent properties ?
For the Java agent specifically, there are a couple of agent properties that may be relevant to your use case:
If these don't help, you could alternatively configure Ingest Node to rewrite the transaction name field values. You would have to take care to rewrite associated metrics documents as well.