signalfx-azure-functions
1.0.0
dotnet add package signalfx-azure-functions --version 1.0.0
NuGet\Install-Package signalfx-azure-functions -Version 1.0.0
<PackageReference Include="signalfx-azure-functions" Version="1.0.0" />
paket add signalfx-azure-functions --version 1.0.0
#r "nuget: signalfx-azure-functions, 1.0.0"
// Install signalfx-azure-functions as a Cake Addin #addin nuget:?package=signalfx-azure-functions&version=1.0.0 // Install signalfx-azure-functions as a Cake Tool #tool nuget:?package=signalfx-azure-functions&version=1.0.0
SignalFx C# Azure Function Wrapper
SignalFx C# Azure Function Wrapper.
Usage
The SignalFx C# Azure Function Wrapper is a wrapper around an Azure Function, used to instrument execution of the function and send metrics to SignalFx.
Install via NuGet
Add the following package reference to your .csproj
or function.proj
<PackageReference Include="signalfx-azure-functions" Version="1.0.0"/>
Using the Metric Wrapper
Create a MetricWrapper with the ExecutionContext Wrap your code in try-catch-finally, disposing of the wrapper finally.
using azurefunctioncsharp
...
[FunctionName("HttpTrigger")]
public static IActionResult Run([HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)]HttpRequest req, TraceWriter log, ExecutionContext context)
{
log.Info("C# HTTP trigger function processed a request.");
MetricWrapper wrapper = new MetricWrapper(context);
try {
...
// your code
...
return ResponseObject
} catch (Exception e) {
wrapper.Error();
} finally {
wrapper.Dispose();
}
}
Environment Variable
Set the Azure Function environment variables as follows:
- Set authentication token:
SIGNALFX_AUTH_TOKEN=signalfx token
- Optional parameters available:
SIGNALFX_API_HOSTNAME=[pops.signalfx.com]
SIGNALFX_API_PORT=[443]
SIGNALFX_API_SCHEME=[https]
SIGNALFX_SEND_TIMEOUT=milliseconds for signalfx client timeout [2000]
Metrics and dimensions sent by the wrapper
The Azure Function Wrapper sends the following metrics to SignalFx:
Metric Name | Type | Description |
---|---|---|
azure.function.invocations | Counter | Count number of function invocations |
azure.function.errors | Counter | Count number of errors from underlying function |
azure.function.duration | Gauge | Milliseconds in execution time of underlying function |
The function wrapper adds the following dimensions to all data points sent to SignalFx:
Dimension | Description |
---|---|
azure_region | Azure Region where the function is executed |
azure_function_name | Name of the function |
azure_resource_name | Name of the function app where the function is running |
function_wrapper_version | SignalFx Function Wrapper qualifier (e.g. signalfx-azurefunction-0.0.11) |
is_Azure_Function | Used to differentiate between Azure App Service and Azure Function metrics |
metric_source | The literal value of 'azure_function_wrapper' |
Sending a custom metric from the Azure Function
using com.signalfuse.metrics.protobuf;
// construct a data point
DataPoint dp = new DataPoint();
// use Datum to set the value
Datum datum = new Datum();
datum.intValue = 1;
// set the name, value, and metric type on the datapoint
dp.metric = "metric_name";
dp.metricType = MetricType.GAUGE;
dp.value = datum;
// add custom dimension
Dimension dim = new Dimension();
dim.key = "applicationName";
dim.value = "CoolApp";
dp.dimensions.Add(dim);
// send the metric
MetricSender.sendMetric(dp);
Testing locally.
Follow the Azure instructions to run functions locally https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-csharp
Install as shown above by adding the dependency to
function.proj
or.csproj
License
Apache Software License v2. Copyright © 2014-2017 SignalFx
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 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. 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. |
-
.NETStandard 2.0
- Google.ProtocolBuffers (>= 2.4.1.555)
- log4net (>= 2.0.8)
- Microsoft.Azure.WebJobs.Extensions (>= 2.2.0)
- protobuf-net (>= 2.0.0.668)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.0 | 1,250 | 5/17/2018 |