Skip to content

Commit

Permalink
Merge pull request #2534 from blackflux/dev
Browse files Browse the repository at this point in the history
[Gally]: master <- dev
  • Loading branch information
simlu authored May 21, 2021
2 parents 4afaa57 + e09f903 commit d643e94
Show file tree
Hide file tree
Showing 7 changed files with 1,786 additions and 2,163 deletions.
24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
},
"homepage": "https://github.com/blackflux/lambda-monitor#readme",
"dependencies": {
"aws-sdk": "2.868.0",
"aws-sdk-wrap": "9.2.7",
"aws-sdk": "2.912.0",
"aws-sdk-wrap": "9.5.1",
"datadog-light": "3.0.0",
"lambda-async": "2.0.0",
"lambda-cfn-hook": "2.0.2",
Expand All @@ -58,30 +58,30 @@
"smart-fs": "2.0.2"
},
"devDependencies": {
"@babel/cli": "7.13.10",
"@babel/core": "7.13.10",
"@babel/register": "7.13.8",
"@babel/cli": "7.14.3",
"@babel/core": "7.14.3",
"@babel/register": "7.13.16",
"@blackflux/eslint-plugin-rules": "2.0.3",
"@blackflux/robo-config-plugin": "5.0.0",
"@blackflux/robo-config-plugin": "5.1.0",
"babel-eslint": "10.1.0",
"babel-preset-latest-node": "5.5.1",
"chai": "4.3.4",
"coveralls": "3.1.0",
"eslint": "7.22.0",
"eslint": "7.26.0",
"eslint-config-airbnb-base": "14.2.1",
"eslint-plugin-import": "2.22.1",
"eslint-plugin-json": "2.1.2",
"eslint-plugin-markdown": "2.0.0",
"eslint-plugin-import": "2.23.3",
"eslint-plugin-json": "3.0.0",
"eslint-plugin-markdown": "2.1.0",
"eslint-plugin-mocha": "8.1.0",
"js-gardener": "3.0.3",
"lambda-tdd": "3.0.6",
"minimist": "1.2.5",
"mocha": "8.3.2",
"mocha": "8.4.0",
"nock": "13.0.11",
"node-tdd": "3.0.4",
"nyc": "15.1.0",
"robo-config": "4.0.4",
"semantic-release": "17.4.2"
"semantic-release": "17.4.3"
},
"licenses": [
{
Expand Down
21 changes: 16 additions & 5 deletions src/logic/logger/message/datadog.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
const get = require('lodash.get');
const datadogDistributionMetric = require('../singleton/datadog-distribution-metric');

module.exports = ({ message }) => {
module.exports = ({
logGroup, level, message, timestamp
}) => {
let parsedMessage = {};
try {
parsedMessage = JSON.parse(message);

if (get(parsedMessage, ['type']) === 'distribution-metric') {
datadogDistributionMetric.enqueue(...get(parsedMessage, ['args']));
}
} catch (e) {
/* ignored */
}
if (get(parsedMessage, ['type']) === 'distribution-metric') {
datadogDistributionMetric.enqueue(...get(parsedMessage, ['args']));
}
datadogDistributionMetric.enqueue(
'aws.lambda_monitor.lambda.log_count',
[timestamp * 1000],
{
tags: [
`level:${level}`,
`fnName:${logGroup.replace(/^\/aws\/lambda\//, '')}`
]
}
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,23 @@
"environment:local-dev"
]
},
{
"metric": "aws.lambda_monitor.lambda.log_count",
"points": [
[
1511405879000,
[
1
]
]
],
"type": "distribution",
"tags": [
"level:warning",
"fnName:peg-solitiare-dev-overview",
"environment:local-dev"
]
},
{
"metric": "aws.lambda_monitor.lambda.execution_duration",
"points": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,23 @@
"path": "/api/v1/distribution_points?api_key=INVALID_DATADOG_API_KEY",
"body": {
"series": [
{
"metric": "aws.lambda_monitor.lambda.log_count",
"points": [
[
1511405879000,
[
1
]
]
],
"type": "distribution",
"tags": [
"level:warning",
"fnName:peg-solitiare-dev-overview",
"environment:local-dev"
]
},
{
"metric": "aws.lambda_monitor.lambda.execution_duration",
"points": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,23 @@
"environment:local-dev"
]
},
{
"metric": "aws.lambda_monitor.lambda.log_count",
"points": [
[
1511405879000,
[
1
]
]
],
"type": "distribution",
"tags": [
"level:warning",
"fnName:peg-solitiare-dev-overview",
"environment:local-dev"
]
},
{
"metric": "aws.lambda_monitor.lambda.execution_duration",
"points": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,23 @@
"path": "/api/v1/distribution_points?api_key=INVALID_DATADOG_API_KEY",
"body": {
"series": [
{
"metric": "aws.lambda_monitor.lambda.log_count",
"points": [
[
1511405879000,
[
1
]
]
],
"type": "distribution",
"tags": [
"level:warning",
"fnName:peg-solitiare-dev-overview",
"environment:local-dev"
]
},
{
"metric": "aws.lambda_monitor.lambda.execution_duration",
"points": [
Expand Down
Loading

0 comments on commit d643e94

Please sign in to comment.