Rename Microsoft.AspNet.TelemetryCorrelation -> OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule. Added project to the solution + updated references & namespaces. (#2238)

This commit is contained in:
Mikel Blanchard 2021-08-06 22:01:58 -07:00 committed by Cijo Thomas
parent 7668b6cf58
commit ec118d4fde
29 changed files with 67 additions and 64 deletions

View File

@ -207,7 +207,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "customizing-the-sdk", "docs
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "getting-started", "docs\metrics\getting-started\getting-started.csproj", "{DFB0AD2F-11BE-4BCD-A77B-1018C3344FA8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTelemetry.Exporter.Prometheus", "src\OpenTelemetry.Exporter.Prometheus\OpenTelemetry.Exporter.Prometheus.csproj", "{52158A12-E7EF-45A1-859F-06F9B17410CB}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Exporter.Prometheus", "src\OpenTelemetry.Exporter.Prometheus\OpenTelemetry.Exporter.Prometheus.csproj", "{52158A12-E7EF-45A1-859F-06F9B17410CB}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule", "src\OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule\OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule.csproj", "{F38E511B-1877-4E8A-8051-7879FC7DF8A4}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule.Tests", "test\OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule.Tests\OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule.Tests.csproj", "{4D7201BC-7124-4401-AD65-FAB58A053D45}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -411,6 +415,14 @@ Global
{52158A12-E7EF-45A1-859F-06F9B17410CB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{52158A12-E7EF-45A1-859F-06F9B17410CB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{52158A12-E7EF-45A1-859F-06F9B17410CB}.Release|Any CPU.Build.0 = Release|Any CPU
{F38E511B-1877-4E8A-8051-7879FC7DF8A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F38E511B-1877-4E8A-8051-7879FC7DF8A4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F38E511B-1877-4E8A-8051-7879FC7DF8A4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F38E511B-1877-4E8A-8051-7879FC7DF8A4}.Release|Any CPU.Build.0 = Release|Any CPU
{4D7201BC-7124-4401-AD65-FAB58A053D45}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4D7201BC-7124-4401-AD65-FAB58A053D45}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4D7201BC-7124-4401-AD65-FAB58A053D45}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4D7201BC-7124-4401-AD65-FAB58A053D45}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -28,7 +28,6 @@
<GrpcToolsPkgVer>[2.25.0,3.0)</GrpcToolsPkgVer>
<MicrosoftAspNetCoreHttpAbstractionsPkgVer>[2.1.1,6.0)</MicrosoftAspNetCoreHttpAbstractionsPkgVer>
<MicrosoftAspNetCoreHttpFeaturesPkgVer>[2.1.1,6.0)</MicrosoftAspNetCoreHttpFeaturesPkgVer>
<MicrosoftAspNetTelemetryCorrelationPkgVer>[1.0.7,2.0)</MicrosoftAspNetTelemetryCorrelationPkgVer>
<MicrosoftCodeAnalysisAnalyzersPkgVer>[3.3.1]</MicrosoftCodeAnalysisAnalyzersPkgVer>
<MicrosoftCodeCoveragePkgVer>[16.10.0]</MicrosoftCodeCoveragePkgVer>
<MicrosoftExtensionsHostingAbstractionsPkgVer>[2.1.0,)</MicrosoftExtensionsHostingAbstractionsPkgVer>

View File

@ -23,7 +23,7 @@
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0"/>
</handlers>
<modules>
<add name="TelemetryCorrelationHttpModule" type="Microsoft.AspNet.TelemetryCorrelation.TelemetryCorrelationHttpModule, Microsoft.AspNet.TelemetryCorrelation" preCondition="integratedMode,managedHandler"/>
<add name="TelemetryCorrelationHttpModule" type="OpenTelemetry.Instrumentation.AspNet.TelemetryCorrelationHttpModule, OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule" preCondition="integratedMode,managedHandler"/>
</modules>
</system.webServer>
<runtime>

View File

