Skip to content

[AspNetCore] Simplify benchmarks and add gRPC#4091

Open
martincostello wants to merge 3 commits intoopen-telemetry:mainfrom
martincostello:simplify-aspnetcode-benchmarks
Open

[AspNetCore] Simplify benchmarks and add gRPC#4091
martincostello wants to merge 3 commits intoopen-telemetry:mainfrom
martincostello:simplify-aspnetcode-benchmarks

Conversation

@martincostello
Copy link
Copy Markdown
Member

@martincostello martincostello commented Apr 11, 2026

Changes

Add simpler benchmarks for HTTP and gRPC using the ASP.NET Core test server extracted from #4090.

  • TestHost is used to remove real network calls.
  • Old mostly-identical benchmarks removed.
  • gRPC benchmark added.

Benchmark Results

BenchmarkDotNet v0.15.8, Windows 11 (10.0.26200.8117/25H2/2025Update/HudsonValley2)
13th Gen Intel Core i7-13700H 2.90GHz, 1 CPU, 20 logical and 14 physical cores
.NET SDK 10.0.201
  [Host]     : .NET 10.0.5 (10.0.5, 10.0.526.15411), X64 RyuJIT x86-64-v3
  DefaultJob : .NET 10.0.5 (10.0.5, 10.0.526.15411), X64 RyuJIT x86-64-v3
Method EnableInstrumentation Mean Error StdDev Gen0 Allocated
HttpGet None 4.686 μs 0.0725 μs 0.0643 μs 0.5493 7.3 KB
GrpcGet None 21.338 μs 0.4267 μs 0.9366 μs 1.0986 13.85 KB
HttpGet Traces 7.113 μs 0.1409 μs 0.3266 μs 0.6714 8.26 KB
GrpcGet Traces 27.212 μs 0.5317 μs 0.8884 μs 1.2207 15.99 KB
HttpGet Metrics 6.691 μs 0.1428 μs 0.4119 μs 0.6104 7.43 KB
GrpcGet Metrics 25.639 μs 0.4991 μs 0.6663 μs 1.0986 13.99 KB
HttpGet Traces, Metrics 9.850 μs 0.2285 μs 0.6556 μs 0.7324 9.11 KB
GrpcGet Traces, Metrics 27.238 μs 0.5445 μs 0.8637 μs 1.2207 16.12 KB

Merge requirement checklist

  • CONTRIBUTING guidelines followed (license requirements, nullable enabled, static analysis, etc.)
  • Unit tests added/updated
  • Appropriate CHANGELOG.md files updated for non-trivial changes
  • Changes in public API reviewed (if applicable)

Add simpler benchmarks for HTTP and gRPC using the ASP.NET Core test server.
@github-actions github-actions bot added infra Infra work - CI/CD, code coverage, linters dependencies Pull requests that update a dependency file perf Performance related comp:instrumentation.aspnetcore Things related to OpenTelemetry.Instrumentation.AspNetCore labels Apr 11, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.69%. Comparing base (df6d38d) to head (d938c99).
✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4091      +/-   ##
==========================================
- Coverage   72.93%   72.69%   -0.24%     
==========================================
  Files         452      460       +8     
  Lines       17844    17886      +42     
