|
44 | 44 | import com.linkedin.d2.jmx.JmxManager; |
45 | 45 | import com.linkedin.d2.jmx.NoOpXdsServerMetricsProvider; |
46 | 46 | import com.linkedin.d2.jmx.NoOpJmxManager; |
| 47 | +import com.linkedin.d2.jmx.XdsClientOtelMetricsProvider; |
| 48 | +import com.linkedin.d2.jmx.NoOpXdsClientOtelMetricsProvider; |
47 | 49 | import com.linkedin.r2.transport.common.TransportClientFactory; |
48 | 50 | import io.grpc.netty.shaded.io.netty.handler.ssl.SslContext; |
49 | 51 | import java.time.Duration; |
@@ -181,6 +183,12 @@ public class D2ClientConfig |
181 | 183 |
|
182 | 184 | public boolean subscribeToUriGlobCollection = false; |
183 | 185 | public XdsServerMetricsProvider _xdsServerMetricsProvider = new NoOpXdsServerMetricsProvider(); |
| 186 | + |
| 187 | + /** |
| 188 | + * Provider for OpenTelemetry metrics collection for XDS client operations. |
| 189 | + * Defaults to no-op implementation; can be overridden to enable metric tracking. |
| 190 | + */ |
| 191 | + public XdsClientOtelMetricsProvider xdsClientOtelMetricsProvider = new NoOpXdsClientOtelMetricsProvider(); |
184 | 192 | public boolean loadBalanceStreamException = false; |
185 | 193 | public boolean xdsInitialResourceVersionsEnabled = false; |
186 | 194 | public Integer xdsStreamMaxRetryBackoffSeconds = null; |
@@ -293,6 +301,145 @@ public D2ClientConfig() |
293 | 301 | D2CalleeInfoRecorder d2CalleeInfoRecorder, |
294 | 302 | Boolean enableIndisDownstreamServicesFetcher, |
295 | 303 | Duration indisDownstreamServicesFetchTimeout) |
| 304 | + { |
| 305 | + this(zkHosts, xdsServer, hostName, zkSessionTimeoutInMs, zkStartupTimeoutInMs, lbWaitTimeout, lbWaitUnit, |
| 306 | + flagFile, basePath, fsBasePath, indisFsBasePath, componentFactory, clientFactories, lbWithFacilitiesFactory, |
| 307 | + sslContext, grpcSslContext, sslParameters, isSSLEnabled, shutdownAsynchronously, isSymlinkAware, |
| 308 | + clientServicesConfig, d2ServicePath, useNewEphemeralStoreWatcher, healthCheckOperations, executorService, |
| 309 | + retry, restRetryEnabled, streamRetryEnabled, retryLimit, retryUpdateIntervalMs, retryAggregatedIntervalNum, |
| 310 | + warmUp, warmUpTimeoutSeconds, indisWarmUpTimeoutSeconds, warmUpConcurrentRequests, |
| 311 | + indisWarmUpConcurrentRequests, downstreamServicesFetcher, indisDownstreamServicesFetcher, |
| 312 | + backupRequestsEnabled, backupRequestsStrategyStatsConsumer, |
| 313 | + backupRequestsLatencyNotificationInterval, |
| 314 | + backupRequestsLatencyNotificationIntervalUnit, |
| 315 | + enableBackupRequestsClientAsync, |
| 316 | + backupRequestsExecutorService, |
| 317 | + emitter, |
| 318 | + partitionAccessorRegistry, |
| 319 | + zooKeeperDecorator, |
| 320 | + enableSaveUriDataOnDisk, |
| 321 | + loadBalancerStrategyFactories, |
| 322 | + requestTimeoutHandlerEnabled, |
| 323 | + sslSessionValidatorFactory, |
| 324 | + zkConnection, |
| 325 | + startUpExecutorService, |
| 326 | + indisStartUpExecutorService, |
| 327 | + jmxManager, |
| 328 | + d2JmxManagerPrefix, |
| 329 | + zookeeperReadWindowMs, |
| 330 | + enableRelativeLoadBalancer, |
| 331 | + deterministicSubsettingMetadataProvider, |
| 332 | + canaryDistributionProvider, |
| 333 | + enableClusterFailout, |
| 334 | + failoutConfigProviderFactory, |
| 335 | + failoutRedirectStrategy, |
| 336 | + serviceDiscoveryEventEmitter, |
| 337 | + dualReadStateManager, |
| 338 | + xdsExecutorService, |
| 339 | + xdsStreamReadyTimeout, |
| 340 | + dualReadNewLbExecutor, |
| 341 | + xdsChannelLoadBalancingPolicy, |
| 342 | + xdsChannelLoadBalancingPolicyConfig, |
| 343 | + subscribeToUriGlobCollection, |
| 344 | + xdsServerMetricsProvider, |
| 345 | + loadBalanceStreamException, |
| 346 | + xdsInitialResourceVersionsEnabled, |
| 347 | + disableDetectLiRawD2Client, |
| 348 | + isLiRawD2Client, |
| 349 | + xdsStreamMaxRetryBackoffSeconds, |
| 350 | + xdsChannelKeepAliveTimeMins, |
| 351 | + xdsMinimumJavaVersion, |
| 352 | + actionOnPrecheckFailure, |
| 353 | + d2CalleeInfoRecorder, |
| 354 | + enableIndisDownstreamServicesFetcher, |
| 355 | + indisDownstreamServicesFetchTimeout, |
| 356 | + new NoOpXdsClientOtelMetricsProvider()); |
| 357 | + } |
| 358 | + |
| 359 | + D2ClientConfig(String zkHosts, |
| 360 | + String xdsServer, |
| 361 | + String hostName, |
| 362 | + long zkSessionTimeoutInMs, |
| 363 | + long zkStartupTimeoutInMs, |
| 364 | + long lbWaitTimeout, |
| 365 | + TimeUnit lbWaitUnit, |
| 366 | + String flagFile, |
| 367 | + String basePath, |
| 368 | + String fsBasePath, |
| 369 | + String indisFsBasePath, |
| 370 | + ComponentFactory componentFactory, |
| 371 | + Map<String, TransportClientFactory> clientFactories, |
| 372 | + LoadBalancerWithFacilitiesFactory lbWithFacilitiesFactory, |
| 373 | + SSLContext sslContext, |
| 374 | + SslContext grpcSslContext, |
| 375 | + SSLParameters sslParameters, |
| 376 | + boolean isSSLEnabled, |
| 377 | + boolean shutdownAsynchronously, |
| 378 | + boolean isSymlinkAware, |
| 379 | + Map<String, Map<String, Object>> clientServicesConfig, |
| 380 | + String d2ServicePath, |
| 381 | + boolean useNewEphemeralStoreWatcher, |
| 382 | + HealthCheckOperations healthCheckOperations, |
| 383 | + ScheduledExecutorService executorService, |
| 384 | + boolean retry, |
| 385 | + boolean restRetryEnabled, |
| 386 | + boolean streamRetryEnabled, |
| 387 | + int retryLimit, |
| 388 | + long retryUpdateIntervalMs, |
| 389 | + int retryAggregatedIntervalNum, |
| 390 | + boolean warmUp, |
| 391 | + int warmUpTimeoutSeconds, |
| 392 | + int indisWarmUpTimeoutSeconds, |
| 393 | + int warmUpConcurrentRequests, |
| 394 | + int indisWarmUpConcurrentRequests, |
| 395 | + DownstreamServicesFetcher downstreamServicesFetcher, |
| 396 | + DownstreamServicesFetcher indisDownstreamServicesFetcher, |
| 397 | + boolean backupRequestsEnabled, |
| 398 | + BackupRequestsStrategyStatsConsumer backupRequestsStrategyStatsConsumer, |
| 399 | + long backupRequestsLatencyNotificationInterval, |
| 400 | + TimeUnit backupRequestsLatencyNotificationIntervalUnit, |
| 401 | + boolean enableBackupRequestsClientAsync, |
| 402 | + ScheduledExecutorService backupRequestsExecutorService, |
| 403 | + EventEmitter emitter, |
| 404 | + PartitionAccessorRegistry partitionAccessorRegistry, |
| 405 | + Function<ZooKeeper, ZooKeeper> zooKeeperDecorator, |
| 406 | + boolean enableSaveUriDataOnDisk, |
| 407 | + Map<String, LoadBalancerStrategyFactory<? extends LoadBalancerStrategy>> loadBalancerStrategyFactories, |
| 408 | + boolean requestTimeoutHandlerEnabled, |
| 409 | + SslSessionValidatorFactory sslSessionValidatorFactory, |
| 410 | + ZKPersistentConnection zkConnection, |
| 411 | + ScheduledExecutorService startUpExecutorService, |
| 412 | + ScheduledExecutorService indisStartUpExecutorService, |
| 413 | + JmxManager jmxManager, |
| 414 | + String d2JmxManagerPrefix, |
| 415 | + int zookeeperReadWindowMs, |
| 416 | + boolean enableRelativeLoadBalancer, |
| 417 | + DeterministicSubsettingMetadataProvider deterministicSubsettingMetadataProvider, |
| 418 | + CanaryDistributionProvider canaryDistributionProvider, |
| 419 | + boolean enableClusterFailout, |
| 420 | + FailoutConfigProviderFactory failoutConfigProviderFactory, |
| 421 | + FailoutRedirectStrategy failoutRedirectStrategy, |
| 422 | + ServiceDiscoveryEventEmitter serviceDiscoveryEventEmitter, |
| 423 | + DualReadStateManager dualReadStateManager, |
| 424 | + ScheduledExecutorService xdsExecutorService, |
| 425 | + Long xdsStreamReadyTimeout, |
| 426 | + ExecutorService dualReadNewLbExecutor, |
| 427 | + String xdsChannelLoadBalancingPolicy, |
| 428 | + Map<String, ?> xdsChannelLoadBalancingPolicyConfig, |
| 429 | + boolean subscribeToUriGlobCollection, |
| 430 | + XdsServerMetricsProvider xdsServerMetricsProvider, |
| 431 | + boolean loadBalanceStreamException, |
| 432 | + boolean xdsInitialResourceVersionsEnabled, |
| 433 | + boolean disableDetectLiRawD2Client, |
| 434 | + boolean isLiRawD2Client, |
| 435 | + Integer xdsStreamMaxRetryBackoffSeconds, |
| 436 | + Long xdsChannelKeepAliveTimeMins, |
| 437 | + String xdsMinimumJavaVersion, |
| 438 | + XdsClientValidator.ActionOnPrecheckFailure actionOnPrecheckFailure, |
| 439 | + D2CalleeInfoRecorder d2CalleeInfoRecorder, |
| 440 | + Boolean enableIndisDownstreamServicesFetcher, |
| 441 | + Duration indisDownstreamServicesFetchTimeout, |
| 442 | + XdsClientOtelMetricsProvider xdsClientOtelMetricsProvider) |
296 | 443 | { |
297 | 444 | this.zkHosts = zkHosts; |
298 | 445 | this.xdsServer = xdsServer; |
@@ -377,5 +524,6 @@ public D2ClientConfig() |
377 | 524 | this.d2CalleeInfoRecorder = d2CalleeInfoRecorder; |
378 | 525 | this.indisDownstreamServicesFetchTimeout = indisDownstreamServicesFetchTimeout; |
379 | 526 | this.enableIndisDownstreamServicesFetcher = enableIndisDownstreamServicesFetcher; |
| 527 | + this.xdsClientOtelMetricsProvider = xdsClientOtelMetricsProvider; |
380 | 528 | } |
381 | 529 | } |
0 commit comments