all: move Channelz to io.grpc as InternalChannelz (#4797)

This is an API used to coordinate across packages and must live in
`io.grpc`.

Prepending `Internal` makes it easier to detect and hide this class
from public visibility when using certain build tools.

fixes #4796
This commit is contained in:
zpencer 2018-09-04 16:52:01 -07:00 committed by GitHub
parent f8274c4e7c
commit 4d366ce978
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
61 changed files with 265 additions and 215 deletions

View File

@ -22,12 +22,12 @@ import com.google.protobuf.Any;
import io.grpc.Attributes; import io.grpc.Attributes;
import io.grpc.CallCredentials; import io.grpc.CallCredentials;
import io.grpc.Grpc; import io.grpc.Grpc;
import io.grpc.InternalChannelz.OtherSecurity;
import io.grpc.InternalChannelz.Security;
import io.grpc.SecurityLevel; import io.grpc.SecurityLevel;
import io.grpc.Status; import io.grpc.Status;
import io.grpc.alts.internal.RpcProtocolVersionsUtil.RpcVersionsCheckResult; import io.grpc.alts.internal.RpcProtocolVersionsUtil.RpcVersionsCheckResult;
import io.grpc.alts.internal.TsiHandshakeHandler.TsiHandshakeCompletionEvent; import io.grpc.alts.internal.TsiHandshakeHandler.TsiHandshakeCompletionEvent;
import io.grpc.internal.Channelz.OtherSecurity;
import io.grpc.internal.Channelz.Security;
import io.grpc.netty.GrpcHttp2ConnectionHandler; import io.grpc.netty.GrpcHttp2ConnectionHandler;
import io.grpc.netty.ProtocolNegotiator; import io.grpc.netty.ProtocolNegotiator;
import io.grpc.netty.ProtocolNegotiators.AbstractBufferingHandler; import io.grpc.netty.ProtocolNegotiators.AbstractBufferingHandler;

View File

@ -26,11 +26,11 @@ import static org.junit.Assert.assertTrue;
import io.grpc.Attributes; import io.grpc.Attributes;
import io.grpc.CallCredentials; import io.grpc.CallCredentials;
import io.grpc.Grpc; import io.grpc.Grpc;
import io.grpc.InternalChannelz;
import io.grpc.SecurityLevel; import io.grpc.SecurityLevel;
import io.grpc.alts.internal.Handshaker.HandshakerResult; import io.grpc.alts.internal.Handshaker.HandshakerResult;
import io.grpc.alts.internal.TsiFrameProtector.Consumer; import io.grpc.alts.internal.TsiFrameProtector.Consumer;
import io.grpc.alts.internal.TsiPeer.Property; import io.grpc.alts.internal.TsiPeer.Property;
import io.grpc.internal.Channelz;
import io.grpc.netty.GrpcHttp2ConnectionHandler; import io.grpc.netty.GrpcHttp2ConnectionHandler;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufAllocator; import io.netty.buffer.ByteBufAllocator;
@ -405,7 +405,7 @@ public class AltsProtocolNegotiatorTest {
@Override @Override
public void handleProtocolNegotiationCompleted( public void handleProtocolNegotiationCompleted(
Attributes attrs, Channelz.Security securityInfo) { Attributes attrs, InternalChannelz.Security securityInfo) {
// If we are added to the pipeline, we need to remove ourselves. The HTTP2 handler // If we are added to the pipeline, we need to remove ourselves. The HTTP2 handler
channel.pipeline().remove(this); channel.pipeline().remove(this);
this.attrs = attrs; this.attrs = attrs;

View File

@ -17,8 +17,11 @@
package io.grpc.internal; package io.grpc.internal;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
import io.grpc.internal.Channelz.ServerStats; import io.grpc.Instrumented;
import io.grpc.internal.Channelz.SocketStats; import io.grpc.InternalChannelz;
import io.grpc.InternalChannelz.ServerStats;
import io.grpc.InternalChannelz.SocketStats;
import io.grpc.LogId;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.BenchmarkMode;
@ -38,7 +41,7 @@ public class ChannelzBenchmark {
@Param({"10", "100", "1000", "10000"}) @Param({"10", "100", "1000", "10000"})
public int preexisting; public int preexisting;
public Channelz channelz = new Channelz(); public InternalChannelz channelz = new InternalChannelz();
public Instrumented<ServerStats> serverToRemove; public Instrumented<ServerStats> serverToRemove;

View File

@ -14,14 +14,17 @@
* limitations under the License. * limitations under the License.
*/ */
package io.grpc.internal; package io.grpc;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
/** /**
* An interface for types that <b>may</b> support instrumentation. If the actual type does not * An internal class. Do not use.
*
* <p>An interface for types that <b>may</b> support instrumentation. If the actual type does not
* support instrumentation, then the future will return a {@code null}. * support instrumentation, then the future will return a {@code null}.
*/ */
@Internal
public interface Instrumented<T> extends WithLogId { public interface Instrumented<T> extends WithLogId {
/** /**

View File

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package io.grpc.internal; package io.grpc;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkState; import static com.google.common.base.Preconditions.checkState;
@ -22,7 +22,6 @@ import static com.google.common.base.Preconditions.checkState;
import com.google.common.annotations.VisibleForTesting; import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.MoreObjects; import com.google.common.base.MoreObjects;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import io.grpc.ConnectivityState;
import java.net.SocketAddress; import java.net.SocketAddress;
import java.security.cert.Certificate; import java.security.cert.Certificate;
import java.util.ArrayList; import java.util.ArrayList;
@ -42,9 +41,13 @@ import javax.annotation.concurrent.Immutable;
import javax.net.ssl.SSLPeerUnverifiedException; import javax.net.ssl.SSLPeerUnverifiedException;
import javax.net.ssl.SSLSession; import javax.net.ssl.SSLSession;
public final class Channelz { /**
private static final Logger log = Logger.getLogger(Channelz.class.getName()); * This is an internal API. Do NOT use.
private static final Channelz INSTANCE = new Channelz(); */
@Internal
public final class InternalChannelz {
private static final Logger log = Logger.getLogger(InternalChannelz.class.getName());
private static final InternalChannelz INSTANCE = new InternalChannelz();
private final ConcurrentNavigableMap<Long, Instrumented<ServerStats>> servers private final ConcurrentNavigableMap<Long, Instrumented<ServerStats>> servers
= new ConcurrentSkipListMap<Long, Instrumented<ServerStats>>(); = new ConcurrentSkipListMap<Long, Instrumented<ServerStats>>();
@ -65,10 +68,10 @@ public final class Channelz {
} }
@VisibleForTesting @VisibleForTesting
public Channelz() { public InternalChannelz() {
} }
public static Channelz instance() { public static InternalChannelz instance() {
return INSTANCE; return INSTANCE;
} }

View File

@ -14,13 +14,16 @@
* limitations under the License. * limitations under the License.
*/ */
package io.grpc.internal; package io.grpc;
import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicLong;
/** /**
* An object that has an ID that is unique within the JVM, primarily for debug logging. * An internal class. Do not use.
*
*<p>An object that has an ID that is unique within the JVM, primarily for debug logging.
*/ */
@Internal
public final class LogId { public final class LogId {
private static final AtomicLong idAlloc = new AtomicLong(); private static final AtomicLong idAlloc = new AtomicLong();

View File

@ -14,11 +14,14 @@
* limitations under the License. * limitations under the License.
*/ */
package io.grpc.internal; package io.grpc;
/** /**
* A loggable ID, unique for the duration of the program. * An internal class. Do not use.
*
* <p>A loggable ID, unique for the duration of the program.
*/ */
@Internal
public interface WithLogId { public interface WithLogId {
/** /**
* Returns an ID that is primarily used in debug logs. It usually contains the class name and a * Returns an ID that is primarily used in debug logs. It usually contains the class name and a

View File

@ -19,9 +19,9 @@ package io.grpc.inprocess;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.base.MoreObjects; import com.google.common.base.MoreObjects;
import io.grpc.Instrumented;
import io.grpc.InternalChannelz.SocketStats;
import io.grpc.ServerStreamTracer; import io.grpc.ServerStreamTracer;
import io.grpc.internal.Channelz.SocketStats;
import io.grpc.internal.Instrumented;
import io.grpc.internal.InternalServer; import io.grpc.internal.InternalServer;
import io.grpc.internal.ObjectPool; import io.grpc.internal.ObjectPool;
import io.grpc.internal.ServerListener; import io.grpc.internal.ServerListener;

View File

@ -31,17 +31,17 @@ import io.grpc.Deadline;
import io.grpc.Decompressor; import io.grpc.Decompressor;
import io.grpc.DecompressorRegistry; import io.grpc.DecompressorRegistry;
import io.grpc.Grpc; import io.grpc.Grpc;
import io.grpc.InternalChannelz.SocketStats;
import io.grpc.LogId;
import io.grpc.Metadata; import io.grpc.Metadata;
import io.grpc.MethodDescriptor; import io.grpc.MethodDescriptor;
import io.grpc.SecurityLevel; import io.grpc.SecurityLevel;
import io.grpc.ServerStreamTracer; import io.grpc.ServerStreamTracer;
import io.grpc.Status; import io.grpc.Status;
import io.grpc.internal.Channelz.SocketStats;
import io.grpc.internal.ClientStream; import io.grpc.internal.ClientStream;
import io.grpc.internal.ClientStreamListener; import io.grpc.internal.ClientStreamListener;
import io.grpc.internal.ConnectionClientTransport; import io.grpc.internal.ConnectionClientTransport;
import io.grpc.internal.GrpcUtil; import io.grpc.internal.GrpcUtil;
import io.grpc.internal.LogId;
import io.grpc.internal.ManagedClientTransport; import io.grpc.internal.ManagedClientTransport;
import io.grpc.internal.NoopClientStream; import io.grpc.internal.NoopClientStream;
import io.grpc.internal.ObjectPool; import io.grpc.internal.ObjectPool;

View File

@ -27,6 +27,7 @@ import io.grpc.ClientInterceptor;
import io.grpc.CompressorRegistry; import io.grpc.CompressorRegistry;
import io.grpc.DecompressorRegistry; import io.grpc.DecompressorRegistry;
import io.grpc.EquivalentAddressGroup; import io.grpc.EquivalentAddressGroup;
import io.grpc.InternalChannelz;
import io.grpc.LoadBalancer; import io.grpc.LoadBalancer;
import io.grpc.ManagedChannel; import io.grpc.ManagedChannel;
import io.grpc.ManagedChannelBuilder; import io.grpc.ManagedChannelBuilder;
@ -134,7 +135,7 @@ public abstract class AbstractManagedChannelImplBuilder
// TODO(zdapeng): delete me // TODO(zdapeng): delete me
boolean temporarilyDisableRetry; boolean temporarilyDisableRetry;
Channelz channelz = Channelz.instance(); InternalChannelz channelz = InternalChannelz.instance();
int maxTraceEvents; int maxTraceEvents;
protected TransportTracer.Factory transportTracerFactory = TransportTracer.getDefaultFactory(); protected TransportTracer.Factory transportTracerFactory = TransportTracer.getDefaultFactory();

View File

@ -28,6 +28,7 @@ import io.grpc.Context;
import io.grpc.DecompressorRegistry; import io.grpc.DecompressorRegistry;
import io.grpc.HandlerRegistry; import io.grpc.HandlerRegistry;
import io.grpc.Internal; import io.grpc.Internal;
import io.grpc.InternalChannelz;
import io.grpc.InternalNotifyOnServerBuild; import io.grpc.InternalNotifyOnServerBuild;
import io.grpc.Server; import io.grpc.Server;
import io.grpc.ServerBuilder; import io.grpc.ServerBuilder;
@ -113,7 +114,7 @@ public abstract class AbstractServerImplBuilder<T extends AbstractServerImplBuil
protected BinaryLog binlog; protected BinaryLog binlog;
protected TransportTracer.Factory transportTracerFactory = TransportTracer.getDefaultFactory(); protected TransportTracer.Factory transportTracerFactory = TransportTracer.getDefaultFactory();
protected Channelz channelz = Channelz.instance(); protected InternalChannelz channelz = InternalChannelz.instance();
protected CallTracer.Factory callTracerFactory = CallTracer.getDefaultFactory(); protected CallTracer.Factory callTracerFactory = CallTracer.getDefaultFactory();
@Override @Override

View File

@ -17,8 +17,9 @@
package io.grpc.internal; package io.grpc.internal;
import com.google.common.annotations.VisibleForTesting; import com.google.common.annotations.VisibleForTesting;
import io.grpc.Instrumented;
import io.grpc.InternalChannelz.ChannelStats;
import io.grpc.LoadBalancer; import io.grpc.LoadBalancer;
import io.grpc.internal.Channelz.ChannelStats;
import javax.annotation.Nullable; import javax.annotation.Nullable;
/** /**

View File

@ -18,8 +18,8 @@ package io.grpc.internal;
import static io.grpc.internal.TimeProvider.SYSTEM_TIME_PROVIDER; import static io.grpc.internal.TimeProvider.SYSTEM_TIME_PROVIDER;
import io.grpc.internal.Channelz.ChannelStats; import io.grpc.InternalChannelz.ChannelStats;
import io.grpc.internal.Channelz.ServerStats; import io.grpc.InternalChannelz.ServerStats;
/** /**
* A collection of call stats for channelz. * A collection of call stats for channelz.

View File

@ -19,9 +19,9 @@ package io.grpc.internal;
import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import io.grpc.internal.Channelz.ChannelStats; import io.grpc.InternalChannelz.ChannelStats;
import io.grpc.internal.Channelz.ChannelTrace; import io.grpc.InternalChannelz.ChannelTrace;
import io.grpc.internal.Channelz.ChannelTrace.Event; import io.grpc.InternalChannelz.ChannelTrace.Event;
import java.util.ArrayDeque; import java.util.ArrayDeque;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;

View File

@ -17,9 +17,10 @@
package io.grpc.internal; package io.grpc.internal;
import io.grpc.CallOptions; import io.grpc.CallOptions;
import io.grpc.Instrumented;
import io.grpc.InternalChannelz.SocketStats;
import io.grpc.Metadata; import io.grpc.Metadata;
import io.grpc.MethodDescriptor; import io.grpc.MethodDescriptor;
import io.grpc.internal.Channelz.SocketStats;
import java.util.concurrent.Executor; import java.util.concurrent.Executor;
import javax.annotation.concurrent.ThreadSafe; import javax.annotation.concurrent.ThreadSafe;

View File

@ -21,13 +21,14 @@ import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.SettableFuture; import com.google.common.util.concurrent.SettableFuture;
import io.grpc.CallOptions; import io.grpc.CallOptions;
import io.grpc.Context; import io.grpc.Context;
import io.grpc.InternalChannelz.SocketStats;
import io.grpc.LoadBalancer.PickResult; import io.grpc.LoadBalancer.PickResult;
import io.grpc.LoadBalancer.PickSubchannelArgs; import io.grpc.LoadBalancer.PickSubchannelArgs;
import io.grpc.LoadBalancer.SubchannelPicker; import io.grpc.LoadBalancer.SubchannelPicker;
import io.grpc.LogId;
import io.grpc.Metadata; import io.grpc.Metadata;
import io.grpc.MethodDescriptor; import io.grpc.MethodDescriptor;
import io.grpc.Status; import io.grpc.Status;
import io.grpc.internal.Channelz.SocketStats;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;

View File

@ -21,10 +21,11 @@ import com.google.common.base.Preconditions;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.SettableFuture; import com.google.common.util.concurrent.SettableFuture;
import io.grpc.CallOptions; import io.grpc.CallOptions;
import io.grpc.InternalChannelz.SocketStats;
import io.grpc.LogId;
import io.grpc.Metadata; import io.grpc.Metadata;
import io.grpc.MethodDescriptor; import io.grpc.MethodDescriptor;
import io.grpc.Status; import io.grpc.Status;
import io.grpc.internal.Channelz.SocketStats;
import io.grpc.internal.ClientStreamListener.RpcProgress; import io.grpc.internal.ClientStreamListener.RpcProgress;
import java.util.concurrent.Executor; import java.util.concurrent.Executor;

View File

@ -20,10 +20,11 @@ import com.google.common.base.MoreObjects;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
import io.grpc.Attributes; import io.grpc.Attributes;
import io.grpc.CallOptions; import io.grpc.CallOptions;
import io.grpc.InternalChannelz.SocketStats;
import io.grpc.LogId;
import io.grpc.Metadata; import io.grpc.Metadata;
import io.grpc.MethodDescriptor; import io.grpc.MethodDescriptor;
import io.grpc.Status; import io.grpc.Status;
import io.grpc.internal.Channelz.SocketStats;
import java.util.concurrent.Executor; import java.util.concurrent.Executor;
abstract class ForwardingConnectionClientTransport implements ConnectionClientTransport { abstract class ForwardingConnectionClientTransport implements ConnectionClientTransport {

View File

@ -29,14 +29,15 @@ import com.google.common.util.concurrent.MoreExecutors;
import com.google.common.util.concurrent.ThreadFactoryBuilder; import com.google.common.util.concurrent.ThreadFactoryBuilder;
import io.grpc.CallOptions; import io.grpc.CallOptions;
import io.grpc.ClientStreamTracer; import io.grpc.ClientStreamTracer;
import io.grpc.InternalChannelz.SocketStats;
import io.grpc.InternalMetadata; import io.grpc.InternalMetadata;
import io.grpc.InternalMetadata.TrustedAsciiMarshaller; import io.grpc.InternalMetadata.TrustedAsciiMarshaller;
import io.grpc.LoadBalancer.PickResult; import io.grpc.LoadBalancer.PickResult;
import io.grpc.LoadBalancer.Subchannel; import io.grpc.LoadBalancer.Subchannel;
import io.grpc.LogId;
import io.grpc.Metadata; import io.grpc.Metadata;
import io.grpc.MethodDescriptor; import io.grpc.MethodDescriptor;
import io.grpc.Status; import io.grpc.Status;
import io.grpc.internal.Channelz.SocketStats;
import io.grpc.internal.ClientStreamListener.RpcProgress; import io.grpc.internal.ClientStreamListener.RpcProgress;
import io.grpc.internal.SharedResourceHolder.Resource; import io.grpc.internal.SharedResourceHolder.Resource;
import io.grpc.internal.StreamListener.MessageProducer; import io.grpc.internal.StreamListener.MessageProducer;

View File

@ -16,7 +16,8 @@
package io.grpc.internal; package io.grpc.internal;
import io.grpc.internal.Channelz.SocketStats; import io.grpc.Instrumented;
import io.grpc.InternalChannelz.SocketStats;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
import javax.annotation.concurrent.ThreadSafe; import javax.annotation.concurrent.ThreadSafe;

View File

@ -35,11 +35,15 @@ import io.grpc.CallOptions;
import io.grpc.ConnectivityState; import io.grpc.ConnectivityState;
import io.grpc.ConnectivityStateInfo; import io.grpc.ConnectivityStateInfo;
import io.grpc.EquivalentAddressGroup; import io.grpc.EquivalentAddressGroup;
import io.grpc.Instrumented;
import io.grpc.InternalChannelz;
import io.grpc.InternalChannelz.ChannelStats;
import io.grpc.InternalChannelz.ChannelTrace;
import io.grpc.LogId;
import io.grpc.Metadata; import io.grpc.Metadata;
import io.grpc.MethodDescriptor; import io.grpc.MethodDescriptor;
import io.grpc.Status; import io.grpc.Status;
import io.grpc.internal.Channelz.ChannelStats; import io.grpc.WithLogId;
import io.grpc.internal.Channelz.ChannelTrace;
import java.net.SocketAddress; import java.net.SocketAddress;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
@ -69,7 +73,7 @@ final class InternalSubchannel implements Instrumented<ChannelStats> {
private final Callback callback; private final Callback callback;
private final ClientTransportFactory transportFactory; private final ClientTransportFactory transportFactory;
private final ScheduledExecutorService scheduledExecutor; private final ScheduledExecutorService scheduledExecutor;
private final Channelz channelz; private final InternalChannelz channelz;
private final CallTracer callsTracer; private final CallTracer callsTracer;
@CheckForNull @CheckForNull
private final ChannelTracer channelTracer; private final ChannelTracer channelTracer;
@ -162,7 +166,7 @@ final class InternalSubchannel implements Instrumented<ChannelStats> {
BackoffPolicy.Provider backoffPolicyProvider, BackoffPolicy.Provider backoffPolicyProvider,
ClientTransportFactory transportFactory, ScheduledExecutorService scheduledExecutor, ClientTransportFactory transportFactory, ScheduledExecutorService scheduledExecutor,
Supplier<Stopwatch> stopwatchSupplier, ChannelExecutor channelExecutor, Callback callback, Supplier<Stopwatch> stopwatchSupplier, ChannelExecutor channelExecutor, Callback callback,
Channelz channelz, CallTracer callsTracer, @Nullable ChannelTracer channelTracer, InternalChannelz channelz, CallTracer callsTracer, @Nullable ChannelTracer channelTracer,
TimeProvider timeProvider) { TimeProvider timeProvider) {
Preconditions.checkNotNull(addressGroups, "addressGroups"); Preconditions.checkNotNull(addressGroups, "addressGroups");
Preconditions.checkArgument(!addressGroups.isEmpty(), "addressGroups is empty"); Preconditions.checkArgument(!addressGroups.isEmpty(), "addressGroups is empty");

View File

@ -44,17 +44,21 @@ import io.grpc.ConnectivityStateInfo;
import io.grpc.Context; import io.grpc.Context;
import io.grpc.DecompressorRegistry; import io.grpc.DecompressorRegistry;
import io.grpc.EquivalentAddressGroup; import io.grpc.EquivalentAddressGroup;
import io.grpc.Instrumented;
import io.grpc.InternalChannelz;
import io.grpc.InternalChannelz.ChannelStats;
import io.grpc.InternalChannelz.ChannelTrace;
import io.grpc.LoadBalancer; import io.grpc.LoadBalancer;
import io.grpc.LoadBalancer.PickResult; import io.grpc.LoadBalancer.PickResult;
import io.grpc.LoadBalancer.PickSubchannelArgs; import io.grpc.LoadBalancer.PickSubchannelArgs;
import io.grpc.LoadBalancer.SubchannelPicker; import io.grpc.LoadBalancer.SubchannelPicker;
import io.grpc.LogId;
import io.grpc.ManagedChannel; import io.grpc.ManagedChannel;
import io.grpc.Metadata; import io.grpc.Metadata;
import io.grpc.MethodDescriptor; import io.grpc.MethodDescriptor;
import io.grpc.NameResolver; import io.grpc.NameResolver;
import io.grpc.Status; import io.grpc.Status;
import io.grpc.internal.Channelz.ChannelStats; import io.grpc.WithLogId;
import io.grpc.internal.Channelz.ChannelTrace;
import io.grpc.internal.ClientCallImpl.ClientTransportProvider; import io.grpc.internal.ClientCallImpl.ClientTransportProvider;
import io.grpc.internal.RetriableStream.ChannelBufferMeter; import io.grpc.internal.RetriableStream.ChannelBufferMeter;
import io.grpc.internal.RetriableStream.Throttle; import io.grpc.internal.RetriableStream.Throttle;
@ -211,7 +215,7 @@ final class ManagedChannelImpl extends ManagedChannel implements Instrumented<Ch
private final CallTracer channelCallTracer; private final CallTracer channelCallTracer;
@CheckForNull @CheckForNull
private final ChannelTracer channelTracer; private final ChannelTracer channelTracer;
private final Channelz channelz; private final InternalChannelz channelz;
@CheckForNull @CheckForNull
private Boolean haveBackends; // a flag for doing channel tracing when flipped private Boolean haveBackends; // a flag for doing channel tracing when flipped
@Nullable @Nullable
@ -297,7 +301,7 @@ final class ManagedChannelImpl extends ManagedChannel implements Instrumented<Ch
channelExecutor.executeLater(new Runnable() { channelExecutor.executeLater(new Runnable() {
@Override @Override
public void run() { public void run() {
ChannelStats.Builder builder = new Channelz.ChannelStats.Builder(); ChannelStats.Builder builder = new InternalChannelz.ChannelStats.Builder();
channelCallTracer.updateBuilder(builder); channelCallTracer.updateBuilder(builder);
if (channelTracer != null) { if (channelTracer != null) {
channelTracer.updateBuilder(builder); channelTracer.updateBuilder(builder);

View File

@ -30,17 +30,21 @@ import io.grpc.ConnectivityState;
import io.grpc.ConnectivityStateInfo; import io.grpc.ConnectivityStateInfo;
import io.grpc.Context; import io.grpc.Context;
import io.grpc.EquivalentAddressGroup; import io.grpc.EquivalentAddressGroup;
import io.grpc.Instrumented;
import io.grpc.InternalChannelz;
import io.grpc.InternalChannelz.ChannelStats;
import io.grpc.InternalChannelz.ChannelTrace;
import io.grpc.LoadBalancer; import io.grpc.LoadBalancer;
import io.grpc.LoadBalancer.PickResult; import io.grpc.LoadBalancer.PickResult;
import io.grpc.LoadBalancer.PickSubchannelArgs; import io.grpc.LoadBalancer.PickSubchannelArgs;
import io.grpc.LoadBalancer.Subchannel; import io.grpc.LoadBalancer.Subchannel;
import io.grpc.LoadBalancer.SubchannelPicker; import io.grpc.LoadBalancer.SubchannelPicker;
import io.grpc.LogId;
import io.grpc.ManagedChannel; import io.grpc.ManagedChannel;
import io.grpc.Metadata; import io.grpc.Metadata;
import io.grpc.MethodDescriptor; import io.grpc.MethodDescriptor;
import io.grpc.Status; import io.grpc.Status;
import io.grpc.internal.Channelz.ChannelStats; import io.grpc.WithLogId;
import io.grpc.internal.Channelz.ChannelTrace;
import io.grpc.internal.ClientCallImpl.ClientTransportProvider; import io.grpc.internal.ClientCallImpl.ClientTransportProvider;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@ -69,7 +73,7 @@ final class OobChannel extends ManagedChannel implements Instrumented<ChannelSta
private final LogId logId = LogId.allocate(getClass().getName()); private final LogId logId = LogId.allocate(getClass().getName());
private final String authority; private final String authority;
private final DelayedClientTransport delayedTransport; private final DelayedClientTransport delayedTransport;
private final Channelz channelz; private final InternalChannelz channelz;
private final ObjectPool<? extends Executor> executorPool; private final ObjectPool<? extends Executor> executorPool;
private final Executor executor; private final Executor executor;
private final ScheduledExecutorService deadlineCancellationExecutor; private final ScheduledExecutorService deadlineCancellationExecutor;
@ -99,7 +103,7 @@ final class OobChannel extends ManagedChannel implements Instrumented<ChannelSta
OobChannel( OobChannel(
String authority, ObjectPool<? extends Executor> executorPool, String authority, ObjectPool<? extends Executor> executorPool,
ScheduledExecutorService deadlineCancellationExecutor, ChannelExecutor channelExecutor, ScheduledExecutorService deadlineCancellationExecutor, ChannelExecutor channelExecutor,
CallTracer callsTracer, @Nullable ChannelTracer channelTracer, Channelz channelz, CallTracer callsTracer, @Nullable ChannelTracer channelTracer, InternalChannelz channelz,
TimeProvider timeProvider) { TimeProvider timeProvider) {
this.authority = checkNotNull(authority, "authority"); this.authority = checkNotNull(authority, "authority");
this.executorPool = checkNotNull(executorPool, "executorPool"); this.executorPool = checkNotNull(executorPool, "executorPool");

View File

@ -36,7 +36,11 @@ import io.grpc.Context;
import io.grpc.Decompressor; import io.grpc.Decompressor;
import io.grpc.DecompressorRegistry; import io.grpc.DecompressorRegistry;
import io.grpc.HandlerRegistry; import io.grpc.HandlerRegistry;
import io.grpc.Instrumented;
import io.grpc.InternalChannelz;
import io.grpc.InternalChannelz.ServerStats;
import io.grpc.InternalServerInterceptors; import io.grpc.InternalServerInterceptors;
import io.grpc.LogId;
import io.grpc.Metadata; import io.grpc.Metadata;
import io.grpc.ServerCall; import io.grpc.ServerCall;
import io.grpc.ServerCallHandler; import io.grpc.ServerCallHandler;
@ -45,7 +49,6 @@ import io.grpc.ServerMethodDefinition;
import io.grpc.ServerServiceDefinition; import io.grpc.ServerServiceDefinition;
import io.grpc.ServerTransportFilter; import io.grpc.ServerTransportFilter;
import io.grpc.Status; import io.grpc.Status;
import io.grpc.internal.Channelz.ServerStats;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.ArrayList; import java.util.ArrayList;
@ -111,7 +114,7 @@ public final class ServerImpl extends io.grpc.Server implements Instrumented<Ser
private final CompressorRegistry compressorRegistry; private final CompressorRegistry compressorRegistry;
private final BinaryLog binlog; private final BinaryLog binlog;
private final Channelz channelz; private final InternalChannelz channelz;
private final CallTracer serverCallTracer; private final CallTracer serverCallTracer;
/** /**

View File

@ -16,8 +16,9 @@
package io.grpc.internal; package io.grpc.internal;
import io.grpc.Instrumented;
import io.grpc.InternalChannelz.SocketStats;
import io.grpc.Status; import io.grpc.Status;
import io.grpc.internal.Channelz.SocketStats;
import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledExecutorService;
/** An inbound connection. */ /** An inbound connection. */

View File

@ -20,7 +20,7 @@ import static io.grpc.internal.TimeProvider.SYSTEM_TIME_PROVIDER;
import com.google.common.annotations.VisibleForTesting; import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import io.grpc.internal.Channelz.TransportStats; import io.grpc.InternalChannelz.TransportStats;
/** /**
* A class for gathering statistics about a transport. This is an experimental feature. * A class for gathering statistics about a transport. This is an experimental feature.

View File

@ -14,10 +14,10 @@
* limitations under the License. * limitations under the License.
*/ */
package io.grpc.internal; package io.grpc;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import static io.grpc.internal.Channelz.id; import static io.grpc.InternalChannelz.id;
import static junit.framework.TestCase.assertTrue; import static junit.framework.TestCase.assertTrue;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
@ -28,13 +28,13 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
import io.grpc.internal.Channelz.ChannelStats; import io.grpc.InternalChannelz.ChannelStats;
import io.grpc.internal.Channelz.RootChannelList; import io.grpc.InternalChannelz.RootChannelList;
import io.grpc.internal.Channelz.ServerList; import io.grpc.InternalChannelz.ServerList;
import io.grpc.internal.Channelz.ServerSocketsList; import io.grpc.InternalChannelz.ServerSocketsList;
import io.grpc.internal.Channelz.ServerStats; import io.grpc.InternalChannelz.ServerStats;
import io.grpc.internal.Channelz.SocketStats; import io.grpc.InternalChannelz.SocketStats;
import io.grpc.internal.Channelz.Tls; import io.grpc.InternalChannelz.Tls;
import java.security.cert.Certificate; import java.security.cert.Certificate;
import javax.net.ssl.SSLSession; import javax.net.ssl.SSLSession;
import org.junit.Test; import org.junit.Test;
@ -42,9 +42,9 @@ import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@RunWith(JUnit4.class) @RunWith(JUnit4.class)
public final class ChannelzTest { public final class InternalChannelzTest {
private final Channelz channelz = new Channelz(); private final InternalChannelz channelz = new InternalChannelz();
@Test @Test
public void getRootChannels_empty() { public void getRootChannels_empty() {

View File

@ -18,9 +18,9 @@ package io.grpc.internal;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import io.grpc.internal.Channelz.ChannelStats; import io.grpc.InternalChannelz.ChannelStats;
import io.grpc.internal.Channelz.ChannelTrace.Event; import io.grpc.InternalChannelz.ChannelTrace.Event;
import io.grpc.internal.Channelz.ChannelTrace.Event.Severity; import io.grpc.InternalChannelz.ChannelTrace.Event.Severity;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException; import org.junit.rules.ExpectedException;

View File

@ -41,7 +41,9 @@ import com.google.common.collect.Iterables;
import io.grpc.Attributes; import io.grpc.Attributes;
import io.grpc.ConnectivityStateInfo; import io.grpc.ConnectivityStateInfo;
import io.grpc.EquivalentAddressGroup; import io.grpc.EquivalentAddressGroup;
import io.grpc.InternalChannelz;
import io.grpc.Status; import io.grpc.Status;
import io.grpc.WithLogId;
import io.grpc.internal.InternalSubchannel.CallTracingTransport; import io.grpc.internal.InternalSubchannel.CallTracingTransport;
import io.grpc.internal.InternalSubchannel.Index; import io.grpc.internal.InternalSubchannel.Index;
import io.grpc.internal.TestUtils.MockClientTransportInfo; import io.grpc.internal.TestUtils.MockClientTransportInfo;
@ -79,7 +81,7 @@ public class InternalSubchannelTest {
private final FakeClock fakeExecutor = new FakeClock(); private final FakeClock fakeExecutor = new FakeClock();
private final ChannelExecutor channelExecutor = new ChannelExecutor(); private final ChannelExecutor channelExecutor = new ChannelExecutor();
private final Channelz channelz = new Channelz(); private final InternalChannelz channelz = new InternalChannelz();
@Mock private BackoffPolicy mockBackoffPolicy1; @Mock private BackoffPolicy mockBackoffPolicy1;
@Mock private BackoffPolicy mockBackoffPolicy2; @Mock private BackoffPolicy mockBackoffPolicy2;

View File

@ -68,7 +68,11 @@ import io.grpc.ConnectivityState;
import io.grpc.ConnectivityStateInfo; import io.grpc.ConnectivityStateInfo;
import io.grpc.Context; import io.grpc.Context;
import io.grpc.EquivalentAddressGroup; import io.grpc.EquivalentAddressGroup;
import io.grpc.Instrumented;
import io.grpc.IntegerMarshaller; import io.grpc.IntegerMarshaller;
import io.grpc.InternalChannelz;
import io.grpc.InternalChannelz.ChannelStats;
import io.grpc.InternalChannelz.ChannelTrace;
import io.grpc.LoadBalancer; import io.grpc.LoadBalancer;
import io.grpc.LoadBalancer.Helper; import io.grpc.LoadBalancer.Helper;
import io.grpc.LoadBalancer.PickResult; import io.grpc.LoadBalancer.PickResult;
@ -84,8 +88,6 @@ import io.grpc.SecurityLevel;
import io.grpc.ServerMethodDefinition; import io.grpc.ServerMethodDefinition;
import io.grpc.Status; import io.grpc.Status;
import io.grpc.StringMarshaller; import io.grpc.StringMarshaller;
import io.grpc.internal.Channelz.ChannelStats;
import io.grpc.internal.Channelz.ChannelTrace;
import io.grpc.internal.ClientTransportFactory.ClientTransportOptions; import io.grpc.internal.ClientTransportFactory.ClientTransportOptions;
import io.grpc.internal.TestUtils.MockClientTransportInfo; import io.grpc.internal.TestUtils.MockClientTransportInfo;
import io.grpc.stub.ClientCalls; import io.grpc.stub.ClientCalls;
@ -165,7 +167,7 @@ public class ManagedChannelImplTest {
} }
}; };
private final Channelz channelz = new Channelz(); private final InternalChannelz channelz = new InternalChannelz();
@Rule public final ExpectedException thrown = ExpectedException.none(); @Rule public final ExpectedException thrown = ExpectedException.none();

View File

@ -35,9 +35,9 @@ import com.google.common.base.Charsets;
import com.google.common.io.ByteStreams; import com.google.common.io.ByteStreams;
import com.google.common.primitives.Bytes; import com.google.common.primitives.Bytes;
import io.grpc.Codec; import io.grpc.Codec;
import io.grpc.InternalChannelz.TransportStats;
import io.grpc.StatusRuntimeException; import io.grpc.StatusRuntimeException;
import io.grpc.StreamTracer; import io.grpc.StreamTracer;
import io.grpc.internal.Channelz.TransportStats;
import io.grpc.internal.MessageDeframer.Listener; import io.grpc.internal.MessageDeframer.Listener;
import io.grpc.internal.MessageDeframer.SizeEnforcingInputStream; import io.grpc.internal.MessageDeframer.SizeEnforcingInputStream;
import io.grpc.internal.testing.TestStreamTracer.TestBaseStreamTracer; import io.grpc.internal.testing.TestStreamTracer.TestBaseStreamTracer;

View File

@ -34,14 +34,14 @@ import com.google.common.io.CharStreams;
import io.grpc.CompressorRegistry; import io.grpc.CompressorRegistry;
import io.grpc.Context; import io.grpc.Context;
import io.grpc.DecompressorRegistry; import io.grpc.DecompressorRegistry;
import io.grpc.InternalChannelz.ServerStats;
import io.grpc.InternalChannelz.ServerStats.Builder;
import io.grpc.Metadata; import io.grpc.Metadata;
import io.grpc.MethodDescriptor; import io.grpc.MethodDescriptor;
import io.grpc.MethodDescriptor.Marshaller; import io.grpc.MethodDescriptor.Marshaller;
import io.grpc.MethodDescriptor.MethodType; import io.grpc.MethodDescriptor.MethodType;
import io.grpc.ServerCall; import io.grpc.ServerCall;
import io.grpc.Status; import io.grpc.Status;
import io.grpc.internal.Channelz.ServerStats;
import io.grpc.internal.Channelz.ServerStats.Builder;
import io.grpc.internal.ServerCallImpl.ServerStreamListenerImpl; import io.grpc.internal.ServerCallImpl.ServerStreamListenerImpl;
import io.grpc.internal.testing.SingleMessageProducer; import io.grpc.internal.testing.SingleMessageProducer;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;

View File

@ -17,7 +17,7 @@
package io.grpc.internal; package io.grpc.internal;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import static io.grpc.internal.Channelz.id; import static io.grpc.InternalChannelz.id;
import static io.grpc.internal.GrpcUtil.MESSAGE_ENCODING_KEY; import static io.grpc.internal.GrpcUtil.MESSAGE_ENCODING_KEY;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
@ -54,8 +54,13 @@ import io.grpc.Compressor;
import io.grpc.Context; import io.grpc.Context;
import io.grpc.Grpc; import io.grpc.Grpc;
import io.grpc.HandlerRegistry; import io.grpc.HandlerRegistry;
import io.grpc.Instrumented;
import io.grpc.IntegerMarshaller; import io.grpc.IntegerMarshaller;
import io.grpc.InternalChannelz;
import io.grpc.InternalChannelz.ServerSocketsList;
import io.grpc.InternalChannelz.SocketStats;
import io.grpc.InternalServerInterceptors; import io.grpc.InternalServerInterceptors;
import io.grpc.LogId;
import io.grpc.Metadata; import io.grpc.Metadata;
import io.grpc.MethodDescriptor; import io.grpc.MethodDescriptor;
import io.grpc.ServerCall; import io.grpc.ServerCall;
@ -69,8 +74,6 @@ import io.grpc.ServerTransportFilter;
import io.grpc.ServiceDescriptor; import io.grpc.ServiceDescriptor;
import io.grpc.Status; import io.grpc.Status;
import io.grpc.StringMarshaller; import io.grpc.StringMarshaller;
import io.grpc.internal.Channelz.ServerSocketsList;
import io.grpc.internal.Channelz.SocketStats;
import io.grpc.internal.ServerImpl.JumpToApplicationThreadServerStreamListener; import io.grpc.internal.ServerImpl.JumpToApplicationThreadServerStreamListener;
import io.grpc.internal.testing.SingleMessageProducer; import io.grpc.internal.testing.SingleMessageProducer;
import io.grpc.internal.testing.TestServerStreamTracer; import io.grpc.internal.testing.TestServerStreamTracer;
@ -142,7 +145,7 @@ public class ServerImplTest {
private final FakeClock executor = new FakeClock(); private final FakeClock executor = new FakeClock();
private final FakeClock timer = new FakeClock(); private final FakeClock timer = new FakeClock();
private final Channelz channelz = new Channelz(); private final InternalChannelz channelz = new InternalChannelz();
@Mock @Mock
private ServerStreamTracer.Factory streamTracerFactory; private ServerStreamTracer.Factory streamTracerFactory;

View File

@ -22,6 +22,7 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
import io.grpc.CallOptions; import io.grpc.CallOptions;
import io.grpc.LogId;
import io.grpc.Metadata; import io.grpc.Metadata;
import io.grpc.MethodDescriptor; import io.grpc.MethodDescriptor;
import java.net.SocketAddress; import java.net.SocketAddress;

View File

@ -22,16 +22,16 @@ import com.google.common.util.concurrent.SettableFuture;
import io.grpc.Attributes; import io.grpc.Attributes;
import io.grpc.CallCredentials; import io.grpc.CallCredentials;
import io.grpc.CallOptions; import io.grpc.CallOptions;
import io.grpc.InternalChannelz.SocketStats;
import io.grpc.LogId;
import io.grpc.Metadata; import io.grpc.Metadata;
import io.grpc.MethodDescriptor; import io.grpc.MethodDescriptor;
import io.grpc.SecurityLevel; import io.grpc.SecurityLevel;
import io.grpc.Status; import io.grpc.Status;
import io.grpc.Status.Code; import io.grpc.Status.Code;
import io.grpc.cronet.CronetChannelBuilder.StreamBuilderFactory; import io.grpc.cronet.CronetChannelBuilder.StreamBuilderFactory;
import io.grpc.internal.Channelz.SocketStats;
import io.grpc.internal.ConnectionClientTransport; import io.grpc.internal.ConnectionClientTransport;
import io.grpc.internal.GrpcUtil; import io.grpc.internal.GrpcUtil;
import io.grpc.internal.LogId;
import io.grpc.internal.StatsTraceContext; import io.grpc.internal.StatsTraceContext;
import io.grpc.internal.TransportTracer; import io.grpc.internal.TransportTracer;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;

View File

@ -23,13 +23,13 @@ import io.grpc.Attributes;
import io.grpc.ConnectivityStateInfo; import io.grpc.ConnectivityStateInfo;
import io.grpc.EquivalentAddressGroup; import io.grpc.EquivalentAddressGroup;
import io.grpc.LoadBalancer; import io.grpc.LoadBalancer;
import io.grpc.LogId;
import io.grpc.Status; import io.grpc.Status;
import io.grpc.WithLogId;
import io.grpc.internal.BackoffPolicy; import io.grpc.internal.BackoffPolicy;
import io.grpc.internal.GrpcAttributes; import io.grpc.internal.GrpcAttributes;
import io.grpc.internal.LogId;
import io.grpc.internal.ObjectPool; import io.grpc.internal.ObjectPool;
import io.grpc.internal.TimeProvider; import io.grpc.internal.TimeProvider;
import io.grpc.internal.WithLogId;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;

View File

@ -38,12 +38,12 @@ import io.grpc.LoadBalancer.PickResult;
import io.grpc.LoadBalancer.PickSubchannelArgs; import io.grpc.LoadBalancer.PickSubchannelArgs;
import io.grpc.LoadBalancer.Subchannel; import io.grpc.LoadBalancer.Subchannel;
import io.grpc.LoadBalancer.SubchannelPicker; import io.grpc.LoadBalancer.SubchannelPicker;
import io.grpc.LogId;
import io.grpc.ManagedChannel; import io.grpc.ManagedChannel;
import io.grpc.Metadata; import io.grpc.Metadata;
import io.grpc.Status; import io.grpc.Status;
import io.grpc.internal.BackoffPolicy; import io.grpc.internal.BackoffPolicy;
import io.grpc.internal.GrpcAttributes; import io.grpc.internal.GrpcAttributes;
import io.grpc.internal.LogId;
import io.grpc.internal.TimeProvider; import io.grpc.internal.TimeProvider;
import io.grpc.lb.v1.ClientStats; import io.grpc.lb.v1.ClientStats;
import io.grpc.lb.v1.InitialLoadBalanceRequest; import io.grpc.lb.v1.InitialLoadBalanceRequest;

View File

@ -18,7 +18,7 @@ package io.grpc.netty;
import io.grpc.Attributes; import io.grpc.Attributes;
import io.grpc.Internal; import io.grpc.Internal;
import io.grpc.internal.Channelz; import io.grpc.InternalChannelz;
import io.netty.channel.ChannelPromise; import io.netty.channel.ChannelPromise;
import io.netty.handler.codec.http2.Http2ConnectionDecoder; import io.netty.handler.codec.http2.Http2ConnectionDecoder;
import io.netty.handler.codec.http2.Http2ConnectionEncoder; import io.netty.handler.codec.http2.Http2ConnectionEncoder;
@ -45,8 +45,8 @@ public abstract class GrpcHttp2ConnectionHandler extends Http2ConnectionHandler
} }
/** /**
* Same as {@link #handleProtocolNegotiationCompleted(Attributes, Channelz.Security)} * Same as {@link #handleProtocolNegotiationCompleted(Attributes, InternalChannelz.Security)}
* but with no {@link io.grpc.internal.Channelz.Security}. * but with no {@link InternalChannelz.Security}.
* *
* @deprecated Use the two argument method instead. * @deprecated Use the two argument method instead.
*/ */
@ -64,7 +64,8 @@ public abstract class GrpcHttp2ConnectionHandler extends Http2ConnectionHandler
* @param attrs arbitrary attributes passed after protocol negotiation (eg. SSLSession). * @param attrs arbitrary attributes passed after protocol negotiation (eg. SSLSession).
* @param securityInfo informs channelz about the security protocol. * @param securityInfo informs channelz about the security protocol.
*/ */
public void handleProtocolNegotiationCompleted(Attributes attrs, Channelz.Security securityInfo) { public void handleProtocolNegotiationCompleted(
Attributes attrs, InternalChannelz.Security securityInfo) {
} }
/** /**

View File

@ -17,7 +17,7 @@
package io.grpc.netty; package io.grpc.netty;
import io.grpc.Internal; import io.grpc.Internal;
import io.grpc.internal.Channelz.TcpInfo; import io.grpc.InternalChannelz.TcpInfo;
import java.util.Map; import java.util.Map;
/** /**

View File

@ -24,10 +24,10 @@ import com.google.common.base.Preconditions;
import com.google.common.base.Stopwatch; import com.google.common.base.Stopwatch;
import com.google.common.base.Supplier; import com.google.common.base.Supplier;
import io.grpc.Attributes; import io.grpc.Attributes;
import io.grpc.InternalChannelz;
import io.grpc.Metadata; import io.grpc.Metadata;
import io.grpc.Status; import io.grpc.Status;
import io.grpc.StatusException; import io.grpc.StatusException;
import io.grpc.internal.Channelz;
import io.grpc.internal.ClientStreamListener.RpcProgress; import io.grpc.internal.ClientStreamListener.RpcProgress;
import io.grpc.internal.ClientTransport.PingCallback; import io.grpc.internal.ClientTransport.PingCallback;
import io.grpc.internal.GrpcUtil; import io.grpc.internal.GrpcUtil;
@ -106,7 +106,7 @@ class NettyClientHandler extends AbstractNettyHandler {
private WriteQueue clientWriteQueue; private WriteQueue clientWriteQueue;
private Http2Ping ping; private Http2Ping ping;
private Attributes attributes = Attributes.EMPTY; private Attributes attributes = Attributes.EMPTY;
private Channelz.Security securityInfo; private InternalChannelz.Security securityInfo;
static NettyClientHandler newHandler( static NettyClientHandler newHandler(
ClientTransportLifecycleManager lifecycleManager, ClientTransportLifecycleManager lifecycleManager,
@ -418,7 +418,7 @@ class NettyClientHandler extends AbstractNettyHandler {
@Override @Override
public void handleProtocolNegotiationCompleted( public void handleProtocolNegotiationCompleted(
Attributes attributes, Channelz.Security securityInfo) { Attributes attributes, InternalChannelz.Security securityInfo) {
this.attributes = attributes; this.attributes = attributes;
this.securityInfo = securityInfo; this.securityInfo = securityInfo;
super.handleProtocolNegotiationCompleted(attributes, securityInfo); super.handleProtocolNegotiationCompleted(attributes, securityInfo);
@ -429,7 +429,7 @@ class NettyClientHandler extends AbstractNettyHandler {
return eagAttributes; return eagAttributes;
} }
Channelz.Security getSecurityInfo() { InternalChannelz.Security getSecurityInfo() {
return securityInfo; return securityInfo;
} }

View File

@ -26,10 +26,11 @@ import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.SettableFuture; import com.google.common.util.concurrent.SettableFuture;
import io.grpc.Attributes; import io.grpc.Attributes;
import io.grpc.CallOptions; import io.grpc.CallOptions;
import io.grpc.InternalChannelz.SocketStats;
import io.grpc.LogId;
import io.grpc.Metadata; import io.grpc.Metadata;
import io.grpc.MethodDescriptor; import io.grpc.MethodDescriptor;
import io.grpc.Status; import io.grpc.Status;
import io.grpc.internal.Channelz.SocketStats;
import io.grpc.internal.ClientStream; import io.grpc.internal.ClientStream;
import io.grpc.internal.ConnectionClientTransport; import io.grpc.internal.ConnectionClientTransport;
import io.grpc.internal.FailingClientStream; import io.grpc.internal.FailingClientStream;
@ -37,7 +38,6 @@ import io.grpc.internal.GrpcUtil;
import io.grpc.internal.Http2Ping; import io.grpc.internal.Http2Ping;
import io.grpc.internal.KeepAliveManager; import io.grpc.internal.KeepAliveManager;
import io.grpc.internal.KeepAliveManager.ClientKeepAlivePinger; import io.grpc.internal.KeepAliveManager.ClientKeepAlivePinger;
import io.grpc.internal.LogId;
import io.grpc.internal.StatsTraceContext; import io.grpc.internal.StatsTraceContext;
import io.grpc.internal.TransportTracer; import io.grpc.internal.TransportTracer;
import io.netty.bootstrap.Bootstrap; import io.netty.bootstrap.Bootstrap;

View File

@ -26,17 +26,17 @@ import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.SettableFuture; import com.google.common.util.concurrent.SettableFuture;
import io.grpc.Instrumented;
import io.grpc.InternalChannelz;
import io.grpc.InternalChannelz.SocketStats;
import io.grpc.LogId;
import io.grpc.ServerStreamTracer; import io.grpc.ServerStreamTracer;
import io.grpc.internal.Channelz; import io.grpc.WithLogId;
import io.grpc.internal.Channelz.SocketStats;
import io.grpc.internal.Instrumented;
import io.grpc.internal.InternalServer; import io.grpc.internal.InternalServer;
import io.grpc.internal.LogId;
import io.grpc.internal.ServerListener; import io.grpc.internal.ServerListener;
import io.grpc.internal.ServerTransportListener; import io.grpc.internal.ServerTransportListener;
import io.grpc.internal.SharedResourceHolder; import io.grpc.internal.SharedResourceHolder;
import io.grpc.internal.TransportTracer; import io.grpc.internal.TransportTracer;
import io.grpc.internal.WithLogId;
import io.netty.bootstrap.ServerBootstrap; import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelFuture;
@ -92,7 +92,7 @@ class NettyServer implements InternalServer, WithLogId {
private final ReferenceCounted eventLoopReferenceCounter = new EventLoopReferenceCounter(); private final ReferenceCounted eventLoopReferenceCounter = new EventLoopReferenceCounter();
private final List<ServerStreamTracer.Factory> streamTracerFactories; private final List<ServerStreamTracer.Factory> streamTracerFactories;
private final TransportTracer.Factory transportTracerFactory; private final TransportTracer.Factory transportTracerFactory;
private final Channelz channelz; private final InternalChannelz channelz;
// Only modified in event loop but safe to read any time. Set at startup and unset at shutdown. // Only modified in event loop but safe to read any time. Set at startup and unset at shutdown.
// In the future we may have >1 listen socket. // In the future we may have >1 listen socket.
private volatile ImmutableList<Instrumented<SocketStats>> listenSockets = ImmutableList.of(); private volatile ImmutableList<Instrumented<SocketStats>> listenSockets = ImmutableList.of();
@ -108,7 +108,7 @@ class NettyServer implements InternalServer, WithLogId {
long maxConnectionIdleInNanos, long maxConnectionIdleInNanos,
long maxConnectionAgeInNanos, long maxConnectionAgeGraceInNanos, long maxConnectionAgeInNanos, long maxConnectionAgeGraceInNanos,
boolean permitKeepAliveWithoutCalls, long permitKeepAliveTimeInNanos, boolean permitKeepAliveWithoutCalls, long permitKeepAliveTimeInNanos,
Channelz channelz) { InternalChannelz channelz) {
this.address = address; this.address = address;
this.channelType = checkNotNull(channelType, "channelType"); this.channelType = checkNotNull(channelType, "channelType");
checkNotNull(channelOptions, "channelOptions"); checkNotNull(channelOptions, "channelOptions");

View File

@ -31,12 +31,12 @@ import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import io.grpc.Attributes; import io.grpc.Attributes;
import io.grpc.InternalChannelz;
import io.grpc.InternalMetadata; import io.grpc.InternalMetadata;
import io.grpc.InternalStatus; import io.grpc.InternalStatus;
import io.grpc.Metadata; import io.grpc.Metadata;
import io.grpc.ServerStreamTracer; import io.grpc.ServerStreamTracer;
import io.grpc.Status; import io.grpc.Status;
import io.grpc.internal.Channelz;
import io.grpc.internal.GrpcUtil; import io.grpc.internal.GrpcUtil;
import io.grpc.internal.KeepAliveManager; import io.grpc.internal.KeepAliveManager;
import io.grpc.internal.LogExceptionRunnable; import io.grpc.internal.LogExceptionRunnable;
@ -113,7 +113,7 @@ class NettyServerHandler extends AbstractNettyHandler {
private final KeepAliveEnforcer keepAliveEnforcer; private final KeepAliveEnforcer keepAliveEnforcer;
/** Incomplete attributes produced by negotiator. */ /** Incomplete attributes produced by negotiator. */
private Attributes negotiationAttributes; private Attributes negotiationAttributes;
private Channelz.Security securityInfo; private InternalChannelz.Security securityInfo;
/** Completed attributes produced by transportReady. */ /** Completed attributes produced by transportReady. */
private Attributes attributes; private Attributes attributes;
private Throwable connectionError; private Throwable connectionError;
@ -507,12 +507,12 @@ class NettyServerHandler extends AbstractNettyHandler {
@Override @Override
public void handleProtocolNegotiationCompleted( public void handleProtocolNegotiationCompleted(
Attributes attrs, Channelz.Security securityInfo) { Attributes attrs, InternalChannelz.Security securityInfo) {
negotiationAttributes = attrs; negotiationAttributes = attrs;
this.securityInfo = securityInfo; this.securityInfo = securityInfo;
} }
Channelz.Security getSecurityInfo() { InternalChannelz.Security getSecurityInfo() {
return securityInfo; return securityInfo;
} }

View File

@ -22,10 +22,10 @@ import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.SettableFuture; import com.google.common.util.concurrent.SettableFuture;
import io.grpc.InternalChannelz.SocketStats;
import io.grpc.LogId;
import io.grpc.ServerStreamTracer; import io.grpc.ServerStreamTracer;
import io.grpc.Status; import io.grpc.Status;
import io.grpc.internal.Channelz.SocketStats;
import io.grpc.internal.LogId;
import io.grpc.internal.ServerTransport; import io.grpc.internal.ServerTransport;
import io.grpc.internal.ServerTransportListener; import io.grpc.internal.ServerTransportListener;
import io.grpc.internal.TransportTracer; import io.grpc.internal.TransportTracer;

View File

@ -18,7 +18,7 @@ package io.grpc.netty;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import io.grpc.internal.Channelz.TcpInfo; import io.grpc.InternalChannelz.TcpInfo;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import java.util.Map; import java.util.Map;
import javax.annotation.Nullable; import javax.annotation.Nullable;

View File

@ -25,9 +25,9 @@ import io.grpc.Attributes;
import io.grpc.CallCredentials; import io.grpc.CallCredentials;
import io.grpc.Grpc; import io.grpc.Grpc;
import io.grpc.Internal; import io.grpc.Internal;
import io.grpc.InternalChannelz;
import io.grpc.SecurityLevel; import io.grpc.SecurityLevel;
import io.grpc.Status; import io.grpc.Status;
import io.grpc.internal.Channelz;
import io.grpc.internal.GrpcUtil; import io.grpc.internal.GrpcUtil;
import io.netty.channel.ChannelDuplexHandler; import io.netty.channel.ChannelDuplexHandler;
import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelFuture;
@ -158,7 +158,7 @@ public final class ProtocolNegotiators {
.set(Grpc.TRANSPORT_ATTR_SSL_SESSION, session) .set(Grpc.TRANSPORT_ATTR_SSL_SESSION, session)
.set(Grpc.TRANSPORT_ATTR_REMOTE_ADDR, ctx.channel().remoteAddress()) .set(Grpc.TRANSPORT_ATTR_REMOTE_ADDR, ctx.channel().remoteAddress())
.build(), .build(),
new Channelz.Security(new Channelz.Tls(session))); new InternalChannelz.Security(new InternalChannelz.Tls(session)));
// Replace this handler with the GRPC handler. // Replace this handler with the GRPC handler.
ctx.pipeline().replace(this, null, grpcHandler); ctx.pipeline().replace(this, null, grpcHandler);
} else { } else {
@ -649,7 +649,7 @@ public final class ProtocolNegotiators {
.set(Grpc.TRANSPORT_ATTR_REMOTE_ADDR, ctx.channel().remoteAddress()) .set(Grpc.TRANSPORT_ATTR_REMOTE_ADDR, ctx.channel().remoteAddress())
.set(CallCredentials.ATTR_SECURITY_LEVEL, SecurityLevel.PRIVACY_AND_INTEGRITY) .set(CallCredentials.ATTR_SECURITY_LEVEL, SecurityLevel.PRIVACY_AND_INTEGRITY)
.build(), .build(),
new Channelz.Security(new Channelz.Tls(session))); new InternalChannelz.Security(new InternalChannelz.Tls(session)));
writeBufferedAndRemove(ctx); writeBufferedAndRemove(ctx);
} else { } else {
Exception ex = new Exception( Exception ex = new Exception(

View File

@ -25,10 +25,10 @@ import static io.netty.util.CharsetUtil.UTF_8;
import com.google.common.annotations.VisibleForTesting; import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import io.grpc.InternalChannelz;
import io.grpc.InternalMetadata; import io.grpc.InternalMetadata;
import io.grpc.Metadata; import io.grpc.Metadata;
import io.grpc.Status; import io.grpc.Status;
import io.grpc.internal.Channelz;
import io.grpc.internal.GrpcUtil; import io.grpc.internal.GrpcUtil;
import io.grpc.internal.SharedResourceHolder.Resource; import io.grpc.internal.SharedResourceHolder.Resource;
import io.grpc.netty.GrpcHttp2HeadersUtils.GrpcHttp2InboundHeaders; import io.grpc.netty.GrpcHttp2HeadersUtils.GrpcHttp2InboundHeaders;
@ -209,9 +209,9 @@ class Utils {
} }
} }
static Channelz.SocketOptions getSocketOptions(Channel channel) { static InternalChannelz.SocketOptions getSocketOptions(Channel channel) {
ChannelConfig config = channel.config(); ChannelConfig config = channel.config();
Channelz.SocketOptions.Builder b = new Channelz.SocketOptions.Builder(); InternalChannelz.SocketOptions.Builder b = new InternalChannelz.SocketOptions.Builder();
// The API allows returning null but not sure if it can happen in practice. // The API allows returning null but not sure if it can happen in practice.
// Let's be paranoid and do null checking just in case. // Let's be paranoid and do null checking just in case.

View File

@ -40,6 +40,7 @@ import com.google.common.util.concurrent.SettableFuture;
import io.grpc.Attributes; import io.grpc.Attributes;
import io.grpc.CallOptions; import io.grpc.CallOptions;
import io.grpc.Grpc; import io.grpc.Grpc;
import io.grpc.InternalChannelz;
import io.grpc.Metadata; import io.grpc.Metadata;
import io.grpc.MethodDescriptor; import io.grpc.MethodDescriptor;
import io.grpc.MethodDescriptor.Marshaller; import io.grpc.MethodDescriptor.Marshaller;
@ -47,7 +48,6 @@ import io.grpc.ServerStreamTracer;
import io.grpc.Status; import io.grpc.Status;
import io.grpc.Status.Code; import io.grpc.Status.Code;
import io.grpc.StatusException; import io.grpc.StatusException;
import io.grpc.internal.Channelz;
import io.grpc.internal.ClientStream; import io.grpc.internal.ClientStream;
import io.grpc.internal.ClientStreamListener; import io.grpc.internal.ClientStreamListener;
import io.grpc.internal.ClientTransport; import io.grpc.internal.ClientTransport;
@ -107,7 +107,7 @@ public class NettyClientTransportTest {
private final List<NettyClientTransport> transports = new ArrayList<NettyClientTransport>(); private final List<NettyClientTransport> transports = new ArrayList<NettyClientTransport>();
private final NioEventLoopGroup group = new NioEventLoopGroup(1); private final NioEventLoopGroup group = new NioEventLoopGroup(1);
private final EchoServerListener serverListener = new EchoServerListener(); private final EchoServerListener serverListener = new EchoServerListener();
private final Channelz channelz = new Channelz(); private final InternalChannelz channelz = new InternalChannelz();
private Runnable tooManyPingsRunnable = new Runnable() { private Runnable tooManyPingsRunnable = new Runnable() {
// Throwing is useless in this method, because Netty doesn't propagate the exception // Throwing is useless in this method, because Netty doesn't propagate the exception
@Override public void run() {} @Override public void run() {}

View File

@ -29,7 +29,7 @@ import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
import com.google.errorprone.annotations.CanIgnoreReturnValue; import com.google.errorprone.annotations.CanIgnoreReturnValue;
import io.grpc.internal.Channelz.TransportStats; import io.grpc.InternalChannelz.TransportStats;
import io.grpc.internal.FakeClock; import io.grpc.internal.FakeClock;
import io.grpc.internal.MessageFramer; import io.grpc.internal.MessageFramer;
import io.grpc.internal.StatsTraceContext; import io.grpc.internal.StatsTraceContext;

View File

@ -18,16 +18,16 @@ package io.grpc.netty;
import static com.google.common.collect.Iterables.getOnlyElement; import static com.google.common.collect.Iterables.getOnlyElement;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import static io.grpc.internal.Channelz.id; import static io.grpc.InternalChannelz.id;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull; import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame; import static org.junit.Assert.assertSame;
import com.google.common.util.concurrent.SettableFuture; import com.google.common.util.concurrent.SettableFuture;
import io.grpc.Instrumented;
import io.grpc.InternalChannelz;
import io.grpc.InternalChannelz.SocketStats;
import io.grpc.ServerStreamTracer; import io.grpc.ServerStreamTracer;
import io.grpc.internal.Channelz;
import io.grpc.internal.Channelz.SocketStats;
import io.grpc.internal.Instrumented;
import io.grpc.internal.ServerListener; import io.grpc.internal.ServerListener;
import io.grpc.internal.ServerTransport; import io.grpc.internal.ServerTransport;
import io.grpc.internal.ServerTransportListener; import io.grpc.internal.ServerTransportListener;
@ -43,14 +43,13 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@RunWith(JUnit4.class) @RunWith(JUnit4.class)
public class NettyServerTest { public class NettyServerTest {
private final Channelz channelz = new Channelz(); private final InternalChannelz channelz = new InternalChannelz();
@Test @Test
public void getPort() throws Exception { public void getPort() throws Exception {

View File

@ -22,10 +22,10 @@ import static org.junit.Assert.assertSame;
import com.google.common.base.MoreObjects; import com.google.common.base.MoreObjects;
import com.google.common.truth.Truth; import com.google.common.truth.Truth;
import io.grpc.InternalChannelz;
import io.grpc.InternalChannelz.SocketOptions;
import io.grpc.Metadata; import io.grpc.Metadata;
import io.grpc.Status; import io.grpc.Status;
import io.grpc.internal.Channelz;
import io.grpc.internal.Channelz.SocketOptions;
import io.grpc.internal.GrpcUtil; import io.grpc.internal.GrpcUtil;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import io.netty.channel.ChannelOption; import io.netty.channel.ChannelOption;
@ -131,7 +131,7 @@ public class UtilsTest {
public void channelOptionsTest_noLinger() { public void channelOptionsTest_noLinger() {
Channel channel = new EmbeddedChannel(); Channel channel = new EmbeddedChannel();
assertNull(channel.config().getOption(ChannelOption.SO_LINGER)); assertNull(channel.config().getOption(ChannelOption.SO_LINGER));
Channelz.SocketOptions socketOptions = Utils.getSocketOptions(channel); InternalChannelz.SocketOptions socketOptions = Utils.getSocketOptions(channel);
assertNull(socketOptions.lingerSeconds); assertNull(socketOptions.lingerSeconds);
} }
@ -149,7 +149,7 @@ public class UtilsTest {
assertNull(socketOptions.soTimeoutMillis); assertNull(socketOptions.soTimeoutMillis);
} }
private static Channelz.SocketOptions setAndValidateGeneric(Channel channel) { private static InternalChannelz.SocketOptions setAndValidateGeneric(Channel channel) {
channel.config().setOption(ChannelOption.SO_LINGER, 3); channel.config().setOption(ChannelOption.SO_LINGER, 3);
// only applicable for OIO channels: // only applicable for OIO channels:
channel.config().setOption(ChannelOption.SO_TIMEOUT, 250); channel.config().setOption(ChannelOption.SO_TIMEOUT, 250);
@ -158,7 +158,7 @@ public class UtilsTest {
WriteBufferWaterMark writeBufWaterMark = new WriteBufferWaterMark(10, 20); WriteBufferWaterMark writeBufWaterMark = new WriteBufferWaterMark(10, 20);
channel.config().setOption(ChannelOption.WRITE_BUFFER_WATER_MARK, writeBufWaterMark); channel.config().setOption(ChannelOption.WRITE_BUFFER_WATER_MARK, writeBufWaterMark);
Channelz.SocketOptions socketOptions = Utils.getSocketOptions(channel); InternalChannelz.SocketOptions socketOptions = Utils.getSocketOptions(channel);
assertEquals(3, (int) socketOptions.lingerSeconds); assertEquals(3, (int) socketOptions.lingerSeconds);
assertEquals("true", socketOptions.others.get("SO_KEEPALIVE")); assertEquals("true", socketOptions.others.get("SO_KEEPALIVE"));
assertEquals( assertEquals(

View File

@ -34,6 +34,9 @@ import io.grpc.Attributes;
import io.grpc.CallCredentials; import io.grpc.CallCredentials;
import io.grpc.CallOptions; import io.grpc.CallOptions;
import io.grpc.Grpc; import io.grpc.Grpc;
import io.grpc.InternalChannelz;
import io.grpc.InternalChannelz.SocketStats;
import io.grpc.LogId;
import io.grpc.Metadata; import io.grpc.Metadata;
import io.grpc.MethodDescriptor; import io.grpc.MethodDescriptor;
import io.grpc.MethodDescriptor.MethodType; import io.grpc.MethodDescriptor.MethodType;
@ -41,15 +44,12 @@ import io.grpc.SecurityLevel;
import io.grpc.Status; import io.grpc.Status;
import io.grpc.Status.Code; import io.grpc.Status.Code;
import io.grpc.StatusException; import io.grpc.StatusException;
import io.grpc.internal.Channelz;
import io.grpc.internal.Channelz.SocketStats;
import io.grpc.internal.ClientStreamListener.RpcProgress; import io.grpc.internal.ClientStreamListener.RpcProgress;
import io.grpc.internal.ConnectionClientTransport; import io.grpc.internal.ConnectionClientTransport;
import io.grpc.internal.GrpcUtil; import io.grpc.internal.GrpcUtil;
import io.grpc.internal.Http2Ping; import io.grpc.internal.Http2Ping;
import io.grpc.internal.KeepAliveManager; import io.grpc.internal.KeepAliveManager;
import io.grpc.internal.KeepAliveManager.ClientKeepAlivePinger; import io.grpc.internal.KeepAliveManager.ClientKeepAlivePinger;
import io.grpc.internal.LogId;
import io.grpc.internal.ProxyParameters; import io.grpc.internal.ProxyParameters;
import io.grpc.internal.SerializingExecutor; import io.grpc.internal.SerializingExecutor;
import io.grpc.internal.SharedResourceHolder; import io.grpc.internal.SharedResourceHolder;
@ -192,7 +192,7 @@ class OkHttpClientTransport implements ConnectionClientTransport, TransportExcep
@GuardedBy("lock") @GuardedBy("lock")
private final TransportTracer transportTracer; private final TransportTracer transportTracer;
@GuardedBy("lock") @GuardedBy("lock")
private Channelz.Security securityInfo; private InternalChannelz.Security securityInfo;
@VisibleForTesting @VisibleForTesting
@Nullable @Nullable
@ -505,7 +505,7 @@ class OkHttpClientTransport implements ConnectionClientTransport, TransportExcep
maxConcurrentStreams = Integer.MAX_VALUE; maxConcurrentStreams = Integer.MAX_VALUE;
startPendingStreams(); startPendingStreams();
if (sslSession != null) { if (sslSession != null) {
securityInfo = new Channelz.Security(new Channelz.Tls(sslSession)); securityInfo = new InternalChannelz.Security(new InternalChannelz.Tls(sslSession));
} }
} }
@ -930,7 +930,7 @@ class OkHttpClientTransport implements ConnectionClientTransport, TransportExcep
transportTracer.getStats(), transportTracer.getStats(),
/*local=*/ null, /*local=*/ null,
/*remote=*/ null, /*remote=*/ null,
new Channelz.SocketOptions.Builder().build(), new InternalChannelz.SocketOptions.Builder().build(),
/*security=*/ null)); /*security=*/ null));
} else { } else {
ret.set(new SocketStats( ret.set(new SocketStats(

View File

@ -17,9 +17,9 @@
package io.grpc.okhttp; package io.grpc.okhttp;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import io.grpc.InternalChannelz;
import io.grpc.InternalMetadata; import io.grpc.InternalMetadata;
import io.grpc.Metadata; import io.grpc.Metadata;
import io.grpc.internal.Channelz;
import io.grpc.internal.TransportFrameUtil; import io.grpc.internal.TransportFrameUtil;
import io.grpc.okhttp.internal.CipherSuite; import io.grpc.okhttp.internal.CipherSuite;
import io.grpc.okhttp.internal.ConnectionSpec; import io.grpc.okhttp.internal.ConnectionSpec;
@ -88,11 +88,11 @@ class Utils {
/** /**
* Attempts to capture all known socket options and return the results as a * Attempts to capture all known socket options and return the results as a
* {@link Channelz.SocketOptions}. If getting a socket option threw an exception, * {@link InternalChannelz.SocketOptions}. If getting a socket option threw an exception,
* log the error to the logger and report the value as an error in the response. * log the error to the logger and report the value as an error in the response.
*/ */
static Channelz.SocketOptions getSocketOptions(Socket socket) { static InternalChannelz.SocketOptions getSocketOptions(Socket socket) {
Channelz.SocketOptions.Builder builder = new Channelz.SocketOptions.Builder(); InternalChannelz.SocketOptions.Builder builder = new InternalChannelz.SocketOptions.Builder();
try { try {
builder.setSocketOptionLingerSeconds(socket.getSoLinger()); builder.setSocketOptionLingerSeconds(socket.getSoLinger());
} catch (SocketException e) { } catch (SocketException e) {

View File

@ -55,6 +55,9 @@ import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.MoreExecutors; import com.google.common.util.concurrent.MoreExecutors;
import com.google.common.util.concurrent.SettableFuture; import com.google.common.util.concurrent.SettableFuture;
import io.grpc.CallOptions; import io.grpc.CallOptions;
import io.grpc.Instrumented;
import io.grpc.InternalChannelz.SocketStats;
import io.grpc.InternalChannelz.TransportStats;
import io.grpc.InternalStatus; import io.grpc.InternalStatus;
import io.grpc.Metadata; import io.grpc.Metadata;
import io.grpc.MethodDescriptor; import io.grpc.MethodDescriptor;
@ -63,12 +66,9 @@ import io.grpc.Status;
import io.grpc.Status.Code; import io.grpc.Status.Code;
import io.grpc.StatusException; import io.grpc.StatusException;
import io.grpc.internal.AbstractStream; import io.grpc.internal.AbstractStream;
import io.grpc.internal.Channelz.SocketStats;
import io.grpc.internal.Channelz.TransportStats;
import io.grpc.internal.ClientStreamListener; import io.grpc.internal.ClientStreamListener;
import io.grpc.internal.ClientTransport; import io.grpc.internal.ClientTransport;
import io.grpc.internal.GrpcUtil; import io.grpc.internal.GrpcUtil;
import io.grpc.internal.Instrumented;
import io.grpc.internal.ManagedClientTransport; import io.grpc.internal.ManagedClientTransport;
import io.grpc.internal.ProxyParameters; import io.grpc.internal.ProxyParameters;
import io.grpc.internal.TransportTracer; import io.grpc.internal.TransportTracer;

View File

@ -19,7 +19,7 @@ package io.grpc.okhttp;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import io.grpc.internal.Channelz.SocketOptions; import io.grpc.InternalChannelz.SocketOptions;
import io.grpc.okhttp.internal.CipherSuite; import io.grpc.okhttp.internal.CipherSuite;
import io.grpc.okhttp.internal.ConnectionSpec; import io.grpc.okhttp.internal.ConnectionSpec;
import io.grpc.okhttp.internal.TlsVersion; import io.grpc.okhttp.internal.TlsVersion;

View File

@ -24,7 +24,18 @@ import com.google.protobuf.Int64Value;
import com.google.protobuf.util.Durations; import com.google.protobuf.util.Durations;
import com.google.protobuf.util.Timestamps; import com.google.protobuf.util.Timestamps;
import io.grpc.ConnectivityState; import io.grpc.ConnectivityState;
import io.grpc.Instrumented;
import io.grpc.InternalChannelz;
import io.grpc.InternalChannelz.ChannelStats;
import io.grpc.InternalChannelz.ChannelTrace.Event;
import io.grpc.InternalChannelz.RootChannelList;
import io.grpc.InternalChannelz.ServerList;
import io.grpc.InternalChannelz.ServerSocketsList;
import io.grpc.InternalChannelz.ServerStats;
import io.grpc.InternalChannelz.SocketStats;
import io.grpc.InternalChannelz.TransportStats;
import io.grpc.Status; import io.grpc.Status;
import io.grpc.WithLogId;
import io.grpc.channelz.v1.Address; import io.grpc.channelz.v1.Address;
import io.grpc.channelz.v1.Address.OtherAddress; import io.grpc.channelz.v1.Address.OtherAddress;
import io.grpc.channelz.v1.Address.TcpIpAddress; import io.grpc.channelz.v1.Address.TcpIpAddress;
@ -56,17 +67,6 @@ import io.grpc.channelz.v1.SocketOptionTimeout;
import io.grpc.channelz.v1.SocketRef; import io.grpc.channelz.v1.SocketRef;
import io.grpc.channelz.v1.Subchannel; import io.grpc.channelz.v1.Subchannel;
import io.grpc.channelz.v1.SubchannelRef; import io.grpc.channelz.v1.SubchannelRef;
import io.grpc.internal.Channelz;
import io.grpc.internal.Channelz.ChannelStats;
import io.grpc.internal.Channelz.ChannelTrace.Event;
import io.grpc.internal.Channelz.RootChannelList;
import io.grpc.internal.Channelz.ServerList;
import io.grpc.internal.Channelz.ServerSocketsList;
import io.grpc.internal.Channelz.ServerStats;
import io.grpc.internal.Channelz.SocketStats;
import io.grpc.internal.Channelz.TransportStats;
import io.grpc.internal.Instrumented;
import io.grpc.internal.WithLogId;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.net.SocketAddress; import java.net.SocketAddress;
import java.security.cert.CertificateEncodingException; import java.security.cert.CertificateEncodingException;
@ -142,7 +142,7 @@ final class ChannelzProtoUtil {
.build(); .build();
} }
static Security toSecurity(Channelz.Security security) { static Security toSecurity(InternalChannelz.Security security) {
Preconditions.checkNotNull(security); Preconditions.checkNotNull(security);
Preconditions.checkState( Preconditions.checkState(
security.tls != null ^ security.other != null, security.tls != null ^ security.other != null,
@ -276,7 +276,7 @@ final class ChannelzProtoUtil {
.build(); .build();
} }
static SocketOption toSocketOptionTcpInfo(Channelz.TcpInfo i) { static SocketOption toSocketOptionTcpInfo(InternalChannelz.TcpInfo i) {
SocketOptionTcpInfo tcpInfo = SocketOptionTcpInfo.newBuilder() SocketOptionTcpInfo tcpInfo = SocketOptionTcpInfo.newBuilder()
.setTcpiState(i.state) .setTcpiState(i.state)
.setTcpiCaState(i.caState) .setTcpiCaState(i.caState)
@ -321,7 +321,7 @@ final class ChannelzProtoUtil {
return SocketOption.newBuilder().setName(name).setValue(value).build(); return SocketOption.newBuilder().setName(name).setValue(value).build();
} }
static List<SocketOption> toSocketOptionsList(Channelz.SocketOptions options) { static List<SocketOption> toSocketOptionsList(InternalChannelz.SocketOptions options) {
Preconditions.checkNotNull(options); Preconditions.checkNotNull(options);
List<SocketOption> ret = new ArrayList<SocketOption>(); List<SocketOption> ret = new ArrayList<SocketOption>();
if (options.lingerSeconds != null) { if (options.lingerSeconds != null) {
@ -352,7 +352,7 @@ final class ChannelzProtoUtil {
return channelBuilder.build(); return channelBuilder.build();
} }
static ChannelData extractChannelData(Channelz.ChannelStats stats) { static ChannelData extractChannelData(InternalChannelz.ChannelStats stats) {
ChannelData.Builder builder = ChannelData.newBuilder(); ChannelData.Builder builder = ChannelData.newBuilder();
builder.setTarget(stats.target) builder.setTarget(stats.target)
.setState(toChannelConnectivityState(stats.state)) .setState(toChannelConnectivityState(stats.state))
@ -370,7 +370,7 @@ final class ChannelzProtoUtil {
return ChannelConnectivityState.newBuilder().setState(toState(s)).build(); return ChannelConnectivityState.newBuilder().setState(toState(s)).build();
} }
private static ChannelTrace toChannelTrace(Channelz.ChannelTrace channelTrace) { private static ChannelTrace toChannelTrace(InternalChannelz.ChannelTrace channelTrace) {
return ChannelTrace.newBuilder() return ChannelTrace.newBuilder()
.setNumEventsLogged(channelTrace.numEventsLogged) .setNumEventsLogged(channelTrace.numEventsLogged)
.setCreationTimestamp(Timestamps.fromNanos(channelTrace.creationTimeNanos)) .setCreationTimestamp(Timestamps.fromNanos(channelTrace.creationTimeNanos))

View File

@ -18,6 +18,12 @@ package io.grpc.services;
import com.google.common.annotations.VisibleForTesting; import com.google.common.annotations.VisibleForTesting;
import io.grpc.ExperimentalApi; import io.grpc.ExperimentalApi;
import io.grpc.Instrumented;
import io.grpc.InternalChannelz;
import io.grpc.InternalChannelz.ChannelStats;
import io.grpc.InternalChannelz.ServerList;
import io.grpc.InternalChannelz.ServerSocketsList;
import io.grpc.InternalChannelz.SocketStats;
import io.grpc.ServerInterceptors; import io.grpc.ServerInterceptors;
import io.grpc.ServerServiceDefinition; import io.grpc.ServerServiceDefinition;
import io.grpc.Status; import io.grpc.Status;
@ -34,12 +40,6 @@ import io.grpc.channelz.v1.GetSubchannelRequest;
import io.grpc.channelz.v1.GetSubchannelResponse; import io.grpc.channelz.v1.GetSubchannelResponse;
import io.grpc.channelz.v1.GetTopChannelsRequest; import io.grpc.channelz.v1.GetTopChannelsRequest;
import io.grpc.channelz.v1.GetTopChannelsResponse; import io.grpc.channelz.v1.GetTopChannelsResponse;
import io.grpc.internal.Channelz;
import io.grpc.internal.Channelz.ChannelStats;
import io.grpc.internal.Channelz.ServerList;
import io.grpc.internal.Channelz.ServerSocketsList;
import io.grpc.internal.Channelz.SocketStats;
import io.grpc.internal.Instrumented;
import io.grpc.stub.StreamObserver; import io.grpc.stub.StreamObserver;
/** /**
@ -47,7 +47,7 @@ import io.grpc.stub.StreamObserver;
*/ */
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/4206") @ExperimentalApi("https://github.com/grpc/grpc-java/issues/4206")
public final class ChannelzService extends ChannelzGrpc.ChannelzImplBase { public final class ChannelzService extends ChannelzGrpc.ChannelzImplBase {
private final Channelz channelz; private final InternalChannelz channelz;
private final int maxPageSize; private final int maxPageSize;
/** /**
@ -56,7 +56,7 @@ public final class ChannelzService extends ChannelzGrpc.ChannelzImplBase {
*/ */
@Deprecated @Deprecated
public static ChannelzService newInstance(int maxPageSize) { public static ChannelzService newInstance(int maxPageSize) {
return new ChannelzService(Channelz.instance(), maxPageSize); return new ChannelzService(InternalChannelz.instance(), maxPageSize);
} }
/** /**
@ -67,12 +67,12 @@ public final class ChannelzService extends ChannelzGrpc.ChannelzImplBase {
*/ */
public static ServerServiceDefinition createInstance(int maxPageSize) { public static ServerServiceDefinition createInstance(int maxPageSize) {
return ServerInterceptors.intercept( return ServerInterceptors.intercept(
new ChannelzService(Channelz.instance(), maxPageSize), new ChannelzService(InternalChannelz.instance(), maxPageSize),
new RequireDoubleSubmitCookieInterceptor("grpc-channelz-v1-channelz-token")); new RequireDoubleSubmitCookieInterceptor("grpc-channelz-v1-channelz-token"));
} }
@VisibleForTesting @VisibleForTesting
ChannelzService(Channelz channelz, int maxPageSize) { ChannelzService(InternalChannelz channelz, int maxPageSize) {
this.channelz = channelz; this.channelz = channelz;
this.maxPageSize = maxPageSize; this.maxPageSize = maxPageSize;
} }
@ -81,7 +81,7 @@ public final class ChannelzService extends ChannelzGrpc.ChannelzImplBase {
@Override @Override
public void getTopChannels( public void getTopChannels(
GetTopChannelsRequest request, StreamObserver<GetTopChannelsResponse> responseObserver) { GetTopChannelsRequest request, StreamObserver<GetTopChannelsResponse> responseObserver) {
Channelz.RootChannelList rootChannels InternalChannelz.RootChannelList rootChannels
= channelz.getRootChannels(request.getStartChannelId(), maxPageSize); = channelz.getRootChannels(request.getStartChannelId(), maxPageSize);
responseObserver.onNext(ChannelzProtoUtil.toGetTopChannelResponse(rootChannels)); responseObserver.onNext(ChannelzProtoUtil.toGetTopChannelResponse(rootChannels));

View File

@ -17,7 +17,7 @@
package io.grpc.services; package io.grpc.services;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import static io.grpc.internal.Channelz.id; import static io.grpc.InternalChannelz.id;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
@ -32,6 +32,18 @@ import com.google.protobuf.Message;
import com.google.protobuf.util.Durations; import com.google.protobuf.util.Durations;
import com.google.protobuf.util.Timestamps; import com.google.protobuf.util.Timestamps;
import io.grpc.ConnectivityState; import io.grpc.ConnectivityState;
import io.grpc.Instrumented;
import io.grpc.InternalChannelz;
import io.grpc.InternalChannelz.ChannelStats;
import io.grpc.InternalChannelz.ChannelTrace.Event;
import io.grpc.InternalChannelz.ChannelTrace.Event.Severity;
import io.grpc.InternalChannelz.RootChannelList;
import io.grpc.InternalChannelz.ServerList;
import io.grpc.InternalChannelz.ServerSocketsList;
import io.grpc.InternalChannelz.ServerStats;
import io.grpc.InternalChannelz.SocketOptions;
import io.grpc.InternalChannelz.SocketStats;
import io.grpc.WithLogId;
import io.grpc.channelz.v1.Address; import io.grpc.channelz.v1.Address;
import io.grpc.channelz.v1.Address.OtherAddress; import io.grpc.channelz.v1.Address.OtherAddress;
import io.grpc.channelz.v1.Address.TcpIpAddress; import io.grpc.channelz.v1.Address.TcpIpAddress;
@ -62,18 +74,6 @@ import io.grpc.channelz.v1.SocketOptionTimeout;
import io.grpc.channelz.v1.SocketRef; import io.grpc.channelz.v1.SocketRef;
import io.grpc.channelz.v1.Subchannel; import io.grpc.channelz.v1.Subchannel;
import io.grpc.channelz.v1.SubchannelRef; import io.grpc.channelz.v1.SubchannelRef;
import io.grpc.internal.Channelz;
import io.grpc.internal.Channelz.ChannelStats;
import io.grpc.internal.Channelz.ChannelTrace.Event;
import io.grpc.internal.Channelz.ChannelTrace.Event.Severity;
import io.grpc.internal.Channelz.RootChannelList;
import io.grpc.internal.Channelz.ServerList;
import io.grpc.internal.Channelz.ServerSocketsList;
import io.grpc.internal.Channelz.ServerStats;
import io.grpc.internal.Channelz.SocketOptions;
import io.grpc.internal.Channelz.SocketStats;
import io.grpc.internal.Instrumented;
import io.grpc.internal.WithLogId;
import io.grpc.services.ChannelzTestHelper.TestChannel; import io.grpc.services.ChannelzTestHelper.TestChannel;
import io.grpc.services.ChannelzTestHelper.TestListenSocket; import io.grpc.services.ChannelzTestHelper.TestListenSocket;
import io.grpc.services.ChannelzTestHelper.TestServer; import io.grpc.services.ChannelzTestHelper.TestServer;
@ -188,8 +188,8 @@ public final class ChannelzProtoUtilTest {
.setValue("some-made-up-value") .setValue("some-made-up-value")
.build(); .build();
private final Channelz.TcpInfo channelzTcpInfo private final InternalChannelz.TcpInfo channelzTcpInfo
= new Channelz.TcpInfo.Builder() = new InternalChannelz.TcpInfo.Builder()
.setState(70) .setState(70)
.setCaState(71) .setCaState(71)
.setRetransmits(72) .setRetransmits(72)
@ -440,8 +440,8 @@ public final class ChannelzProtoUtilTest {
when(local.getEncoded()).thenReturn("localcert".getBytes(Charsets.UTF_8)); when(local.getEncoded()).thenReturn("localcert".getBytes(Charsets.UTF_8));
when(remote.getEncoded()).thenReturn("remotecert".getBytes(Charsets.UTF_8)); when(remote.getEncoded()).thenReturn("remotecert".getBytes(Charsets.UTF_8));
socket.security = new Channelz.Security( socket.security = new InternalChannelz.Security(
new Channelz.Tls("TLS_NULL_WITH_NULL_NULL", local, remote)); new InternalChannelz.Tls("TLS_NULL_WITH_NULL_NULL", local, remote));
assertEquals( assertEquals(
Security.newBuilder().setTls( Security.newBuilder().setTls(
Tls.newBuilder() Tls.newBuilder()
@ -451,8 +451,8 @@ public final class ChannelzProtoUtilTest {
.build(), .build(),
ChannelzProtoUtil.toSocket(socket).getSecurity()); ChannelzProtoUtil.toSocket(socket).getSecurity());
socket.security = new Channelz.Security( socket.security = new InternalChannelz.Security(
new Channelz.Tls("TLS_NULL_WITH_NULL_NULL", /*localCert=*/ null, remote)); new InternalChannelz.Tls("TLS_NULL_WITH_NULL_NULL", /*localCert=*/ null, remote));
assertEquals( assertEquals(
Security.newBuilder().setTls( Security.newBuilder().setTls(
Tls.newBuilder() Tls.newBuilder()
@ -461,8 +461,8 @@ public final class ChannelzProtoUtilTest {
.build(), .build(),
ChannelzProtoUtil.toSocket(socket).getSecurity()); ChannelzProtoUtil.toSocket(socket).getSecurity());
socket.security = new Channelz.Security( socket.security = new InternalChannelz.Security(
new Channelz.Tls("TLS_NULL_WITH_NULL_NULL", local, /*remoteCert=*/ null)); new InternalChannelz.Tls("TLS_NULL_WITH_NULL_NULL", local, /*remoteCert=*/ null));
assertEquals( assertEquals(
Security.newBuilder().setTls( Security.newBuilder().setTls(
Tls.newBuilder() Tls.newBuilder()
@ -478,7 +478,8 @@ public final class ChannelzProtoUtilTest {
Message contents = GetChannelRequest.newBuilder().setChannelId(1).build(); Message contents = GetChannelRequest.newBuilder().setChannelId(1).build();
Any packed = Any.pack(contents); Any packed = Any.pack(contents);
socket.security socket.security
= new Channelz.Security(new Channelz.OtherSecurity("other_security", packed)); = new InternalChannelz.Security(
new InternalChannelz.OtherSecurity("other_security", packed));
assertEquals( assertEquals(
Security.newBuilder().setOther( Security.newBuilder().setOther(
OtherSecurity.newBuilder().setName("other_security").setValue(packed)) OtherSecurity.newBuilder().setName("other_security").setValue(packed))
@ -808,22 +809,22 @@ public final class ChannelzProtoUtilTest {
public void toSocketOptionsList() { public void toSocketOptionsList() {
assertThat( assertThat(
ChannelzProtoUtil.toSocketOptionsList( ChannelzProtoUtil.toSocketOptionsList(
new Channelz.SocketOptions.Builder().build())) new InternalChannelz.SocketOptions.Builder().build()))
.isEmpty(); .isEmpty();
assertThat( assertThat(
ChannelzProtoUtil.toSocketOptionsList( ChannelzProtoUtil.toSocketOptionsList(
new Channelz.SocketOptions.Builder().setSocketOptionLingerSeconds(10).build())) new InternalChannelz.SocketOptions.Builder().setSocketOptionLingerSeconds(10).build()))
.containsExactly(sockOptlinger10s); .containsExactly(sockOptlinger10s);
assertThat( assertThat(
ChannelzProtoUtil.toSocketOptionsList( ChannelzProtoUtil.toSocketOptionsList(
new Channelz.SocketOptions.Builder().setSocketOptionTimeoutMillis(200).build())) new InternalChannelz.SocketOptions.Builder().setSocketOptionTimeoutMillis(200).build()))
.containsExactly(sockOptTimeout200ms); .containsExactly(sockOptTimeout200ms);
assertThat( assertThat(
ChannelzProtoUtil.toSocketOptionsList( ChannelzProtoUtil.toSocketOptionsList(
new Channelz.SocketOptions new InternalChannelz.SocketOptions
.Builder() .Builder()
.addOption("SO_MADE_UP_OPTION", "some-made-up-value") .addOption("SO_MADE_UP_OPTION", "some-made-up-value")
.build())) .build()))
@ -836,7 +837,7 @@ public final class ChannelzProtoUtilTest {
.build(); .build();
assertThat( assertThat(
ChannelzProtoUtil.toSocketOptionsList( ChannelzProtoUtil.toSocketOptionsList(
new Channelz.SocketOptions.Builder() new InternalChannelz.SocketOptions.Builder()
.addOption("SO_MADE_UP_OPTION", "some-made-up-value") .addOption("SO_MADE_UP_OPTION", "some-made-up-value")
.addOption("SO_MADE_UP_OPTION2", "some-made-up-value2") .addOption("SO_MADE_UP_OPTION2", "some-made-up-value2")
.build())) .build()))
@ -846,7 +847,7 @@ public final class ChannelzProtoUtilTest {
@Test @Test
public void channelTrace_withoutEvents() { public void channelTrace_withoutEvents() {
ChannelStats stats = toBuilder(channel.stats) ChannelStats stats = toBuilder(channel.stats)
.setChannelTrace(new Channelz.ChannelTrace.Builder() .setChannelTrace(new InternalChannelz.ChannelTrace.Builder()
.setNumEventsLogged(1234) .setNumEventsLogged(1234)
.setCreationTimeNanos(1000) .setCreationTimeNanos(1000)
.build()) .build())
@ -874,7 +875,7 @@ public final class ChannelzProtoUtilTest {
ChannelStats stats = ChannelStats stats =
toBuilder(channel.stats) toBuilder(channel.stats)
.setChannelTrace( .setChannelTrace(
new Channelz.ChannelTrace.Builder() new InternalChannelz.ChannelTrace.Builder()
.setNumEventsLogged(1234) .setNumEventsLogged(1234)
.setCreationTimeNanos(1000) .setCreationTimeNanos(1000)
.setEvents(Arrays.asList(event1, event2)) .setEvents(Arrays.asList(event1, event2))

View File

@ -20,6 +20,7 @@ import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import io.grpc.InternalChannelz;
import io.grpc.Status; import io.grpc.Status;
import io.grpc.StatusRuntimeException; import io.grpc.StatusRuntimeException;
import io.grpc.channelz.v1.GetChannelRequest; import io.grpc.channelz.v1.GetChannelRequest;
@ -32,7 +33,6 @@ import io.grpc.channelz.v1.GetSubchannelRequest;
import io.grpc.channelz.v1.GetSubchannelResponse; import io.grpc.channelz.v1.GetSubchannelResponse;
import io.grpc.channelz.v1.GetTopChannelsRequest; import io.grpc.channelz.v1.GetTopChannelsRequest;
import io.grpc.channelz.v1.GetTopChannelsResponse; import io.grpc.channelz.v1.GetTopChannelsResponse;
import io.grpc.internal.Channelz;
import io.grpc.services.ChannelzTestHelper.TestChannel; import io.grpc.services.ChannelzTestHelper.TestChannel;
import io.grpc.services.ChannelzTestHelper.TestServer; import io.grpc.services.ChannelzTestHelper.TestServer;
import io.grpc.services.ChannelzTestHelper.TestSocket; import io.grpc.services.ChannelzTestHelper.TestSocket;
@ -48,7 +48,7 @@ public class ChannelzServiceTest {
// small value to force pagination // small value to force pagination
private static final int MAX_PAGE_SIZE = 1; private static final int MAX_PAGE_SIZE = 1;
private final Channelz channelz = new Channelz(); private final InternalChannelz channelz = new InternalChannelz();
private ChannelzService service = new ChannelzService(channelz, MAX_PAGE_SIZE); private ChannelzService service = new ChannelzService(channelz, MAX_PAGE_SIZE);
@Test @Test

View File

@ -20,16 +20,16 @@ import com.google.common.base.MoreObjects;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.SettableFuture; import com.google.common.util.concurrent.SettableFuture;
import io.grpc.ConnectivityState; import io.grpc.ConnectivityState;
import io.grpc.internal.Channelz; import io.grpc.Instrumented;
import io.grpc.internal.Channelz.ChannelStats; import io.grpc.InternalChannelz;
import io.grpc.internal.Channelz.Security; import io.grpc.InternalChannelz.ChannelStats;
import io.grpc.internal.Channelz.ServerStats; import io.grpc.InternalChannelz.Security;
import io.grpc.internal.Channelz.SocketOptions; import io.grpc.InternalChannelz.ServerStats;
import io.grpc.internal.Channelz.SocketStats; import io.grpc.InternalChannelz.SocketOptions;
import io.grpc.internal.Channelz.TransportStats; import io.grpc.InternalChannelz.SocketStats;
import io.grpc.internal.Instrumented; import io.grpc.InternalChannelz.TransportStats;
import io.grpc.internal.LogId; import io.grpc.LogId;
import io.grpc.internal.WithLogId; import io.grpc.WithLogId;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.net.SocketAddress; import java.net.SocketAddress;
import java.util.Collections; import java.util.Collections;
@ -57,7 +57,8 @@ final class ChannelzTestHelper {
/*remoteFlowControlWindow=*/ 12); /*remoteFlowControlWindow=*/ 12);
SocketAddress local = new InetSocketAddress("10.0.0.1", 1000); SocketAddress local = new InetSocketAddress("10.0.0.1", 1000);
SocketAddress remote = new InetSocketAddress("10.0.0.2", 1000); SocketAddress remote = new InetSocketAddress("10.0.0.2", 1000);
Channelz.SocketOptions socketOptions = new Channelz.SocketOptions.Builder().build(); InternalChannelz.SocketOptions socketOptions
= new InternalChannelz.SocketOptions.Builder().build();
Security security = null; Security security = null;
@Override @Override

View File

@ -48,17 +48,17 @@ import io.grpc.CallCredentials;
import io.grpc.CallOptions; import io.grpc.CallOptions;
import io.grpc.ClientStreamTracer; import io.grpc.ClientStreamTracer;
import io.grpc.Grpc; import io.grpc.Grpc;
import io.grpc.Instrumented;
import io.grpc.InternalChannelz.SocketStats;
import io.grpc.InternalChannelz.TransportStats;
import io.grpc.Metadata; import io.grpc.Metadata;
import io.grpc.MethodDescriptor; import io.grpc.MethodDescriptor;
import io.grpc.ServerStreamTracer; import io.grpc.ServerStreamTracer;
import io.grpc.Status; import io.grpc.Status;
import io.grpc.internal.Channelz.SocketStats;
import io.grpc.internal.Channelz.TransportStats;
import io.grpc.internal.ClientStream; import io.grpc.internal.ClientStream;
import io.grpc.internal.ClientStreamListener; import io.grpc.internal.ClientStreamListener;
import io.grpc.internal.ClientTransport; import io.grpc.internal.ClientTransport;
import io.grpc.internal.ConnectionClientTransport; import io.grpc.internal.ConnectionClientTransport;
import io.grpc.internal.Instrumented;
import io.grpc.internal.InternalServer; import io.grpc.internal.InternalServer;
import io.grpc.internal.IoUtils; import io.grpc.internal.IoUtils;
import io.grpc.internal.ManagedClientTransport; import io.grpc.internal.ManagedClientTransport;