{"_id":"@alexmcarrow/metricfromfuture","_rev":"3-68088b04bf7e02f2bd4684d3b432bcf6","name":"@alexmcarrow/metricfromfuture","dist-tags":{"latest":"0.2.18"},"versions":{"0.2.17":{"name":"@alexmcarrow/metricfromfuture","version":"0.2.17","description":"Metric Server with realtime calculation","main":"./server.js","scripts":{"test":"node server.js","start":"node ./dist/mff.js","build":"webpack --config webpack.config.js"},"keywords":["metric","server","realtime","rpc"],"repository":{"type":"git","url":"git+https://github.com/AlexMcArrow/MetricFromFuture.git"},"author":{"name":"AlexMcArrow","email":"alex.mcarrow@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/AlexMcArrow/MetricFromFuture/issues"},"homepage":"https://github.com/AlexMcArrow/MetricFromFuture#readme","publishConfig":{"registry":"https://registry.npmjs.org/"},"devDependencies":{"terser-webpack-plugin":"^5.2.4","webpack":"^5.58.2","webpack-cli":"^4.9.0"},"gitHead":"d2afa2d55002c3264729684452c2d54188d52874","_id":"@alexmcarrow/metricfromfuture@0.2.17","_nodeVersion":"14.17.5","_npmVersion":"6.14.14","dist":{"integrity":"sha512-wNn9jqMm9LzsnWRE1KilM1cCUjC2HcbuTDq9ksUFOF1KGyZrmN7FDPNxItg/mAvxBpl0OgabXTsE6za37HAMXQ==","shasum":"7b1fcbde16186682151aca5cb23036e3ce6b343d","tarball":"https://registry.npmjs.org/@alexmcarrow/metricfromfuture/-/metricfromfuture-0.2.17.tgz","fileCount":9,"unpackedSize":23022,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHlyQhbJmU1SdWIGklXICiIArxHQO9ajbf/kryPp3TcKAiEA0oNRWSefetgc/v6r4mmOlYoWgo7zdaKNM1NFyQSpQeI="}]},"_npmUser":{"name":"alex.mcarrow","email":"alex.mcarrow@gmail.com"},"directories":{},"maintainers":[{"name":"alex.mcarrow","email":"alex.mcarrow@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/metricfromfuture_0.2.17_1634418606099_0.9075312175625498"},"_hasShrinkwrap":false},"0.2.18":{"name":"@alexmcarrow/metricfromfuture","version":"0.2.18","description":"Metric Server with realtime calculation","main":"./server.js","scripts":{"test":"node server.js","start":"node ./dist/mff.js","build":"webpack --config webpack.config.js"},"keywords":["metric","server","realtime","rpc"],"repository":{"type":"git","url":"git+https://github.com/AlexMcArrow/MetricFromFuture.git"},"author":{"name":"AlexMcArrow","email":"alex.mcarrow@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/AlexMcArrow/MetricFromFuture/issues"},"homepage":"https://github.com/AlexMcArrow/MetricFromFuture#readme","devDependencies":{"copy-webpack-plugin":"^9.0.1","glob":"^7.2.0","terser-webpack-plugin":"^5.2.4","uglify-js":"^3.14.2","webpack":"^5.59.0","webpack-cli":"^4.9.1","zip-webpack-plugin":"^4.0.1"},"gitHead":"ac8a1b4d3cc9f575170b712747817c00fc0f2543","_id":"@alexmcarrow/metricfromfuture@0.2.18","_nodeVersion":"14.17.5","_npmVersion":"6.14.14","dist":{"integrity":"sha512-r5rZhCC1ZkkvJsW3mRwdgWOVz+J3/mlKODjD2dYPfsm6hyZf7xO7RiCtX0RwvlVeejIJFUJfk75YkeXG0SCfRQ==","shasum":"050f25fdeaa553e74b29aaff3a8eba03aadaa946","tarball":"https://registry.npmjs.org/@alexmcarrow/metricfromfuture/-/metricfromfuture-0.2.18.tgz","fileCount":11,"unpackedSize":30814,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhxI/UCRA9TVsSAnZWagAA9RAP/irNkeRPCgEwfK2iXzge\nnRcjoVxRiCtrfO2+SBQpY7tIZrdDZKn6ci3CMZXsny8OXh0P/Ce4Cs4ujtNC\nvVYTCf6UQvnbbtLj4TvGNCbbk/g+LkV9QsPkyFuEfrel/a4NayekTOvSiEdV\nQ9Cft3AW/4CPcZ/ED5ljOBtfE3WmSqqI3btxw9E5TP/5/hJ0ZFyU0bMNOs9w\nope87Rn/gVyOdV4CVNPTfKhFiNp8gXnTLZCfUuM7LTceVGgR0LSvjdt/gLzy\nvXh+RXETVRQJDiwPJoVKwT4VaSnFLADzV+Imn8h6YyE9wPz9QMtaCQhDzxEL\n1yMTjTihISetS9EWIb986Bw7TUcUzjbWFVX7kQnRDZx5d1pLb7K9l+ELKvpd\nKXYtrxFQwCJyQqNGnufzy03J1/R2XJKQ7hM9Zaq7XggTwADtfj0a36zEomWA\nWXVCTVtOH6PMtphX+kOhylrgsi/rRDIBWaKS2jki1FwPflWksuij3JrV1J3d\n/5juWLgTMpBBMUyBZJydSPt/4u95cQwSDOELMJojwtmPH4vFHj5sv3LKhnP5\nw/FR7HJmGob8n11rmrEPzdfhBGNUWkCKvTtKygjfcRmX04SfQQfVn0jO+GbA\nrPyx/84g6eBAsbHAvFJxrzvqos9k1qRdOmhT4oPHuLJhstik8pkFe6H+KWwq\nBe5y\r\n=cQmO\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCZf34JiXs2gSOHgsNusw/5yKO+Aj+ofuR3iTnkxIelzAIgb7/z6jY3/HA1XGMnEEFb7tdDnFKkhEUgiCMQDodlljo="}]},"_npmUser":{"name":"alex.mcarrow","email":"alex.mcarrow@gmail.com"},"directories":{},"maintainers":[{"name":"alex.mcarrow","email":"alex.mcarrow@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/metricfromfuture_0.2.18_1634711834224_0.21493327271530727"},"_hasShrinkwrap":false}},"time":{"created":"2021-10-16T21:10:06.055Z","0.2.17":"2021-10-16T21:10:06.201Z","modified":"2022-04-04T12:41:16.344Z","0.2.18":"2021-10-20T06:37:14.382Z"},"maintainers":[{"name":"alex.mcarrow","email":"alex.mcarrow@gmail.com"}],"description":"Metric Server with realtime calculation","homepage":"https://github.com/AlexMcArrow/MetricFromFuture#readme","keywords":["metric","server","realtime","rpc"],"repository":{"type":"git","url":"git+https://github.com/AlexMcArrow/MetricFromFuture.git"},"author":{"name":"AlexMcArrow","email":"alex.mcarrow@gmail.com"},"bugs":{"url":"https://github.com/AlexMcArrow/MetricFromFuture/issues"},"license":"MIT","readme":"# Metric From Future\n\n[![CodeQL](https://github.com/AlexMcArrow/MetricFromFuture/actions/workflows/codeql-analysis.yml/badge.svg?branch=master)](https://github.com/AlexMcArrow/MetricFromFuture/actions/workflows/codeql-analysis.yml)\n\n`v0.2.18`\n\nMetric Server for calculation timing of script execution time\n\n* When script is run, metric use script execution time\n* When script is end with unix-code=0, metric use STDOUT as integer of script measuring\n* When script is end with unix-code>0, metric use 1000 second execution time - as error signal\n\n---\n\n## Lifecycle\n\nThe Collector for each Metric starts the Runner with the specified frequency.\n\nThe launch of a new Runner is not limited to the already / still working Runners of this Metric.\n\nEach Runner starts with time = `-1` to handle fast execution correctly. Then its execution time will tend to a value equal to `0` .\n\nRunner's working hours are not limited.\n\nThe collector with a frequency of `1` (one) second removes the current running time of the Runner (s). The highest value is more significant. This value is considered a `LIVE` -value.\n\nWhen the Runner finishes working, he outputs to `STDOUT` the value that determines the time that the script has measured and considers it necessary to consider `SAVE` -value.\n\nThe `SAVE` -value is considered correct as long as it is less than any `LIVE` -value of the Runners of this Metric.\n\n---\n\n## Used ENVs\n\n| ENV | description |\n| ------------ | ----------- |\n| `NODE_ENV` | If not `production` redefine `PATH_LOG` & `PATH_CONFIG` to local logs-folder & local config.json |\n| `PATH_LOG` | Path (folder) to logs folder |\n| `PATH_CONFIG` | Path (file) to config.json |\n\n## Example of `config.json` (see: config.json._)\n\n```json\n{\n    \"server\": {\n        \"port\": 20744,\n        \"logs\": false\n    },\n    \"metric\": {\n        \"check\": {\n            \"interval\": 15,\n            \"run\": \"/usr/bin/sh /home/user/check.sh\",\n            \"notice\": 20,\n            \"warning\": 35,\n            \"error\": 45,\n            \"history\": 10,\n            \"call\": \"/usr/bin/sh /home/user/send.sh --metric=$1 --level=$2 --time=$3\"\n        },\n    }\n}\n```\n\n## `config.json` structure\n\n| JSON-section | type | description |\n| ------------ | ---- | ----------- |\n| `server.port` | integer | MFF HTTP-RPC port |\n| `server.logs` | boolean | MFF can generate log-files |\n| `metric.[name]` | string | Metric section |\n| `metric.[name].interval` | integer | Metric execution interval |\n| `metric.[name].run` | string | Metric execution script |\n| `metric.[name].notice` | integer | Metric NOTICE timing |\n| `metric.[name].warning` | integer | Metric WARNING timing |\n| `metric.[name].error` | integer | Metric ERROR timing |\n| `metric.[name].history` | integer | Metric history storage size |\n| `metric.[name].call` | RegExp-string | Metric history execution script on (notice, warning, error) <br> Can use RegExp params: <br> $1 - Metric name `[check]` <br> $2 - Logging level `[notice\\|warning\\|error]` <br> $3 - Metric timing `[10]` |\n\n## Logs\n\nEach metric creates a file of the same name in the logs folder\nThis log file contains records of not `OK` work ( `notice` , `warning` , `error` )\n\n```log\n1634225398829|2021-10-14T15:29:58.829Z|alpha|notice|10\n1634225398829|2021-10-14T15:29:58.829Z|alpha|warning|20\n1634225398829|2021-10-14T15:29:58.829Z|alpha|error|1000\n```\n\n## Log file structure (example by first row)\n\n| section | type | description |\n| ------------ | ---- | ----------- |\n| `1634225398829` | integer | Unixtimestamp of record create |\n| `2021-10-14T15:29:58.829Z` | datetimez | UTC formated date-time |\n| `alpha` | string | Metric name |\n| `notice` | string | Logging level |\n| `10` | integer | Metric timing |\n\n## HTTP-RPC\n\n| URI-path | vars | description |\n| ------------ | ---- | ----------- |\n| `/` | --- | root of rpc |\n| `/?get=*` | --- | get all metrics data |\n| `/?get=all` | --- | get all metrics data |\n| `/?get=[name]` | `name` - metric name | get specific metric data  |\n| `/?get=_sys` | --- | Metric name |\n\n## Example of output for URI-path = `/`\n\n```json\n{\n    \"c\": 1,\n    \"d\": { }\n}\n```\n\n| JSON-section | type | description |\n| ------------ | ---- | ----------- |\n| `c` | integer | Result code |\n| `d` | string | Data section |\n\n## Example of output for URI-path = `/?get=*` or `/?get=all`\n\n```json\n{\n    \"c\": 1,\n    \"d\": {\n        \"alpha\": {\n            \"v\": 5,\n            \"t\": 1634412899058,\n            \"dt\": \"2021-10-16T19:34:59.058Z\",\n            \"hist\": {\n                \"1634710497731\": {\n                    \"v\": 40,\n                    \"t\": 1634710497731,\n                    \"dt\": \"2021-10-20T06:14:57.731Z\"\n                },\n            }\n        }\n    }\n}\n```\n\n| JSON-section | type | description |\n| ------------ | ---- | ----------- |\n| `c` | integer | Result code |\n| `d` | string | Data section |\n| `d.[name]` | object | Metric section |\n| `d.[name].v` | int | Actual timing for metric |\n| `d.[name].t` | int | Unixtimestamp (with milliseconds) for actual timing |\n| `d.[name].dt` | int | Datetime for actual timing |\n| `d.[name].hist` | object | History block |\n| `d.[name].hist.[histblock]` | string | Unixtimestamp (with milliseconds) of history block |\n| `d.[name].hist.[histblock].v` | int | History timing |\n| `d.[name].hist.[histblock].t` | int | History Unixtimestamp (with milliseconds) |\n| `d.[name].hist.[histblock].dt` | string | History Datetime |\n\n## Example of output for URI-path = `/?get=[name]`\n\n```json\n{\n    \"c\": 1,\n    \"d\": {\n        \"v\": 5,\n        \"t\": 1634413031384,\n        \"dt\": \"2021-10-16T19:37:11.384Z\",\n        \"hist\": {\n            \"1634710497731\": {\n                \"v\": 40,\n                \"t\": 1634710497731,\n                \"dt\": \"2021-10-20T06:14:57.731Z\"\n            },\n        }\n    }\n}\n```\n\n| JSON-section | type | description |\n| ------------ | ---- | ----------- |\n| `c` | integer | Result code |\n| `d` | string | Data section |\n| `d.v` | int | Actual timing for metric |\n| `d.t` | int | Unixtimestamp for actual timing |\n| `d.dt` | int | Datetime for actual timing |\n| `d.hist` | object | History block |\n| `d.hist.[histblock]` | string | Unixtimestamp (with milliseconds) of history block |\n| `d.hist.[histblock].v` | int | History timing |\n| `d.hist.[histblock].t` | int | History Unixtimestamp (with milliseconds) |\n| `d.hist.[histblock].dt` | string | History Datetime |\n\n## Example of output for URI-path = `/?get=_sys`\n\n```json\n{\n    \"c\": 1,\n    \"d\": {\n        \"alpha\": {\n            \"v\": 5,\n            \"t\": 1634413183725,\n            \"dt\": \"2021-10-16T19:39:43.725Z\",\n            \"hist\": {\n                \"1634710497731\": {\n                    \"v\": 40,\n                    \"t\": 1634710497731,\n                    \"dt\": \"2021-10-20T06:14:57.731Z\"\n                },\n            },\n            \"r\": {\n                \"6ad5e63d9b3f2dd54442c19bc64908a5\": -1\n            }\n        }\n    }\n}\n```\n\n| JSON-section | type | description |\n| ------------ | ---- | ----------- |\n| `c` | integer | Result code |\n| `d` | string | Data section |\n| `d.[name]` | object | Metric section |\n| `d.[name].v` | int | Actual timing for metric |\n| `d.[name].t` | int | Unixtimestamp for actual timing |\n| `d.[name].dt` | int | Datetime for actual timing |\n| `d.[name].hist` | object | History block |\n| `d.[name].hist.[histblock]` | string | Unixtimestamp (with milliseconds) of history block |\n| `d.[name].hist.[histblock].v` | int | History timing |\n| `d.[name].hist.[histblock].t` | int | History Unixtimestamp (with milliseconds) |\n| `d.[name].hist.[histblock].dt` | string | History Datetime |\n| `d.[name].r` | object | List of exucuted Runners for this metric |\n| `d.[name].r[id]` | string | ID of exucuted Runner |\n| `d.[name].r[id]=[value]` | int | Time of Runner execution |\n\n## License\n\nThe MIT License (MIT).\n\nPlease see [ `LICENSE` ](./LICENSE) for more information.\n\nMaintained by [Alex McArrow](https://github.com/AlexMcArrow)\n","readmeFilename":"README.md"}