PW.OpenTelemetry.StaticProxy
3.1.0
See the version list below for details.
dotnet add package PW.OpenTelemetry.StaticProxy --version 3.1.0
NuGet\Install-Package PW.OpenTelemetry.StaticProxy -Version 3.1.0
<PackageReference Include="PW.OpenTelemetry.StaticProxy" Version="3.1.0" />
paket add PW.OpenTelemetry.StaticProxy --version 3.1.0
#r "nuget: PW.OpenTelemetry.StaticProxy, 3.1.0"
// Install PW.OpenTelemetry.StaticProxy as a Cake Addin #addin nuget:?package=PW.OpenTelemetry.StaticProxy&version=3.1.0 // Install PW.OpenTelemetry.StaticProxy as a Cake Tool #tool nuget:?package=PW.OpenTelemetry.StaticProxy&version=3.1.0
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 | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
.NET Framework | net472 is compatible. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | 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
- PW.OpenTelemetry.Proxy (>= 3.1.0)
-
.NETStandard 2.1
- PW.OpenTelemetry.Proxy (>= 3.1.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.