All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.grpc.override.ContextStorageOverride Maven / Gradle / Ivy

The newest version!
/*
 * Copyright The OpenTelemetry Authors
 * SPDX-License-Identifier: Apache-2.0
 */

package io.grpc.override;

import io.grpc.Context;
import io.opentelemetry.instrumentation.grpc.v1_6.internal.ContextStorageBridge;

/**
 * Override class for gRPC to pick up this class to replace the default {@link Context.Storage} with
 * an OpenTelemetry bridge.
 */
public final class ContextStorageOverride extends Context.Storage {

  private static final Context.Storage delegate = new ContextStorageBridge(true);

  @Override
  public Context doAttach(Context toAttach) {
    return delegate.doAttach(toAttach);
  }

  @Override
  public void detach(Context toDetach, Context toRestore) {
    delegate.detach(toDetach, toRestore);
  }

  @Override
  public Context current() {
    return delegate.current();
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy