Skip to content

Conversation

@aadityaraj7769
Copy link

Summary

This PR adds OpenTelemetry (OTel) metrics instrumentation to the XDS Client.

Changes

  • New Interface: Added XdsClientOtelMetricsProvider interface for collecting XDS client metrics via OpenTelemetry

    • Connection lifecycle events (connection lost, closed, reconnection)
    • Request/response tracking
    • Error tracking (resource not found, invalid resource)
    • Server latency measurements
    • Connection state monitoring
    • Initial wait time tracking for resource fetching
  • No-op Implementation: Added NoOpXdsClientOtelMetricsProvider as default implementation when metrics are disabled

  • Integration:

    • Integrated metrics provider into XdsClientImpl constructor with dependency injection pattern
    • Added metrics recording throughout XDS client lifecycle (connection events, resource updates, latency tracking)
    • Metrics provider passed to XdsClientJmx for JMX integration
    • Added builder support in D2ClientBuilder via setXdsClientOtelMetricsProvider()
  • Metrics Tracked:

    • Counters: connection events, requests/responses, errors (not found/invalid resources), IRV sent count
    • Histogram: server latency
    • Gauges: connection state, active initial wait time

Testing

  • Updated test fixtures to mock the new metrics provider

Backward Compatibility

  • Fully backward compatible - defaults to no-op provider when not configured
  • Uses constructor-based dependency injection following existing patterns (similar to XdsServerMetricsProvider)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant