.NET API Project Guide

Complete instrumentation and rollout for ASP.NET APIs

Use this guide for ASP.NET APIs where reliability depends on visibility into controllers, services, and outbound dependencies.

Architecture Scope

  • HTTP middleware and endpoint pipeline.
  • Service/repository layers.
  • Outbound HTTP, DB, and message clients.
  1. Initialize SDK during host startup.
  2. Instrument middleware boundaries.
  3. Capture structured exceptions.
  4. Instrument outbound dependencies with spans.

Minimum Data Contract

  • Stable service, env, version tags.
  • Endpoint/operation naming consistency.
  • Deploy metadata from CI/CD.

Validation Checklist

  • Request telemetry visible with status and latency.
  • Exception telemetry trace-linked.
  • Host shutdown flushes pending events.

Production Hardening

  1. Flush on IHostApplicationLifetime stop token.
  2. Keep retry bounded and monitored.
  3. Validate after runtime/package upgrades.

Troubleshooting

  • Missing telemetry after startup changes: confirm host init path.
  • Missing outbound spans: wrap HttpClient/DB calls.
  • Volume spikes: review emission points and sampling.

On this page