{"id":24641500,"url":"https://github.com/clarkie/hapi-cloudwatch","last_synced_at":"2025-05-12T15:09:22.223Z","repository":{"id":57260847,"uuid":"82829702","full_name":"clarkie/hapi-cloudwatch","owner":"clarkie","description":"Hapi plugin to send response metrics to AWS CloudWatch","archived":false,"fork":false,"pushed_at":"2019-09-17T09:42:53.000Z","size":118,"stargazers_count":7,"open_issues_count":1,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-01T09:05:40.387Z","etag":null,"topics":["aws","cloudwatch","hapi-plugin","hapijs","metrics"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/clarkie.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-22T16:55:22.000Z","updated_at":"2023-03-08T04:59:45.000Z","dependencies_parsed_at":"2022-09-08T20:40:46.821Z","dependency_job_id":null,"html_url":"https://github.com/clarkie/hapi-cloudwatch","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clarkie%2Fhapi-cloudwatch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clarkie%2Fhapi-cloudwatch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clarkie%2Fhapi-cloudwatch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clarkie%2Fhapi-cloudwatch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/clarkie","download_url":"https://codeload.github.com/clarkie/hapi-cloudwatch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235575655,"owners_count":19012159,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","cloudwatch","hapi-plugin","hapijs","metrics"],"created_at":"2025-01-25T12:13:47.788Z","updated_at":"2025-01-25T12:13:48.357Z","avatar_url":"https://github.com/clarkie.png","language":"JavaScript","readme":"# hapi-cloudwatch\n\nA hapi plugin for sending request response time metrics to AWS CloudWatch.\n\n[![Build Status](https://travis-ci.org/clarkie/hapi-cloudwatch.png?branch=master)](https://travis-ci.org/clarkie/hapi-cloudwatch)\n[![Coverage Status](https://coveralls.io/repos/github/clarkie/hapi-cloudwatch/badge.svg)](https://coveralls.io/github/clarkie/hapi-cloudwatch)\n[![npm version](https://badge.fury.io/js/hapi-cloudwatch.svg)](http://badge.fury.io/js/hapi-cloudwatch)\n[![Dependencies Status](https://david-dm.org/clarkie/hapi-cloudwatch.svg)](https://david-dm.org/clarkie/hapi-cloudwatch)\n[![DevDependencies Status](https://david-dm.org/clarkie/hapi-cloudwatch/dev-status.svg)](https://david-dm.org/clarkie/hapi-cloudwatch#info=devDependencies)\n[![Known Vulnerabilities](https://snyk.io/test/npm/hapi-cloudwatch/badge.svg)](https://snyk.io/test/npm/hapi-cloudwatch)\n\n## Installation\n\n\tnpm install hapi-cloudwatch\n\n## Usage\n\nTo install this plugin on your Hapi server, do something similar to this:\n\n```js\nvar Hapi = require('hapi');\nvar server = new Hapi.Server();\n\nvar options = {};\n\nserver.register({ register: require('hapi-cloudwatch'), options }, function(err) {\n  if (err) {\n    console.log('error', 'Failed loading plugin: hapi-cloudwatch');\n  }\n});\n```\n\n## Plugin Options\n\n### `region`\n\nAWS region to send the metrics to.\n\nDefaults to `eu-west-1`\n\n### `environment`\n\nThe primary dimension added to the CloudWatch metric\n\nDefaults to `process.env.NODE_ENV`\n\n### `enabled`\n\nTurns on/off the sending of metrics to CloudWatch\n\nDefaults to `true`\n\n### `metricsSentCallback`\n\nA function to call when metrics have been sent to CloudWatch.\n\nDefaults to no-op.\n\n## Example\n\nA Hapi route configured like this:\n\n```js\nserver.route({\n  method: 'GET',\n  path: '/products/{id}',\n  handler: function(request, reply) {\n    reply('Success!');\n  }\n});\n```\nand run with `NODE_ENV=production npm start` will send a metric to AWS CloudWatch with the following dimensions:\n\n- metric name: `responseTime`\n- environment: `production`\n- method: `GET`\n- statusCode: `200`\n- path: `/products/{id}`\n\nHere's an example of what can be graphed in CloudWatch with this metric:\n\n![Example CloudWatch Graph](./exampleGraph.png)\n\n\n## Version Compatibility\n\n### Currently in use by me with with: Hapi 16.1.0 (Node v6)\n\n_I'll add tests for other hapi and node versions shortly_\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclarkie%2Fhapi-cloudwatch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclarkie%2Fhapi-cloudwatch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclarkie%2Fhapi-cloudwatch/lists"}