PW.OpenTelemetry.Proxy
3.1.2
See the version list below for details.
dotnet add package PW.OpenTelemetry.Proxy --version 3.1.2
NuGet\Install-Package PW.OpenTelemetry.Proxy -Version 3.1.2
<PackageReference Include="PW.OpenTelemetry.Proxy" Version="3.1.2" />
paket add PW.OpenTelemetry.Proxy --version 3.1.2
#r "nuget: PW.OpenTelemetry.Proxy, 3.1.2"
// Install PW.OpenTelemetry.Proxy as a Cake Addin #addin nuget:?package=PW.OpenTelemetry.Proxy&version=3.1.2 // Install PW.OpenTelemetry.Proxy as a Cake Tool #tool nuget:?package=PW.OpenTelemetry.Proxy&version=3.1.2
OpenTelemetry.Proxy
Generate an activity to wrap the method, modify name of the inner activity or discard inner activity.
Attribute
[ActivitySource]
DynamicProxy
[ActivitySource] all methods defined in the interface or virtual methods defined in the class will automatically generate activity, unless defined [NonActivity] on method.
IncludeNonAsyncStateMachineMethod
: default include all async methods of defined in an interface, or all [AsyncStateMachine] public or protected virtual method of class (except for async void
method). If true, all methods defined in the interface will be included and all public or protected virtual methods of the class.
StaticProxy
[ActivitySource] all methods will automatically generate activity, except for those that are defined [NonActivity] on method.
IncludeNonAsyncStateMachineMethod
: public methods defined in the class that are marked with the [AsyncStateMachine] attribute (except for async void
method). If true, will include all methods of class.
Needs to be installed in each working project, and install
Metalama.Compiler
orFody
(Fody
need some additional file), recommendMetalama.Compiler
.
[Activity]
[Activity] can be defined on method only.
[NonActivity]
If defined [NonActivity] on method, call method will not generate an activity. if SuppressInstrumentation
is true, the inner activity will be discarded.
[ActivityName]
To modify the DisplayName of an inner activity, you must invoke TracerProviderBuilder.AddActivityNameProcessor()
. If a type is defined with the [ActivitySource] attribute or a method is defined with the [Activity] or [NonActivity] attribute, the [ActivityName] attribute will not take effect.
Priority: [NonActivity] > [Activity] > [ActivityName] (method) > [ActivitySource] > [ActivityName] (class)
[ActivityTag]
To add tag to activity, it defined on parameter or return value.
[ActivityTags]
To add tags to activity, it defined on type or method.
About DynamicProxy and StaticProxy
DynamicProxy | StaticProxy | |
---|---|---|
AOT | ❌ | ✔️ |
Work in | Runtime | Compiling |
Support scenario | interface or virtual method | Any method with a body of type. |
Work order (ASC) | 2 | 1 |
Performance | ⭐⭐⭐ | ⭐⭐⭐⭐⭐ |
Expression | Default: public property, field or parameterless method.<br />DynamicExpressionParser: see DynamicExpresso.Core | Any valid code. |
Tag expression
Must start with $
on [ActivityTag]
DynamicProxy
Parse expression on runtime.
Default
Public property, field or parameterless method only.
DynamicExpressionParser
StaticProxy
Parse expression on compiling.
Any valid code.
QA
How to get ActivitySource name?
ActivitySourceAttribute.GetActivitySourceName(typeof(YourType))
See demo
How to generate proxy class?
ProxyGenerator generator = ...
IActivityInvokerFactory invokerFactory = ...
var proxyType = generator.CreateClassProxy<YourType>(new ActivityInterceptor(invokerFactory));
See demo.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 is compatible. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.7.2
- Ben.Demystifier (>= 0.4.1)
- OpenTelemetry (>= 1.9.0)
-
.NETStandard 2.0
- Ben.Demystifier (>= 0.4.1)
- OpenTelemetry (>= 1.9.0)
-
.NETStandard 2.1
- Ben.Demystifier (>= 0.4.1)
- OpenTelemetry (>= 1.9.0)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on PW.OpenTelemetry.Proxy:
Package | Downloads |
---|---|
PW.OpenTelemetry.DynamicProxy
Automatically generate activity by defined [Activity] on runtime. |
|
PW.OpenTelemetry.StaticProxy
Automatically generate activity by defined [Activity] on compile. Install `Metalama.Compiler` to emit code. |
GitHub repositories
This package is not used by any popular GitHub repositories.