One of the planned features of the Metrics Platform client libraries is to conditionally produce events based on their properties (see T274175). A WIP Java implementation of this behavior is available here.
Dmitry suggested that Kotlin provides better support for the kind of introspection we need to do than using Java reflection. This task encompasses the work of (1) investigating what these operations would look like in Kotlin, and (2) updating the consolidated Java client library (T281757) to support Kotlin.