Skip to content

Conversation

@martincostello
Copy link
Member

Changes

While working on #6875 I noticed a few improvements that could be made to the ASP.NET Core example application, as well as some issues with the Docker Compose setup to run the OTel Collector and a TODO for adding something to view OTLP Logs.

Specific changes:

  • Use async instead of .Result.
  • Use HttpClientFactory.
  • Remove separate logging class for the logging source generator.
  • Fix traces not rendering.
  • Add Loki to display OTLP logs in Grafana.

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)

@github-actions github-actions bot added the documentation Documentation related label Feb 6, 2026
@codecov
Copy link

codecov bot commented Feb 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.26%. Comparing base (3f3db37) to head (36ab567).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #6877      +/-   ##
==========================================
+ Coverage   87.21%   87.26%   +0.04%     
==========================================
  Files         263      263              
  Lines       12385    12385              
==========================================
+ Hits        10802    10808       +6     
+ Misses       1583     1577       -6     
Flag Coverage Δ
unittests-Project-Experimental 87.17% <ø> (+0.06%) ⬆️
unittests-Project-Stable 87.10% <ø> (+0.08%) ⬆️

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

martincostello and others added 5 commits February 6, 2026 11:36
- Use async instead of `.Result`.
- Use HttpClientFactory.
- Remove separate logging class.
Fix traces not rendering.
Add Loki to display OTLP logs in Grafana.
Without `http://` the scheme was being read as the container hostname.
Fix inaccurate comment.
@martincostello martincostello force-pushed the aspnet-core-example-improvements branch from 2c1500e to 36ab567 Compare February 6, 2026 10:36
@martincostello martincostello marked this pull request as ready for review February 6, 2026 10:54
@martincostello martincostello requested a review from a team as a code owner February 6, 2026 10:54
Copilot AI review requested due to automatic review settings February 6, 2026 10:54
Copy link

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 pull request improves the ASP.NET Core example application by modernizing the code patterns, fixing infrastructure configuration issues that prevented traces from rendering, and adding support for viewing OTLP logs through Loki in Grafana.

Changes:

  • Modernized C# code to use async/await patterns and HttpClientFactory
  • Fixed OpenTelemetry Collector configuration to use HTTP protocol for trace export to Tempo
  • Added Loki service for log aggregation with OTLP support and Grafana integration

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
examples/AspNetCore/Program.cs Added HttpClient registration for dependency injection
examples/AspNetCore/Examples.AspNetCore.csproj Suppressed CA2007 warning (ConfigureAwait) for async code
examples/AspNetCore/Controllers/WeatherForecastController.cs Converted to async/await, injected HttpClient, consolidated logging source generator into nested class
examples/AspNetCore/Controllers/WeatherForecastControllerLog.cs Removed separate logging file (consolidated into controller)
examples/AspNetCore/tempo.yaml Added ingester, memberlist, and metrics_generator configuration for faster trace processing
examples/AspNetCore/otel-collector.yaml Changed trace exporter from GRPC to HTTP protocol, added batch processor and Loki log exporter
examples/AspNetCore/loki.yaml New Loki configuration file for log storage
examples/AspNetCore/grafana-datasources.yaml Added Loki datasource configuration
examples/AspNetCore/docker-compose.yaml Added Loki service container
examples/AspNetCore/README.md Updated documentation to include Loki
.gitignore Added loki-data directory to ignore list

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

@martincostello martincostello mentioned this pull request Feb 6, 2026
4 tasks
@rajkumar-rangaraj rajkumar-rangaraj added this pull request to the merge queue Feb 6, 2026
from metrics to traces)
- **Tempo** to store traces // TODO: Add a logging store also.
- **Tempo** to store traces
- **Loki** to store logs
Copy link
Member

Choose a reason for hiding this comment

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

💯 Thank you!
(There were lot of discussions about what tool are allowed vs not-allowed in the past! I really wanted to have this in)

Hoping to test exemplars with the full setup soon.

Merged via the queue into open-telemetry:main with commit 6180ae3 Feb 6, 2026
52 checks passed
@martincostello martincostello deleted the aspnet-core-example-improvements branch February 6, 2026 17:25
martincostello added a commit to martincostello/opentelemetry-dotnet that referenced this pull request Feb 6, 2026
@martincostello martincostello mentioned this pull request Feb 6, 2026
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Documentation related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants