Update the docs on the TextMapPropagator to be closer to the specification. (#2931)

This commit is contained in:
John Watson 2021-02-24 13:06:57 -08:00 committed by GitHub
parent bf5fa57df5
commit 1102efae1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 8 deletions

View File

@ -100,7 +100,7 @@ public interface TextMapPropagator {
Collection<String> fields(); Collection<String> fields();
/** /**
* Injects the value downstream, for example as HTTP headers. The carrier may be null to * Injects data for downstream consumers, for example as HTTP headers. The carrier may be null to
* facilitate calling this method with a lambda for the {@link TextMapSetter}, in which case that * facilitate calling this method with a lambda for the {@link TextMapSetter}, in which case that
* null will be passed to the {@link TextMapSetter} implementation. * null will be passed to the {@link TextMapSetter} implementation.
* *
@ -112,17 +112,17 @@ public interface TextMapPropagator {
<C> void inject(Context context, @Nullable C carrier, TextMapSetter<C> setter); <C> void inject(Context context, @Nullable C carrier, TextMapSetter<C> setter);
/** /**
* Extracts the value from upstream. For example, as http headers. * Extracts data from upstream. For example, from incoming http headers. The returned Context
* should contain the extracted data, if any, merged with the data from the passed-in Context.
* *
* <p>If the value could not be parsed, the underlying implementation will decide to set an object * <p>If the incoming information could not be parsed, implementations MUST return the original
* representing either an empty value, an invalid value, or a valid value. Implementation must not * Context, unaltered.
* set {@code null}.
* *
* @param context the {@code Context} used to store the extracted value. * @param context the {@code Context} used to store the extracted value.
* @param carrier holds propagation fields. For example, an outgoing message or http request. * @param carrier holds propagation fields. For example, an outgoing message or http request.
* @param getter invoked for each propagation key to get. * @param getter invoked for each propagation key to get data from the carrier.
* @param <C> carrier of propagation fields, such as an http request. * @param <C> the type of carrier of the propagation fields, such as an http request.
* @return the {@code Context} containing the extracted value. * @return the {@code Context} containing the extracted data.
*/ */
<C> Context extract(Context context, @Nullable C carrier, TextMapGetter<C> getter); <C> Context extract(Context context, @Nullable C carrier, TextMapGetter<C> getter);
} }