[Http Instrumentation] Unify exposed public API#3793
[Http Instrumentation] Unify exposed public API#3793CodeBlanch merged 18 commits intoopen-telemetry:mainfrom
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #3793 +/- ##
==========================================
- Coverage 87.46% 87.27% -0.20%
==========================================
Files 280 279 -1
Lines 10763 10755 -8
==========================================
- Hits 9414 9386 -28
- Misses 1349 1369 +20
|
src/OpenTelemetry.Instrumentation.Http/HttpClientInstrumentationOptions.cs
Show resolved
Hide resolved
|
@vishweshbankwar FYI I updated this to include #3792. |
| `HttpClientInstrumentationOptions`. It is important to note that there are | ||
| differences between .NET Framework and newer .NET/.NET Core runtimes which | ||
| govern what options are used. On .NET Framework, `HttpClient` uses the | ||
| `HttpWebRequest` API. On .NET & .NET Core, `HttpWebRequest` uses the |
There was a problem hiding this comment.
| `HttpWebRequest` API. On .NET & .NET Core, `HttpWebRequest` uses the | |
| `HttpWebRequest` API. On .NET & .NET Core, `HttpClient` uses the |
There was a problem hiding this comment.
If we do this, it will say:
On .NET & .NET Core,
HttpClientuses theHttpClientAPI.
Which is kind of silly 😜
What I was trying to highlight here is the behavior is reversed, depending on the runtime.
- .NET Framework: HttpClient & HttpWebRequest implemented using HttpWebRequest.
- .NET/Core: HttpClient & HttpWebRequest implemented using HttpClient.
Not sure how to best articulate that!
There was a problem hiding this comment.
yea i can see this is not easy to articulate. Lets merge this now, and come back to fixing the wording.
Fixes #3434 (really mean it this time)
Relates to #3787
Changes
Exposes the same API for all targets to fix package resolution issues when consuming Http instrumentation into
netstandard2.0projects.We used to only run HttpWebRequest tests for .NET Framework & HttpClient tests for .NET/Core. Now we run the full suite for all runtimes.
Public API Changes
namespace OpenTelemetry.Instrumentation.Http { -#if NETFRAMEWORK - public class HttpWebRequestInstrumentationOptions - { - public Func<HttpWebRequest, bool> Filter { get; set; } - // omitted other stuff but whole class removed - } -#else public class HttpClientInstrumentationOptions { - public Func<HttpRequestMessage, bool> Filter { get; set; } + public Func<HttpRequestMessage, bool> FilterHttpRequestMessage { get; set; } + public Func<HttpWebRequest, bool> FilterHttpWebRequest { get; set; } } -#endif }Not shown: Removed the
AddHttpClientInstrumentationextensions usingHttpWebRequestInstrumentationOptionsand made the ones usingHttpClientInstrumentationOptionsavailable toNETFRAMEWORKtargets.TODOs
CHANGELOG.mdupdated for non-trivial changes