apply
Maps a log aggregation key from a potentially unbounded set of key values to a bounded set of instances.
Implementations of this method should be efficient, and avoid allocating memory wherever possible. The returned value must be an immutable identifier with minimal additional allocation requirements and ideally have singleton semantics (e.g. an Enum or Integer value).
Warning: If keys are not known to have natural singleton semantics (e.g.
String) then returning the given key instance is generally a bad idea. Even if the set of key values is small, the set of distinct allocated instances passed to <> can be unbounded, and that's what matters. As such it is always better to map keys to some singleton identifier or intern the keys in some way.
Return
an immutable value from some known bounded set, which will be held persistently by internal Flogger data structures as part of the log aggregation feature. If null is returned, the corresponding call to per(key, STRATEGY) has no effect.
Parameters
a non-null key from a potentially unbounded set of log aggregation keys.