==========================================
- Hits        13014    13003      -11     
- Misses       4830     4883      +53     
Flag Coverage Δ
unittests-Contrib.Shared.Tests 89.74% <ø> (ø)
unittests-Exporter.Geneva 54.84% <ø> (-0.31%) ⬇️
unittests-Exporter.InfluxDB 95.81% <ø> (ø)
unittests-Exporter.Instana 74.86% <ø> (ø)
unittests-Exporter.OneCollector 94.61% <ø> (ø)
unittests-Extensions 90.65% <ø> (ø)
unittests-Extensions.Enrichment 100.00% <ø> (ø)
unittests-Extensions.Enrichment.AspNetCore 86.27% <ø> (ø)
unittests-Extensions.Enrichment.Http 94.33% <ø> (ø)
unittests-Instrumentation.AWS 83.54% <ø> (ø)
unittests-Instrumentation.AspNet 76.61% <ø> (ø)
unittests-Instrumentation.AspNetCore 70.44% <ø> (ø)
unittests-Instrumentation.Cassandra 23.52% <ø> (?)
unittests-Instrumentation.ConfluentKafka 39.83% <ø> (ø)
unittests-Instrumentation.ElasticsearchClient 80.60% <ø> (ø)
unittests-Instrumentation.EntityFrameworkCore 80.80% <ø> (ø)
unittests-Instrumentation.EventCounters 77.27% <ø> (ø)
unittests-Instrumentation.GrpcCore 91.42% <ø> (ø)
unittests-Instrumentation.GrpcNetClient 73.78% <ø> (ø)
unittests-Instrumentation.Hangfire 86.05% <ø> (ø)
unittests-Instrumentation.Http 74.62% <ø> (ø)
unittests-Instrumentation.Owin 88.62% <ø> (ø)
unittests-Instrumentation.Process 100.00% <ø> (ø)
unittests-Instrumentation.Quartz 78.76% <ø> (ø)
unittests-Instrumentation.Runtime 100.00% <ø> (ø)
unittests-Instrumentation.ServiceFabricRemoting 34.68% <ø> (ø)
unittests-Instrumentation.SqlClient 85.21% <ø> (ø)
unittests-Instrumentation.StackExchangeRedis 71.98% <ø> (ø)
unittests-Instrumentation.Wcf 79.68% <ø> (ø)
unittests-OpAmp.Client 78.78% <ø> (+0.49%) ⬆️
unittests-PersistentStorage 68.19% <ø> (-1.97%) ⬇️
unittests-Resources.AWS 74.34% <ø> (ø)
unittests-Resources.Azure 85.31% <ø> (ø)
unittests-Resources.Container 67.34% <ø> (ø)
unittests-Resources.Gcp 71.42% <ø> (ø)
unittests-Resources.Host 72.26% <ø> (ø)
unittests-Resources.OperatingSystem 76.98% <ø> (ø)
unittests-Resources.Process 100.00% <ø> (ø)
unittests-Resources.ProcessRuntime 79.59% <ø> (ø)
unittests-Sampler.AWS 94.28% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.
see 13 files with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@martincostello martincostello marked this pull request as ready for review April 11, 2026 17:34
@martincostello martincostello requested a review from a team as a code owner April 11, 2026 17:34
Copilot AI review requested due to automatic review settings April 11, 2026 17:34
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR simplifies the ASP.NET Core instrumentation benchmark suite by switching to ASP.NET Core TestServer (to avoid real network calls), consolidating the old duplicated benchmark classes into a single benchmark type, and adding a gRPC benchmark path.

Changes:

  • Replaced the old HTTP-only benchmark classes with a single AspNetCoreBenchmarks benchmark using TestServer.
  • Added gRPC benchmarking support (proto + in-process gRPC service/client).
  • Added Microsoft.AspNetCore.TestHost to central package versions and updated benchmark project dependencies accordingly.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test/OpenTelemetry.Instrumentation.AspNetCore.Benchmarks/Proto/greet.proto Adds a small gRPC proto definition used by the new benchmark.
test/OpenTelemetry.Instrumentation.AspNetCore.Benchmarks/Program.cs Simplifies the benchmark entrypoint using top-level statements and targets the new benchmark assembly.
test/OpenTelemetry.Instrumentation.AspNetCore.Benchmarks/OpenTelemetry.Instrumentation.AspNetCore.Benchmarks.csproj Adds protobuf generation + gRPC/TestHost/OpenTelemetry dependencies required by the new benchmark.
test/OpenTelemetry.Instrumentation.AspNetCore.Benchmarks/Instrumentation/AspNetCoreInstrumentationNewBenchmarks.cs Removes legacy benchmark implementation.
test/OpenTelemetry.Instrumentation.AspNetCore.Benchmarks/Instrumentation/AspNetCoreInstrumentationBenchmarks.cs Removes legacy benchmark implementation.
test/OpenTelemetry.Instrumentation.AspNetCore.Benchmarks/AspNetCoreBenchmarks.cs Introduces consolidated HTTP + gRPC benchmark using TestServer.
Directory.Packages.props Adds central package versions for Microsoft.AspNetCore.TestHost across net8/net9/net10 conditions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Ensure the metrics pipeline is active.
Update the README and fix the formatting.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp:instrumentation.aspnetcore Things related to OpenTelemetry.Instrumentation.AspNetCore dependencies Pull requests that update a dependency file infra Infra work - CI/CD, code coverage, linters perf Performance related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants