single

public static MetadataKey<T> single<T>(String label, Class<? extends T> clazz)

Creates a key for a single piece of metadata. If metadata is set more than once using this key for the same log statement, the last set value will be the one used, and other values will be ignored (although callers should never rely on this behavior).

Key instances behave like singletons, and two key instances with the same label will still be considered distinct. The recommended approach is to always assign MetadataKey instances to static final constants.