npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

signalfx-azure-functions

v0.0.10

Published

Node.js Azure functions wrapper for SignalFx

Downloads

1

Readme

SignalFx Node Azure Function Wrapper

SignalFx Node Azure Function Wrapper.

Usage

The SignalFx NodeJS Azure Function Wrapper is a wrapper around an Azure Function NodeJS function handler, used to instrument execution of the function and send metrics to SignalFx.

Installation

Use the hosted package:

{
  "name": "my-module",
  "dependencies": {
    "signalfx-azure-functions": "^0.0.10"
  }
}

Wrap your function handler

'use strict';

const signalFxAzureFunction = require('signalfx-azure-functions');

module.exports = signalFxAzureFunction.wrapper((context, some_binding_obj, callback) => {
  context.res = myFunc(context, some_binding_obj);
  callback();
});
  • By default, only 1 binding trigger object is passed through the wrapper. If you have multiple, you may need to modify your function to access them through the context object (e.g. context.bindings.myInput).
  • The function wrapper will call context.done() in the callback itself.

Environment Variables

 SIGNALFX_AUTH_TOKEN=signalfx token

Optional parameters available:

SIGNALFX_SEND_TIMEOUT=milliseconds for signalfx client timeout [1000]

# Change the ingest endpoint URL:
SIGNALFX_INGEST_ENDPOINT=[https://pops.signalfx.com]

Metrics and dimensions sent by the wrapper

The 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 handler| | azure.function.duration | Gauge | Milliseconds in execution time of underlying function handler|

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 metric from the Azure function

'use strict';

const signalFxAzureFunction = require('signalfx-azure-functions');

module.exports = signalFxAzureFunction.wrapper((context, some_binding_obj, callback) => {
  ....
  signalFxAzureFunction.helper.sendGauge('gauge.name', value);
  callback();
});

Deployment

Run npm pack to package the module with the configuration in package.json.

Testing locally

  1. Set up the local Azure Function runtime: https://docs.microsoft.com/en-us/azure/azure-functions/functions-run-local

  2. Add the environment variables described above to your local.settings.json

  3. Wrap function as stated above, run the runtime.

License

Apache Software License v2. Copyright © 2014-2017 SignalFx