Skip to content

feat(worker-proxy): instrument extension gRPC calls - #11962

Open
Jacob Viau (jviau) wants to merge 2 commits into
u/jviau/extension-grpc-ingressfrom
u/jviau/extension-grpc-telemetry
Open

feat(worker-proxy): instrument extension gRPC calls#11962
Jacob Viau (jviau) wants to merge 2 commits into
u/jviau/extension-grpc-ingressfrom
u/jviau/extension-grpc-telemetry

Conversation

@jviau

Copy link
Copy Markdown
Contributor

Issue describing the changes in this PR

N/A — final layer 4 of the WorkerProxy extension-RPC port, stacked on preceding PR #11961.

Pull request checklist

IMPORTANT: Currently, changes must be backported to the in-proc branch to be included in Core Tools and non-Flex deployments.

  • Backporting to the in-proc branch is not required
    • Otherwise: Link to backporting PR
  • My changes do not require documentation changes
    • Otherwise: Documentation issue linked to PR
  • My changes should not be added to the release notes for the next release
    • Otherwise: I've added my notes to release_notes.md
  • My changes do not need to be backported to a previous version
    • Otherwise: Backport tracked by issue/PR #issue_or_pr
  • My changes do not require diagnostic events changes
    • Otherwise: I have added/updated all related diagnostic events and their documentation (Documentation issue linked to PR)
  • I have added all required tests (Unit tests, E2E tests)

Additional information

Final layer 4 adds WorkerProxy extension gRPC metrics and activity enrichment. It follows preceding PR #11961 and preserves the transport behavior introduced by the earlier stack layers.

@jviau
Jacob Viau (jviau) requested a review from a team as a code owner September 1, 2026 21:37
@jviau Jacob Viau (jviau) added the compute-separation Compute separation / external worker support label Sep 1, 2026
Copilot AI lite review requested due to automatic review settings September 2, 2026 16:10
@jviau
Jacob Viau (jviau) force-pushed the u/jviau/extension-grpc-telemetry branch from e3e3810 to 3e9bef3 Compare September 2, 2026 16:10

Copilot AI left a comment

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.

🟡 Changes recommended

It introduces avoidable per-call allocations in activity tag keys and leaves test-created Meter instances undisposed, both of which should be corrected before merging.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR adds transport-level telemetry for WorkerProxy’s extension gRPC ingress, introducing metrics instruments and enriching request activities with correlation/concurrency tags to support observability of proxied extension RPC calls.

Changes:

  • Register and emit extension gRPC metrics (active calls, call-open duration, total call duration).
  • Enrich current Activity with extension RPC call/stream identifiers and active-call counts.
  • Add unit tests validating metric instruments and activity tag enrichment.
File summaries
File Description
test/Functions.WorkerProxy.Tests/ExtensionGrpcMetricsTests.cs Adds a MeterListener-based test to validate emitted metric measurements.
test/Functions.WorkerProxy.Tests/ExtensionGrpcIngressTests.cs Extends ingress tests to validate activity tags and wires metrics into ingress construction.
src/Functions.WorkerProxy/WorkerProxyApplication.cs Registers metrics services and the new ExtensionGrpcMetrics singleton in DI.
src/Functions.WorkerProxy/ExtensionGrpcMetrics.cs Introduces Meter instruments (histograms + up/down counter) for extension gRPC transport measurements.
src/Functions.WorkerProxy/ExtensionGrpcIngress.cs Records metrics and enriches activity when calls open/complete.
src/Functions.WorkerProxy/ExtensionGrpcActivity.cs Adds helpers to stamp activity tags for call correlation and concurrency snapshots.
Review details
  • Files reviewed: 6/6 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +390 to +397
private sealed class TestMeterFactory : IMeterFactory
{
public Meter Create(MeterOptions options) => new(options);

public void Dispose()
{
}
}
Comment on lines +23 to +36
Activity? activity = Activity.Current;
activity?.SetTag($"{TagPrefix}.call_id", callId);
activity?.SetTag($"{TagPrefix}.stream_id", streamId);
activity?.SetTag($"{TagPrefix}.active_calls_at_open", activeCallCount);
}

/// <summary>
/// Enriches the current activity with an extension call's final concurrency snapshot.
/// </summary>
/// <param name="activeCallCount">The active-call count when the call completes.</param>
public static void CallCompleted(int activeCallCount)
{
Activity? activity = Activity.Current;
activity?.SetTag($"{TagPrefix}.active_calls_at_completion", activeCallCount);
@jviau
Jacob Viau (jviau) force-pushed the u/jviau/extension-grpc-telemetry branch from 3e9bef3 to b94a85b Compare September 2, 2026 17:20
@jviau
Jacob Viau (jviau) force-pushed the u/jviau/extension-grpc-telemetry branch from b94a85b to 79c9809 Compare September 2, 2026 18:27
@jviau
Jacob Viau (jviau) force-pushed the u/jviau/extension-grpc-telemetry branch from 79c9809 to 650732e Compare September 4, 2026 23:52
@jviau
Jacob Viau (jviau) force-pushed the u/jviau/extension-grpc-telemetry branch from 650732e to d1f45ff Compare September 5, 2026 00:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

compute-separation Compute separation / external worker support

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants