|
6 | 6 |
|
7 | 7 | import io.grpc.Server; |
8 | 8 | import io.grpc.ServerBuilder; |
| 9 | +import io.grpc.Status; |
9 | 10 | import io.grpc.health.v1.HealthCheckRequest; |
10 | 11 | import io.grpc.health.v1.HealthCheckResponse.ServingStatus; |
11 | 12 | import io.grpc.health.v1.HealthGrpc; |
|
25 | 26 | import java.util.concurrent.ScheduledExecutorService; |
26 | 27 | import java.util.concurrent.ScheduledFuture; |
27 | 28 | import java.util.function.Function; |
| 29 | +import java.util.function.UnaryOperator; |
28 | 30 | import java.util.stream.Collectors; |
29 | 31 | import java.util.stream.Stream; |
30 | 32 | import lombok.Value; |
@@ -63,7 +65,11 @@ protected void doInit() { |
63 | 65 | final ServerBuilder<?> inProcessServerBuilder = |
64 | 66 | InProcessServerBuilder.forName(this.getInProcessServerName()) |
65 | 67 | .intercept( |
66 | | - new MetricCollectingServerInterceptor(PlatformMetricsRegistry.getMeterRegistry())) |
| 68 | + new MetricCollectingServerInterceptor( |
| 69 | + PlatformMetricsRegistry.getMeterRegistry(), |
| 70 | + UnaryOperator.identity(), |
| 71 | + timerBuilder -> timerBuilder.publishPercentiles(0.5, 0.75, 0.90, 0.95, 0.99), |
| 72 | + Status.Code.OK)) |
67 | 73 | .addService(this.healthStatusManager.getHealthService()); |
68 | 74 | final GrpcServiceContainerEnvironment serviceContainerEnvironment = |
69 | 75 | this.buildContainerEnvironment(this.grpcChannelRegistry, this.healthStatusManager); |
@@ -198,7 +204,11 @@ protected InProcessGrpcChannelRegistry buildChannelRegistry() { |
198 | 204 | this.getAuthorityInProcessOverrideMap(), |
199 | 205 | GrpcRegistryConfig.builder() |
200 | 206 | .defaultInterceptor( |
201 | | - new MetricCollectingClientInterceptor(PlatformMetricsRegistry.getMeterRegistry())) |
| 207 | + new MetricCollectingClientInterceptor( |
| 208 | + PlatformMetricsRegistry.getMeterRegistry(), |
| 209 | + UnaryOperator.identity(), |
| 210 | + timerBuilder -> timerBuilder.publishPercentiles(0.5, 0.75, 0.90, 0.95, 0.99), |
| 211 | + Status.Code.OK)) |
202 | 212 | .build()); |
203 | 213 | } |
204 | 214 |
|
@@ -244,7 +254,11 @@ private ServerBuilder<?> initializeBuilder(GrpcPlatformServerDefinition serverDe |
244 | 254 | } |
245 | 255 | // add micrometer-grpc interceptor to collect server metrics. |
246 | 256 | builder.intercept( |
247 | | - new MetricCollectingServerInterceptor(PlatformMetricsRegistry.getMeterRegistry())); |
| 257 | + new MetricCollectingServerInterceptor( |
| 258 | + PlatformMetricsRegistry.getMeterRegistry(), |
| 259 | + UnaryOperator.identity(), |
| 260 | + timerBuilder -> timerBuilder.publishPercentiles(0.5, 0.75, 0.90, 0.95, 0.99), |
| 261 | + Status.Code.OK)); |
248 | 262 |
|
249 | 263 | serverDefinition.getServerInterceptors().forEach(builder::intercept); |
250 | 264 | return builder; |
|
0 commit comments