/** * Returns a mapping of fields in the current trace context, or empty if there are none. * * <p>Prefer {@link #set(TraceContext, String, String)} if you have a reference to a span. */ public static Map<String, String> getAll() { TraceContext context = currentTraceContext(); if (context == null) return Collections.emptyMap(); return getAll(context); }
/** * Sets the current value of the field with the specified key, or drops if not a configured * field. * * <p>Prefer {@link #set(TraceContext, String, String)} if you have a reference to a span. */ public static void set(String name, String value) { TraceContext context = currentTraceContext(); if (context != null) set(context, name, value); }
/** * Returns the value of the field with the specified key or null if not available. * * <p>Prefer {@link #get(TraceContext, String)} if you have a reference to a span. */ @Nullable public static String get(String name) { TraceContext context = currentTraceContext(); return context != null ? get(context, name) : null; }
/** * Sets the current value of the field with the specified key, or drops if not a configured * field. * * <p>Prefer {@link #set(TraceContext, String, String)} if you have a reference to a span. */ public static void set(String name, String value) { TraceContext context = currentTraceContext(); if (context != null) set(context, name, value); }
/** * Returns a mapping of fields in the current trace context, or empty if there are none. * * <p>Prefer {@link #set(TraceContext, String, String)} if you have a reference to a span. */ public static Map<String, String> getAll() { TraceContext context = currentTraceContext(); if (context == null) return Collections.emptyMap(); return getAll(context); }
/** * Returns the value of the field with the specified key or null if not available. * * <p>Prefer {@link #get(TraceContext, String)} if you have a reference to a span. */ @Nullable public static String get(String name) { TraceContext context = currentTraceContext(); return context != null ? get(context, name) : null; }