Security News
PyPI Introduces Digital Attestations to Strengthen Python Package Security
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
cloud-functions-metrics-service
Advanced tools
Node.js library to save serverless metrics from openwhisk to IBM Cloud Monitoring Service
This project uses IBM Cloud Monitoring to save metrics from IBM Cloud Functions.
Metrics collected by the openwhisk-metrics library are forwarded into the external monitoring service.
Metrics can be forwarded into IBM Cloud Monitoring in real-time or sent in batches using a background process.
Install OpenWhisk metrics and IBM Cloud Monitoring service libraries
$ npm install openwhisk-metrics cloud-functions-metrics-service
Wrap action handlers using external libraries
const metrics = require('openwhisk-metrics')
const service = require('cloud-functions-metrics-service')
metrics.service = service.client({
host: 'metrics.ng.bluemix.net',
scope: '...',
api_key: '...'
})
const main = params => {
return { message: "Hello World" }
}
exports.main = metrics(main)
Configuration options for the openwhisk-metrics
library are available in the project repository.
Configuration options for the IBM Cloud Monitoring service are available in the project repository.
Metrics forwarded using external real-time ingestion will not be logged to the console. If you want to enable this for debugging or testing, use this code snippet.
const client = service.client({
host: 'metrics.ng.bluemix.net',
scope: '...',
api_key: '...'
})
const log = metrics.service
metrics.service = values => {
log.save(values)
return client.save(values)
}
Set up action handlers with openwhisk-metrics
const metrics = require('openwhisk-metrics')
const main = params => {
return { message: "Hello World" }
}
module.exports.main = metrics(main)
All actions you want to collect metrics for should use the library as above. Use the action names in the configuration below for the background task.
Download project repository
$ git clone https://github.com/jthomas/cloud-functions-metrics-service
$ cd cloud-functions-metrics-service
Create action deployment package.
$ npm install
$ zip -r action.zip index.js package.json lib node_modules
Fill in authentication parameters in action configuration file (config.json
).
{
"actions": ["action_names_to_monitor"],
"service": {
"host": "metrics.ng.bluemix.net",
"scope": "...",
"api_key": "..."
}
}
Configuration options for the IBM Cloud Monitoring service are available in the project repository.
Create new OpenWhisk action from deployment package and configuration file.
$ wsk action create metric-forwarder --kind nodejs:8 action.zip --param-file config.json
Create trigger feed for alarm package to run metric-forwarder
on periodic schedule.
$ wsk trigger create interval \
--feed /whisk.system/alarms/interval \
--param minutes 10 \
Bind trigger to action using rule.
$ wsk rule create forward-metrics-on-interval interval metric-forwarder
FAQs
Node.js library to save serverless metrics from openwhisk to IBM Cloud Monitoring Service
The npm package cloud-functions-metrics-service receives a total of 0 weekly downloads. As such, cloud-functions-metrics-service popularity was classified as not popular.
We found that cloud-functions-metrics-service demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.