1 /* 2 * Copyright 2017, OpenCensus Authors 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package io.opencensus.trace.unsafe; 18 19 import io.grpc.Context; 20 import io.opencensus.trace.Span; 21 22 /*>>> 23 import org.checkerframework.checker.nullness.qual.Nullable; 24 */ 25 26 /** 27 * Util methods/functionality to interact with the {@link io.grpc.Context}. 28 * 29 * <p>Users must interact with the current Context via the public APIs in {@link 30 * io.opencensus.trace.Tracer} and avoid usages of the {@link #CONTEXT_SPAN_KEY} directly. 31 * 32 * @since 0.5 33 */ 34 public final class ContextUtils { 35 // No instance of this class. ContextUtils()36 private ContextUtils() {} 37 38 /** 39 * The {@link io.grpc.Context.Key} used to interact with {@link io.grpc.Context}. 40 * 41 * @since 0.5 42 */ 43 public static final Context.Key</*@Nullable*/ Span> CONTEXT_SPAN_KEY = 44 Context.key("opencensus-trace-span-key"); 45 } 46