@ -19,7 +19,7 @@ using System.Collections.Specialized;
using System.ComponentModel;
using System.Diagnostics;
namespace Microsoft.AspNet.TelemetryCorrelation
namespace OpenTelemetry.Instrumentation.AspNet
{
/// <summary>
/// Extensions of Activity class.

View File

@ -19,7 +19,7 @@ using System.Collections;
using System.Diagnostics;
using System.Web;
namespace Microsoft.AspNet.TelemetryCorrelation
namespace OpenTelemetry.Instrumentation.AspNet
{
/// <summary>
/// Activity helper class.

View File

@ -18,7 +18,7 @@ using System;
using System.Diagnostics.Tracing;
#pragma warning disable SA1600 // Elements must be documented
namespace Microsoft.AspNet.TelemetryCorrelation
namespace OpenTelemetry.Instrumentation.AspNet
{
/// <summary>
/// ETW EventSource tracing class.

View File

@ -19,16 +19,8 @@ using System.Runtime.InteropServices;
[assembly: ComVisible(false)]
[assembly: InternalsVisibleTo("Microsoft.AspNet.TelemetryCorrelation.Tests" + AssemblyInfo.PublicKey)]
#if SIGNED
internal static class AssemblyInfo
{
public const string PublicKey = ", PublicKey=002400000480000094000000060200000024000052534131000400000100010051C1562A090FB0C9F391012A32198B5E5D9A60E9B80FA2D7B434C9E5CCB7259BD606E66F9660676AFC6692B8CDC6793D190904551D2103B7B22FA636DCBB8208839785BA402EA08FC00C8F1500CCEF28BBF599AA64FFB1E1D5DC1BF3420A3777BADFE697856E9D52070A50C3EA5821C80BEF17CA3ACFFA28F89DD413F096F898";
}
[assembly: InternalsVisibleTo("OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule.Tests, PublicKey=002400000480000094000000060200000024000052534131000400000100010051c1562a090fb0c9f391012a32198b5e5d9a60e9b80fa2d7b434c9e5ccb7259bd606e66f9660676afc6692b8cdc6793d190904551d2103b7b22fa636dcbb8208839785ba402ea08fc00c8f1500ccef28bbf599aa64ffb1e1d5dc1bf3420a3777badfe697856e9d52070a50c3ea5821c80bef17ca3acffa28f89dd413f096f898")]
#else
internal static class AssemblyInfo
{
public const string PublicKey = "";
}
[assembly: InternalsVisibleTo("OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule.Tests")]
#endif

View File

@ -14,7 +14,7 @@
// limitations under the License.
// </copyright>
namespace Microsoft.AspNet.TelemetryCorrelation
namespace OpenTelemetry.Instrumentation.AspNet
{
// Adoptation of code from https://github.com/aspnet/HttpAbstractions/blob/07d115400e4f8c7a66ba239f230805f03a14ee3d/src/Microsoft.Net.Http.Headers/BaseHeaderParser.cs
internal abstract class BaseHeaderParser<T> : HttpHeaderParser<T>

View File

@ -16,7 +16,7 @@
using System;
namespace Microsoft.AspNet.TelemetryCorrelation
namespace OpenTelemetry.Instrumentation.AspNet
{
// Adoptation of code from https://github.com/aspnet/HttpAbstractions/blob/07d115400e4f8c7a66ba239f230805f03a14ee3d/src/Microsoft.Net.Http.Headers/GenericHeaderParser.cs
internal sealed class GenericHeaderParser<T> : BaseHeaderParser<T>

View File

@ -16,7 +16,7 @@
using System.Diagnostics.Contracts;
namespace Microsoft.AspNet.TelemetryCorrelation
namespace OpenTelemetry.Instrumentation.AspNet
{
// Adoption of the code from https://github.com/aspnet/HttpAbstractions/blob/07d115400e4f8c7a66ba239f230805f03a14ee3d/src/Microsoft.Net.Http.Headers/HeaderUtilities.cs
internal static class HeaderUtilities

View File

@ -14,7 +14,7 @@
// limitations under the License.
// </copyright>
namespace Microsoft.AspNet.TelemetryCorrelation
namespace OpenTelemetry.Instrumentation.AspNet
{
// Adoptation of code from https://github.com/aspnet/HttpAbstractions/blob/07d115400e4f8c7a66ba239f230805f03a14ee3d/src/Microsoft.Net.Http.Headers/HttpHeaderParser.cs
internal abstract class HttpHeaderParser<T>

View File

@ -14,7 +14,7 @@
// limitations under the License.
// </copyright>
namespace Microsoft.AspNet.TelemetryCorrelation
namespace OpenTelemetry.Instrumentation.AspNet
{
// Adoptation of code from https://github.com/aspnet/HttpAbstractions/blob/07d115400e4f8c7a66ba239f230805f03a14ee3d/src/Microsoft.Net.Http.Headers/HttpParseResult.cs
internal enum HttpParseResult

View File

@ -16,7 +16,7 @@
using System.Diagnostics.Contracts;
namespace Microsoft.AspNet.TelemetryCorrelation
namespace OpenTelemetry.Instrumentation.AspNet
{
// Adoptation of code from https://github.com/aspnet/HttpAbstractions/blob/07d115400e4f8c7a66ba239f230805f03a14ee3d/src/Microsoft.Net.Http.Headers/HttpRuleParser.cs
internal static class HttpRuleParser

View File

@ -16,7 +16,7 @@
using System.Diagnostics.Contracts;
namespace Microsoft.AspNet.TelemetryCorrelation
namespace OpenTelemetry.Instrumentation.AspNet
{
// Adoptation of code from https://github.com/aspnet/HttpAbstractions/blob/07d115400e4f8c7a66ba239f230805f03a14ee3d/src/Microsoft.Net.Http.Headers/NameValueHeaderValue.cs

View File

@ -2,6 +2,7 @@
<PropertyGroup>
<TargetFrameworks>net461</TargetFrameworks>
<Description>A module that instruments incoming request with System.Diagnostics.Activity and notifies listeners with DiagnosticsSource.</Description>
<PackageTags>$(PackageTags);distributed-tracing;AspNet;MVC;WebAPI</PackageTags>
<!--
TODO: Disable this exception, and actually do document all public API.
-->

View File

@ -20,7 +20,7 @@ using System.Diagnostics;
using System.Reflection;
using System.Web;
namespace Microsoft.AspNet.TelemetryCorrelation
namespace OpenTelemetry.Instrumentation.AspNet
{
/// <summary>
/// Http Module sets ambient state using Activity API from DiagnosticsSource package.

View File

@ -10,12 +10,9 @@
<Reference Include="System.Web" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNet.TelemetryCorrelation" Version="$(MicrosoftAspNetTelemetryCorrelationPkgVer)" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry\OpenTelemetry.csproj" />
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule\OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule.csproj" />
</ItemGroup>
</Project>

View File

@ -24,17 +24,18 @@ dotnet add package OpenTelemetry.Instrumentation.AspNet
`OpenTelemetry.Instrumentation.AspNet` requires adding an additional HttpModule
to your web server. This additional HttpModule is shipped as part of
[`Microsoft.AspNet.TelemetryCorrelation`](https://www.nuget.org/packages/Microsoft.AspNet.TelemetryCorrelation/)
[`OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule`](https://www.nuget.org/packages/OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule/)
which is implicitly brought by `OpenTelemetry.Instrumentation.AspNet`. The
following shows changes required to your `Web.config` when using IIS web server.
```xml
<system.webServer>
<modules>
<add name="TelemetryCorrelationHttpModule"
type="Microsoft.AspNet.TelemetryCorrelation.TelemetryCorrelationHttpModule,
Microsoft.AspNet.TelemetryCorrelation"
preCondition="integratedMode,managedHandler" />
<add
name="TelemetryCorrelationHttpModule"
type="OpenTelemetry.Instrumentation.AspNet.TelemetryCorrelationHttpModule,
OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule"
preCondition="integratedMode,managedHandler" />
</modules>
</system.webServer>
```
@ -44,8 +45,8 @@ following shows changes required to your `Web.config` when using IIS web server.
ASP.NET instrumentation must be enabled at application startup. This is
typically done in the `Global.asax.cs` as shown below. This example also sets up
the OpenTelemetry Jaeger exporter, which requires adding the package
[`OpenTelemetry.Exporter.Jaeger`](../OpenTelemetry.Exporter.Jaeger/README.md)
to the application.
[`OpenTelemetry.Exporter.Jaeger`](../OpenTelemetry.Exporter.Jaeger/README.md) to
the application.
```csharp
using OpenTelemetry;
@ -71,18 +72,19 @@ public class WebApiApplication : HttpApplication
## Advanced configuration
This instrumentation can be configured to change the default behavior by using
`AspNetInstrumentationOptions`, which allows configuring `Filter` as explained below.
`AspNetInstrumentationOptions`, which allows configuring `Filter` as explained
below.
### Filter
This instrumentation by default collects all the incoming http requests. It allows
filtering of requests by using the `Filter` function in `AspNetInstrumentationOptions`.
This defines the condition for allowable requests. The Filter
receives the `HttpContext` of the incoming request, and does not collect telemetry
about the request if the Filter returns false or throws exception.
This instrumentation by default collects all the incoming http requests. It
allows filtering of requests by using the `Filter` function in
`AspNetInstrumentationOptions`. This defines the condition for allowable
requests. The Filter receives the `HttpContext` of the incoming request, and
does not collect telemetry about the request if the Filter returns false or
throws exception.
The following code snippet shows how to use `Filter` to only allow GET
requests.
The following code snippet shows how to use `Filter` to only allow GET requests.
```csharp
this.tracerProvider = Sdk.CreateTracerProviderBuilder()
@ -103,13 +105,13 @@ and the `Filter` option does the filtering *before* the Sampler is invoked.
### Enrich
This option allows one to enrich the activity with additional information
from the raw `HttpRequest`, `HttpResponse` objects. The `Enrich` action is
called only when `activity.IsAllDataRequested` is `true`. It contains the
activity itself (which can be enriched), the name of the event, and the
actual raw object.
For event name "OnStartActivity", the actual object will be `HttpRequest`.
For event name "OnStopActivity", the actual object will be `HttpResponse`
This option allows one to enrich the activity with additional information from
the raw `HttpRequest`, `HttpResponse` objects. The `Enrich` action is called
only when `activity.IsAllDataRequested` is `true`. It contains the activity
itself (which can be enriched), the name of the event, and the actual raw
object. For event name "OnStartActivity", the actual object will be
`HttpRequest`. For event name "OnStopActivity", the actual object will be
`HttpResponse`
The following code snippet shows how to add additional tags using `Enrich`.
@ -136,10 +138,10 @@ this.tracerProvider = Sdk.CreateTracerProviderBuilder()
.Build();
```
[Processor](../../docs/trace/extending-the-sdk/README.md#processor),
is the general extensibility point to add additional properties to any activity.
The `Enrich` option is specific to this instrumentation, and is provided to
get access to `HttpRequest` and `HttpResponse`.
[Processor](../../docs/trace/extending-the-sdk/README.md#processor), is the
general extensibility point to add additional properties to any activity. The
`Enrich` option is specific to this instrumentation, and is provided to get
access to `HttpRequest` and `HttpResponse`.
## References

View File

@ -14,7 +14,7 @@
// limitations under the License.
// </copyright>
namespace Microsoft.AspNet.TelemetryCorrelation.Tests
namespace OpenTelemetry.Instrumentation.AspNet.Tests
{
using System.Collections.Generic;
using System.Collections.Specialized;

View File

@ -14,7 +14,7 @@
// limitations under the License.
// </copyright>
namespace Microsoft.AspNet.TelemetryCorrelation.Tests
namespace OpenTelemetry.Instrumentation.AspNet.Tests
{
using System;
using System.Collections;

View File

@ -14,7 +14,7 @@
// limitations under the License.
// </copyright>
namespace Microsoft.AspNet.TelemetryCorrelation.Tests
namespace OpenTelemetry.Instrumentation.AspNet.Tests
{
using System.Collections.Generic;
using System.Globalization;

View File

@ -19,14 +19,14 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(RepoRoot)\src\Microsoft.AspNet.TelemetryCorrelation\Microsoft.AspNet.TelemetryCorrelation.csproj" />
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule\OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule.csproj" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="$(RepoRoot)\src\Microsoft.AspNet.TelemetryCorrelation\web.config.install.xdt">
<EmbeddedResource Include="$(RepoRoot)\src\OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule\web.config.install.xdt">
<Link>Resources\web.config.install.xdt</Link>
</EmbeddedResource>
<EmbeddedResource Include="$(RepoRoot)\src\Microsoft.AspNet.TelemetryCorrelation\web.config.uninstall.xdt">
<EmbeddedResource Include="$(RepoRoot)\src\OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule\web.config.uninstall.xdt">
<Link>Resources\web.config.uninstall.xdt</Link>
</EmbeddedResource>
</ItemGroup>

View File

@ -14,7 +14,7 @@
// limitations under the License.
// </copyright>
namespace Microsoft.AspNet.TelemetryCorrelation.Tests
namespace OpenTelemetry.Instrumentation.AspNet.Tests
{
using System.Reflection;

View File

@ -14,7 +14,7 @@
// limitations under the License.
// </copyright>
namespace Microsoft.AspNet.TelemetryCorrelation.Tests
namespace OpenTelemetry.Instrumentation.AspNet.Tests
{
using System;
using System.Collections.Generic;

View File

@ -14,7 +14,7 @@
// limitations under the License.
// </copyright>
namespace Microsoft.AspNet.TelemetryCorrelation.Tests
namespace OpenTelemetry.Instrumentation.AspNet.Tests
{
using System.IO;
using System.Xml.Linq;

View File

@ -14,7 +14,7 @@
// limitations under the License.
// </copyright>
namespace Microsoft.AspNet.TelemetryCorrelation.Tests
namespace OpenTelemetry.Instrumentation.AspNet.Tests
{
using System.IO;
using System.Xml.Linq;