Skip to content

stats/otel: a79 scaffolding to register an async gauge metric and api to record it- part 3#8780

Merged
mbissa merged 8 commits intogrpc:masterfrom
mbissa:a79-async-gauge-metrics-with-leak-check
Jan 5, 2026
Merged

stats/otel: a79 scaffolding to register an async gauge metric and api to record it- part 3#8780
mbissa merged 8 commits intogrpc:masterfrom
mbissa:a79-async-gauge-metrics-with-leak-check

Conversation

@mbissa
Copy link
Copy Markdown
Contributor

@mbissa mbissa commented Dec 19, 2025

This change is the third part of the scaffolding required to support asynchronous metrics (e.g., OpenTelemetry Observable Gauges). It updates the MetricsRecorder interface to support registering asynchronous metric reporters and wires up the corresponding logic in the OpenTelemetry implementation.

RELEASE NOTES:

  • experimental/stats: Updated the MetricsRecorder interface with mustEmbedUnimplementedMetricsRecorder that is provided by a new Noop struct UnimplementedMetricsRecorder which needs to be embedded going forward in all implementations of MetricsRecorder.

  • stats/otel: Enabled support for registering asynchronous metric reporters via the MetricsRecorder interface.

@mbissa mbissa added this to the 1.79 Release milestone Dec 19, 2025
@mbissa mbissa self-assigned this Dec 19, 2025
@mbissa mbissa added Type: Feature New features or improvements in behavior Area: Observability Includes Stats, Tracing, Channelz, Healthz, Binlog, Reflection, Admin, GCP Observability labels Dec 19, 2025
@codecov
Copy link
Copy Markdown

codecov bot commented Dec 19, 2025

Codecov Report

❌ Patch coverage is 67.92453% with 34 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.24%. Comparing base (2d51986) to head (b368faf).
⚠️ Report is 5 commits behind head on master.

Files with missing lines Patch % Lines
stats/opentelemetry/opentelemetry.go 61.22% 13 Missing and 6 partials ⚠️
experimental/stats/metrics.go 12.50% 7 Missing ⚠️
internal/leakcheck/leakcheck.go 90.24% 2 Missing and 2 partials ⚠️
internal/grpctest/grpctest.go 50.00% 1 Missing and 1 partial ⚠️
internal/internal.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8780      +/-   ##
==========================================
- Coverage   83.47%   83.24%   -0.23%     
==========================================
  Files         419      418       -1     
  Lines       32595    33004     +409     
==========================================
+ Hits        27208    27475     +267     
- Misses       4017     4114      +97     
- Partials     1370     1415      +45     
Files with missing lines Coverage Δ
internal/stats/metrics_recorder_list.go 80.70% <100.00%> (+0.70%) ⬆️
internal/testutils/stats/test_metrics_recorder.go 84.05% <ø> (+5.00%) ⬆️
internal/grpctest/grpctest.go 73.80% <50.00%> (-2.51%) ⬇️
internal/internal.go 60.00% <0.00%> (-40.00%) ⬇️
internal/leakcheck/leakcheck.go 90.04% <90.24%> (+0.04%) ⬆️
experimental/stats/metrics.go 25.00% <12.50%> (+25.00%) ⬆️
stats/opentelemetry/opentelemetry.go 75.12% <61.22%> (-3.36%) ⬇️

... and 35 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mbissa mbissa requested a review from arjan-bal December 19, 2025 12:58
@mbissa mbissa force-pushed the a79-async-gauge-metrics-with-leak-check branch from 942656f to 6d78be5 Compare December 19, 2025 19:58
@arjan-bal arjan-bal removed their assignment Dec 24, 2025
@mbissa mbissa force-pushed the a79-async-gauge-metrics-with-leak-check branch from 26bc587 to e1c3b2e Compare December 25, 2025 23:00
@arjan-bal arjan-bal removed their assignment Jan 2, 2026
@mbissa mbissa assigned arjan-bal and unassigned mbissa Jan 5, 2026
Copy link
Copy Markdown
Contributor

@arjan-bal arjan-bal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

}

func TestLeakChecker_DetectsLeak(t *testing.T) {
// 1. Setup the tracker (swaps the delegate in internal).
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Please avoid putting numbers in the comments. The step numbers may go out of sync with the code when it's changed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will be doing this in follow up PR.

@arjan-bal arjan-bal assigned mbissa and unassigned arjan-bal Jan 5, 2026
@mbissa mbissa merged commit c6d5e5e into grpc:master Jan 5, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: Observability Includes Stats, Tracing, Channelz, Healthz, Binlog, Reflection, Admin, GCP Observability Type: Feature New features or improvements in behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants