Add OpenTelemetry metrics support for RelativeLoadBalancerStrategy#1146
Draft
aadityaraj7769 wants to merge 8 commits intolinkedin:masterfrom
Draft
Add OpenTelemetry metrics support for RelativeLoadBalancerStrategy#1146aadityaraj7769 wants to merge 8 commits intolinkedin:masterfrom
aadityaraj7769 wants to merge 8 commits intolinkedin:masterfrom
Conversation
…gy-otel-migration
…ttps://github.com/aadityaraj7769/rest.li into adiraj/relativeloadbalancerstrategy-otel-migration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds OpenTelemetry (OTel) metrics instrumentation to the RelativeLoadBalancerStrategy.
Changes
No-op Implementation: Added NoOpRelativeLoadBalancerStrategyOtelMetricsProvider as default implementation when metrics are disabled
Integration:
Backward Compatibility
About RelativeLoadBalancerStrategySensor
The RelativeLoadBalancerStrategy Sensor tracks metrics for D2's relative load balancer, which dynamically adjusts host health scores (0.0–1.0) based on per-host call statistics relative to the overall cluster. It monitors host latency distributions, cluster health composition, and hash ring sizing. This sensor enables server-side observability for how traffic is being distributed across hosts in a service cluster.
New OTel Metrics
Metric Naming Pattern: `D2.RelativeLb.<Metric>
Dimensions
D2.Service.NameD2.Schemehttp,https)D2.Host.Status"Unhealthy"or"Quarantine"DegradedHostsCountonlyExponentialHistogram
D2.RelativeLb.HostLatency(ms) — Records each host's average latency per call. OTel automatically computes p50, p90, p99, average, min, max, and standard deviation from the distribution.Gauges
D2.RelativeLb.AllPartitionHostsCount({host}) — Total number of hosts across all partitions regardless of health status; the full host population the load balancer is aware ofD2.RelativeLb.DegradedHostsCount({host}) — Number of hosts in a degraded state, grouped byD2.Host.Status:D2.Host.Status = "Unhealthy"— hosts whose health score has been reduced due to high latency or error rateD2.Host.Status = "Quarantine"— hosts currently in quarantine pending health check recoveryD2.RelativeLb.PointsInHashRing({point}) — Total number of points in the consistent hash ring, reflecting the effective traffic weight distribution across hosts