Interface BaggageBuilder

    • Method Detail

      • setParent

        BaggageBuilder setParent​(io.opentelemetry.context.Context context)
        Sets the parent Baggage to use from the specified Context. If no parent Baggage is provided, the value of Baggage.current() at build() time will be used as parent, unless setNoParent() was called.

        If no parent Baggage is available in the specified Context, the resulting Baggage will become a root instance, as if setNoParent() had been called.

        This must be used to create a Baggage when manual Context propagation is used.

        If called multiple times, only the last specified value will be used.

        Parameters:
        context - the Context.
        Returns:
        this.
        Throws:
        NullPointerException - if context is null.
        See Also:
        setNoParent()
      • put

        BaggageBuilder put​(String key,
                           String value,
                           BaggageEntryMetadata entryMetadata)
        Adds the key/value pair and metadata regardless of whether the key is present.
        Parameters:
        key - the String key which will be set.
        value - the String value to set for the given key.
        entryMetadata - the BaggageEntryMetadata metadata to set for the given key.
        Returns:
        this
      • put

        default BaggageBuilder put​(String key,
                                   String value)
        Adds the key/value pair with empty metadata regardless of whether the key is present.
        Parameters:
        key - the String key which will be set.
        value - the String value to set for the given key.
        Returns:
        this
      • remove

        BaggageBuilder remove​(String key)
        Removes the key if it exists.
        Parameters:
        key - the String key which will be removed.
        Returns:
        this
      • build

        Baggage build()
        Creates a Baggage from this builder.
        Returns:
        a Baggage with the same entries as this builder.