Implicit Context Keyed Interface (context/ImplicitContextKeyed.java)

opentelemetry-java · context/src/main/java/io/opentelemetry/context/ImplicitContextKeyed.java · java · Apache-2.0
infra, lang:java, tag:context, tag:interface

Java interface allowing values to be stored in OpenTelemetry Context without exposing explicit ContextKey instances.

// Source: https://github.com/open-telemetry/opentelemetry-java | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
/*
 * Copyright The OpenTelemetry Authors
 * SPDX-License-Identifier: Apache-2.0
 */

package io.opentelemetry.context;

import com.google.errorprone.annotations.MustBeClosed;

/**
 * A value that can be stored inside {@link Context}. Types will generally use this interface to
 * allow storing themselves in {@link Context} without exposing a {@link ContextKey}.
 */
public interface ImplicitContextKeyed {

  /**
   * Adds this {@link ImplicitContextKeyed} value to the {@link Context#current() current context}
   * and makes the new {@link Context} the current context. {@l

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key