PaTh.AzureFunctions.Tracing
1.1.0-beta
See the version list below for details.
dotnet add package PaTh.AzureFunctions.Tracing --version 1.1.0-beta
NuGet\Install-Package PaTh.AzureFunctions.Tracing -Version 1.1.0-beta
<PackageReference Include="PaTh.AzureFunctions.Tracing" Version="1.1.0-beta" />
paket add PaTh.AzureFunctions.Tracing --version 1.1.0-beta
#r "nuget: PaTh.AzureFunctions.Tracing, 1.1.0-beta"
// Install PaTh.AzureFunctions.Tracing as a Cake Addin #addin nuget:?package=PaTh.AzureFunctions.Tracing&version=1.1.0-beta&prerelease // Install PaTh.AzureFunctions.Tracing as a Cake Tool #tool nuget:?package=PaTh.AzureFunctions.Tracing&version=1.1.0-beta&prerelease
Azure Functions Tracing
Distributed tracing enhancements for Azure Functions using OpenTelemetry and Dynatrace. This package makes use of Castle Dynamic Proxy to intercept function invocations, adding distributed tracing via Dynatrace OpenTeleetry extension.
Read more about tracing Azure Functions
Features
The package provides a IFunctionHostBuilder extension to register all necessary components in your functions startup class.
It allows you to add tracing if you already use a startup class or want to customize the TraceProvider configuration.
By default the instrumentation adds automatic function tracing for any function trigger type and enables automatic distributed tracing for following triggers:
- HttpTrigger using a HttpRequest binding
- ServiceBusTrigger using a ServiceBusReceivedMessage binding
You can enable .NET Framworks additional instrumentation such as outgoing http or SQLclient calls.
Since October 2021, .NET Azure SDK comes with experimental OpenTelemetry support which gives additional trace details. While you can capture these spans span as described here, the Azure.Function.Tracing library adds selected and validated instrumentation filters via simple TraceProviderBuilder extension methods:
- AddServiceBusInstrumentation adds spans for Azure.Messaging.ServiceBus Client
ChangeLog
- v1.0.0 - Removed dependency on AutoFac. Removed parameter RegisterBuilder from configuration method AddFunctionTracing as it is no longer necessary to pass the services when using dependency injection in Azure Functions.
- v1.1.0 - Adding support for ServiceBus message tracing
Contribute
This is an open source project, and we gladly accept new contributions and contributors.
Enhancing the instrumentation to support other triggers
Enhacing the instrumentation is easy, as you only have to advance the interceptor logic in class FunctionInvocationInterceptor.
...
public void Intercept(IInvocation invocation)
{
var attr = invocation.Method.GetCustomAttributes(typeof(FunctionNameAttribute), true);
if (attr != null)
{
//check for incoming htttprequest
var httpReq = invocation.Arguments.Where(a => a.GetType().IsSubclassOf(typeof(HttpRequest))).SingleOrDefault() as HttpRequest;
ActivityContext parentContext = httpReq != null ? ExtractParentContext(httpReq) : default;
AzureFunctionsCoreInstrumentation.TraceAsync(tracerProvider, ((FunctionNameAttribute)attr[0]).Name, () =>
{
invocation.Proceed();
return Task.FromResult(invocation.ReturnValue);
}, parentContext);
}
}
Support
This project is not an offical release of Dynatrace. If you have questions or any problems, open a github issue.
License
Licensed under Apache 2.0 license. See LICENSE for details.
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. |
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. |
-
.NETStandard 2.1
- Azure.Messaging.ServiceBus (>= 7.11.1)
- Castle.Core (>= 5.1.0)
- Dynatrace.OpenTelemetry.Instrumentation.AzureFunctions.Core (>= 1.249.1)
- Microsoft.AspNetCore.Http.Abstractions (>= 2.2.0)
- Microsoft.Azure.Functions.Extensions (>= 1.1.0)
- OpenTelemetry (>= 1.3.1)
- OpenTelemetry.Api (>= 1.3.1)
- System.Text.Json (>= 6.0.3)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on PaTh.AzureFunctions.Tracing:
Package | Downloads |
---|---|
PaTh.AzureFunctions.Tracing.Extra
An Azure Function startup class leveraging PaTh.AzureFunctions.Tracing to enable tracing with OpenTelemetry and Dynatrace. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.1.1-beta | 200 | 4/6/2023 |
1.1.0-beta | 2,269 | 11/14/2022 |
1.0.0-beta | 522 | 9/22/2022 |
0.10.0-beta | 117 | 9/6/2022 |
0.9.2-beta | 131 | 5/24/2022 |
0.9.1-beta | 142 | 5/17/2022 |
Fixing exception with non-task function return values.