![]() |
VOOZH | about |
dotnet add package OpenTelemetry.Instrumentation.Wcf --version 1.15.1-beta.2
NuGet\Install-Package OpenTelemetry.Instrumentation.Wcf -Version 1.15.1-beta.2
<PackageReference Include="OpenTelemetry.Instrumentation.Wcf" Version="1.15.1-beta.2" />
<PackageVersion Include="OpenTelemetry.Instrumentation.Wcf" Version="1.15.1-beta.2" />Directory.Packages.props
<PackageReference Include="OpenTelemetry.Instrumentation.Wcf" />Project file
paket add OpenTelemetry.Instrumentation.Wcf --version 1.15.1-beta.2
#r "nuget: OpenTelemetry.Instrumentation.Wcf, 1.15.1-beta.2"
#:package OpenTelemetry.Instrumentation.Wcf@1.15.1-beta.2
#addin nuget:?package=OpenTelemetry.Instrumentation.Wcf&version=1.15.1-beta.2&prereleaseInstall as a Cake Addin
#tool nuget:?package=OpenTelemetry.Instrumentation.Wcf&version=1.15.1-beta.2&prereleaseInstall as a Cake Tool
| Status | |
|---|---|
| Stability | Beta |
| Code Owners | @open-telemetry/dotnet-contrib-maintainers |
👁 NuGet version badge
👁 NuGet download count badge
👁 codecov.io
Instruments WCF clients and/or services.
The following configurations are verified to work with this instrumentation. Other configurations may work as well but have not been tested.
This component is based on the OpenTelemetry semantic conventions for traces. These conventions are in Development, and hence, this package is a pre-release. Until a stable version is released, there can be breaking changes.
Add the OpenTelemetry.Instrumentation.Wcf package via NuGet.
Use the AddWcfInstrumentation extension method to add WCF instrumentation to
an OpenTelemetry TracerProvider:
using var openTelemetry = Sdk.CreateTracerProviderBuilder()
.AddWcfInstrumentation()
.Build();
Instrumentation can be configured via options overload for
AddWcfInstrumentation method:
using var openTelemetry = Sdk.CreateTracerProviderBuilder()
.AddWcfInstrumentation(options =>
{
options.SuppressDownstreamInstrumentation = false;
// Enable enriching an activity after it is created.
options.Enrich = (activity, eventName, message) =>
{
var wcfMessage = message as Message;
// For event names, please refer to string constants in
// WcfEnrichEventNames class.
if (eventName == WcfEnrichEventNames.AfterReceiveReply)
{
activity.SetTag(
"companyname.messagetag",
wcfMessage.Properties["CustomProperty"]);
}
};
})
.Build();
Configure the TelemetryEndpointBehaviorExtensionElement on the clients
you want to instrument:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<extensions>
<behaviorExtensions>
<add name="telemetryExtension" type="OpenTelemetry.Instrumentation.Wcf.TelemetryEndpointBehaviorExtensionElement, OpenTelemetry.Instrumentation.Wcf" />
</behaviorExtensions>
</extensions>
<behaviors>
<endpointBehaviors>
<behavior name="telemetry">
<telemetryExtension />
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<netTcpBinding>
<binding name="netTCPConfig">
<security mode="None" />
</binding>
</netTcpBinding>
</bindings>
<client>
<endpoint address="net.tcp://localhost:9090/Telemetry" binding="netTcpBinding" bindingConfiguration="netTCPConfig" behaviorConfiguration="telemetry" contract="Examples.Wcf.IStatusServiceContract" name="StatusService_Tcp" />
</client>
</system.serviceModel>
</configuration>
Example project available in examples/wcf/client-netframework folder.
Add the TelemetryEndpointBehavior extension to the clients you want to instrument:
StatusServiceClient client = new StatusServiceClient(binding, remoteAddress);
client.Endpoint.EndpointBehaviors.Add(new TelemetryEndpointBehavior());
Example project available in examples/wcf/client-core folder.
To add the IDispatchMessageInspector instrumentation to select endpoints of a
service, use the endpoint behavior extension on the service endpoints you want
to instrument:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<extensions>
<behaviorExtensions>
<add name="telemetryExtension" type="OpenTelemetry.Instrumentation.Wcf.TelemetryEndpointBehaviorExtensionElement, OpenTelemetry.Instrumentation.Wcf" />
</behaviorExtensions>
</extensions>
<behaviors>
<endpointBehaviors>
<behavior name="telemetry">
<telemetryExtension />
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<netTcpBinding>
<binding name="netTCPConfig">
<security mode="None" />
</binding>
</netTcpBinding>
</bindings>
<services>
<service name="Examples.Wcf.Server.StatusService">
<endpoint binding="netTcpBinding" bindingConfiguration="netTCPConfig" behaviorConfiguration="telemetry" contract="Examples.Wcf.IStatusServiceContract" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:9090/Telemetry" />
</baseAddresses>
</host>
</service>
</services>
</system.serviceModel>
</configuration>
Example project available in examples/wcf/server-netframework folder.
To add the IDispatchMessageInspector instrumentation for all endpoints of a
service, use the service behavior extension on the services you want to
instrument:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<extensions>
<behaviorExtensions>
<add name="telemetryExtension" type="OpenTelemetry.Instrumentation.Wcf.TelemetryServiceBehaviorExtensionElement, OpenTelemetry.Instrumentation.Wcf" />
</behaviorExtensions>
</extensions>
<behaviors>
<serviceBehaviors>
<behavior name="telemetry">
<telemetryExtension />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<netTcpBinding>
<binding name="netTCPConfig">
<security mode="None" />
</binding>
</netTcpBinding>
</bindings>
<services>
<service name="Examples.Wcf.Server.StatusService" behaviorConfiguration="telemetry">
<endpoint binding="netTcpBinding" bindingConfiguration="netTCPConfig" contract="Examples.Wcf.IStatusServiceContract" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:9090/Telemetry" />
</baseAddresses>
</host>
</service>
</services>
</system.serviceModel>
</configuration>
To programmatically add instrumentation for servers (.NET Framework only) and/or
for clients (.NET Framework & .NET Core), use the TelemetryContractBehaviorAttribute
on the service contracts you want to instrument:
[ServiceContract(
Namespace = "http://opentelemetry.io/",
Name = "StatusService",
SessionMode = SessionMode.Allowed)]
[TelemetryContractBehavior]
public interface IStatusServiceContract
{
[OperationContract]
Task<StatusResponse> PingAsync(StatusRequest request);
}
This instrumentation can be configured to change the default behavior by using
WcfInstrumentationOptions.
This instrumentation automatically sets Activity Status to Error if an unhandled
exception is thrown. Additionally, RecordException feature may be turned on,
to store the exception to the Activity itself as ActivityEvent. This feature
applies both on instrumented servers and clients.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 was computed. |
| .NET Framework | net461 net461 was computed. net462 net462 is compatible. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 5 NuGet packages that depend on OpenTelemetry.Instrumentation.Wcf:
| Package | Downloads |
|---|---|
|
OpenTelemetry.AutoInstrumentation.Runtime.Managed
Managed components used by the OpenTelemetry.AutoInstrumentation project. |
|
|
Grafana.OpenTelemetry
Full Grafana distribution of OpenTelemetry .NET |
|
|
Honeycomb.OpenTelemetry.CommonInstrumentations
Honeycomb's OpenTelemetry common instrumentations package. Adds support for many common instrumentation libraries for you. |
|
|
LaunchDarkly.Observability
LaunchDarkly Observability for Server-Side .NET SDK |
|
|
Honeycomb.OpenTelemetry.AutoInstrumentations
Honeycomb's OpenTelemetry autoinstrumentations package. Adds support for many common instrumentation libraries for you. |
Showing the top 1 popular GitHub repositories that depend on OpenTelemetry.Instrumentation.Wcf:
| Repository | Stars |
|---|---|
|
DataDog/dd-trace-dotnet
.NET Client Library for Datadog APM
|
| Version | Downloads | Last Updated |
|---|---|---|
| 1.15.1-beta.2 | 344,765 | 4/22/2026 |
| 1.15.1-beta.1 | 91,642 | 4/21/2026 |
| 1.15.0-beta.1 | 642,878 | 1/21/2026 |
| 1.14.0-beta.1 | 709,958 | 11/13/2025 |
| 1.13.0-beta.2 | 17,762 | 10/20/2025 |
| 1.13.0-beta.1 | 11,737 | 10/15/2025 |
| 1.12.0-beta.1 | 1,835,243 | 5/6/2025 |
| 1.11.0-beta.2 | 840,233 | 3/5/2025 |
| 1.11.0-beta.1 | 200,250 | 1/27/2025 |
| 1.10.0-beta.1 | 26,672 | 12/9/2024 |
| 1.0.0-rc.18 | 974,614 | 10/28/2024 |
| 1.0.0-rc.17 | 2,322,644 | 6/18/2024 |
| 1.0.0-rc.16 | 872,465 | 4/5/2024 |
| 1.0.0-rc.15 | 185,063 | 2/7/2024 |
| 1.0.0-rc.14 | 406,453 | 1/4/2024 |
| 1.0.0-rc.13 | 706,958 | 10/27/2023 |
| 1.0.0-rc.12 | 312,351 | 8/30/2023 |
| 1.0.0-rc.11 | 1,582 | 8/14/2023 |
| 1.0.0-rc.10 | 121,189 | 6/9/2023 |
| 1.0.0-rc.9 | 498,740 | 2/28/2023 |