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
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="signalfx-azure-functions" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add signalfx-azure-functions --version 1.0.0
#r "nuget: signalfx-azure-functions, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// 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:

  1. Set authentication token:
 SIGNALFX_AUTH_TOKEN=signalfx token
  1. 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.

  1. Follow the Azure instructions to run functions locally https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-csharp

  2. Install as shown above by adding the dependency to function.proj or .csproj

License

Apache Software License v2. Copyright © 2014-2017 SignalFx

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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,202 5/17/2018