Interface EventResources

  • All Known Implementing Classes:
    EventResourcesImpl

    public interface EventResources
    A container for resources The container allows resources to be shared across multiple events with different root events. An example usage of this would be used for a server connection. We want all events initiated on the connection to share resource values, such as remote and local socket. However, each root event on the connection may be for a different trace.
    • Method Detail

      • resource

        EventResources resource​(java.lang.String key,
                                java.lang.Object value)
        Add a resource for the event. Resources are inherited by child events.
        Parameters:
        key - the key to identify the resource
        value - the value which will be logged for the resource. This is converted to a string before logging.
        Returns:
        this
      • resource

        EventResources resource​(java.lang.String key,
                                java.util.function.Supplier<java.lang.String> value)
        Add a resource for the event using a supplier. The supplier is used in the case that generating the string from the object is expensive or we want to generate a custom string.
        Parameters:
        key - the key to identify the resource
        value - a supplier which returns the value to be logged for this resource
        See Also:
        resource(java.lang.String,java.lang.Object)