[OpenTelemetry] Support opt-in capture of request and response headers
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- csharp
- Ambito
- backend, observability
Direzione di ricerca
Start by reading the hosting code around CreateInitializeActivityTags, then trace where the Activity stops and how SuppressActivityOpenTelemetryData is applied. The issue describes separate opt-in request and response header lists, with request values available at sampling time. Done means the agreed configuration surface and header capture behavior are implemented; the issue leaves those design choices open.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Is there an existing issue for this?
- I have searched the existing issues
Is your feature request related to a problem? Please describe the problem.
I want to capture selected request and response headers on the hosting Activity, as http.request.header.<key> and http.response.header.<key>, and have request headers available to samplers. ASP.NET Core has no way to do this today.
- The semantic conventions define both attributes as stable, opt-in string arrays. They say "Instrumentations SHOULD require an explicit configuration of which headers are to be captured".
- For HTTP server spans,
http.request.header.<key>is one of the attributes that "SHOULD be provided at span creation time (if provided at all)" for sampling (http-spans). Enrichcallbacks inOpenTelemetry.Instrumentation.AspNetCoreand custom listeners both run after theActivityis created and sampled, so headers can't drive sampling decisions.
Describe the solution you'd like
Opt-in header capture in hosting, targeting .NET 12. Would this be accepted? I'm happy to contribute the implementation.
- Two configurable lists of header names, one for request headers and one for response headers. Both are empty by default, so nothing is captured and nothing changes.
- Names are matched exactly, case-insensitively, with no wildcards
- Request headers are added in
CreateInitializeActivityTagsashttp.request.header.<lower-cased-name>with string-array values, so they are available to samplers. - Response headers are added when the
Activitystops, ashttp.response.header.<lower-cased-name>. - Both respect
SuppressActivityOpenTelemetryData.
Creation tags are added even when the request isn't sampled, so a configured list costs one header lookup per configured name per request. An empty list costs nothing.
Open questions:
- What configuration surface would you prefer: a public API, an OTel-aligned environment variable as proposed in #69092, or both?
- Should response headers be in scope, or request headers only?
Alternatives considered:
Enrichcallbacks or a custom listener: these work for export, but headers are added after sampling, and every app writes the same code and requires the contrib instrumentation package.- Header capture in
OpenTelemetry.Instrumentation.AspNetCore: this has the same post-sampling limitation and ideally the maintainers would like to deprecate this package once optional attributes are built into ASP.NET Core. This requires extra dependencies and registration for consumers vs. on a clean OOB experience.
Additional context
- open-telemetry/opentelemetry-dotnet-contrib#5921: now that #65873 has made the contrib package largely optional, the preference there is to build this into ASP.NET Core for .NET 12 rather than add features to the package. Contrib may carry an interim bridge for
net10.0/net11.0. - Within OTel there is a moratorium on new
OTEL_env vars so a discussion would need to occur on how ASP.NET Core users would opt in for this. - #69092 is a related request to make hosting's OpenTelemetry behaviour configurable.
- Lingua principale
- C#
- Stelle
- 38.5k
- Fork
- 11.6k
- Merge medio
- 3g 1h
- PR unite (30g)
- 289
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di dotnet/aspnetcore
-
area-networking
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
dotnet/aspnetcore#70545 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
area-infrastructure
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
dotnet/aspnetcore#70524 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
[OpenTelemetry] Hosting replaces an Activity.DisplayName that the app set, when a route matchesApertaarea-hosting Regression
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
dotnet/aspnetcore#70516 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
[SSE] ServerSentEventsResult.WrapEvents is missing [EnumeratorCancellation], so RequestAborted never reaches the app's generator on the IAsyncEnumerable<T> overloadForse già presa @bharatprajapati-coder l’ha presa 1 giorno fa. Apertaarea-minimal
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
dotnet/aspnetcore#70419 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
[Blazor] DefaultInMemoryCircuitPersistenceProvider never disposes the retention CancellationTokenSource when a persist is rejected at capacityForse già presa @Vinoth2562000 l’ha presa 1 giorno fa. Apertaarea-blazor
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
dotnet/aspnetcore#70418 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di dotnet/aspnetcore
Issue simili
-
bug emitter:client:csharp
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
microsoft/typespec#12572 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
needs-area-label
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 2 giorni
-
AWS Lambda: KeyNotFoundException drops HTTP-triggered transactions when allowAllHeaders is disabledApertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
newrelic/newrelic-dotnet-agent#3949 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 87/100
I maintainer di solito rispondono entro 1 giorno
-
priority:P2
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100