@telemetry-js/processor-ec2-instance-tags

0.2.1 • Public • Published

processor-ec2-instance-tags

Copy tags of EC2 instance to metrics.
A telemetry plugin.

npm status node Test JavaScript Style Guide

Table of Contents

Click to expand

Usage

const telemetry = require('@telemetry-js/telemetry')()
const tags = require('@telemetry-js/processor-ec2-instance-tags')

telemetry.task()
  .process(tags)

// Or with options
telemetry.task()
  .process(tags, { include: ['name', 'version'] })

Options

  • case: optional function to normalize a tag. E.g. (key) => key.toLowerCase(). The default behavior is to lowercase the key and strip any characters outside of [a-z0-9]. If the EC2 instance has a Project tag for example, metrics will be tagged with project.
  • include: optional array of tags to include, normalized. E.g. ['project']. By default all tags are included.
  • filter: optional function to filter tags. E.g. (key) => key === 'project'. Takes precedence over options.include.

Cached variant

By default, each instance of this plugin fetches EC2 instance metadata and tags itself. To only fetch once (with a semiglobal cache) use:

const tags = require('@telemetry-js/processor-ec2-instance-tags').cached

Install

With npm do:

npm install @telemetry-js/processor-ec2-instance-tags

Acknowledgements

This project is kindly sponsored by Reason Cybersecurity Ltd.

reason logo

License

MIT © Vincent Weevers

Package Sidebar

Install

npm i @telemetry-js/processor-ec2-instance-tags

Weekly Downloads

0

Version

0.2.1

License

MIT

Unpacked Size

7.56 kB

Total Files

4

Last publish

Collaborators

  • vweevers