Skip to content

Commit 20c614f

Browse files
committed
fix: logs and plumb metric sink
1 parent 1ee21f3 commit 20c614f

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

netty/src/main/java/io/grpc/netty/TcpMetrics.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ final class TcpMetrics {
5656
} catch (Error e) {
5757
log.log(Level.FINE, "Failed to load native Epoll library", e);
5858
}
59+
log.log(Level.INFO, "Epoll available during static init of TcpMetrics:"
60+
+ "{0}", epollAvailable);
5961
DEFAULT_METRICS = new Metrics(epollAvailable);
6062
}
6163

@@ -198,8 +200,15 @@ void recordTcpInfo(Channel channel) {
198200
}
199201

200202
private void recordTcpInfo(Channel channel, boolean isClose) {
201-
if (epollSocketChannelClass == null
202-
|| !epollSocketChannelClass.isInstance(channel)) {
203+
if (epollSocketChannelClass == null) {
204+
log.log(Level.FINE, "Skipping recordTcpInfo because"
205+
+ "epollSocketChannelClass is null");
206+
return;
207+
}
208+
if (!epollSocketChannelClass.isInstance(channel)) {
209+
log.log(Level.FINE, "Skipping recordTcpInfo because channel is not an"
210+
+ "instance of epollSocketChannelClass: {0}", channel.getClass()
211+
.getName());
203212
return;
204213
}
205214
List<String> labelValues = getLabelValues(channel);

opentelemetry/src/main/java/io/grpc/opentelemetry/GrpcOpenTelemetry.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ public void configureServerBuilder(ServerBuilder<?> serverBuilder) {
196196
serverBuilder.intercept(openTelemetryTracingModule.getServerSpanPropagationInterceptor());
197197
}
198198
serverBuilder.addStreamTracerFactory(openTelemetryMetricsModule.getServerTracerFactory());
199+
serverBuilder.addMetricSink(sink);
199200
}
200201

201202
@VisibleForTesting

0 commit comments

Comments
 (0)