The core problem with "only recording the top percentiles" is that you have no idea whether or not something is in the top percentiles at the time you record it. There are probably several ways to address that problem.
As something like this can certainly be useful. Here are a couple of possible approaches:
A. As Moses Nakamura suggests in his post, you can keep a recording of all recent events, and process that every interval to keep details on events above a certain %'ile (for a %'ile within the interval), or on the top N events. This can be done with a simple double-pass mechanism (first process everything to establish percentiles, then use those percentile levels to filter the list in the next pass). This mechanism will be able to trace and report on all events above a certain percentile without "sampling".
B. If a sampling of one context per latency level is sufficient (which it may often be), we could create a variant of HdrHistogram that stored a single context ID per value level (which only doubles the storage requirements but keeps them fixed and capped). This would allow you to extract a context per value with something like a getSampledContextAtValue() call. [Note that in this mode, only one context is retained for a specific value [within the accuracy level spec'ed for the histogram], but as values often vary and the resolution can be fairly high, you may find multiple samples spread around a wide range of high values].
C. I can see a use for a variant of (B) that keeps two (or more?) context info items per value here. Specifically, a timestamp and a context ID (i.e. useful for "tell me 'what and when' for the top N events"). While this can be done by muxing information into a single 64 bit context ID (e.g. time and id in one word), having a total of 128 bits is probably nicer to work with. [this is a good example of where value types would be really nice to have].
If people think that a value-based-sampling of event IDs is a useful enough thing, I'd be happy to look at adding it to HdrHistogram. E.g. as a ValueContextHistogram class that would support recordValue(long value, long context) and getSampledContextAtValue(long value) methods.I can see possible context retention policies of "keep last", "keep first", or "keep random" as long as we keep one value that is not valid for context (e.g. Long.MIN_VALUE).