Skip to content

Commit

Permalink
feat: add ErrorReporting support
Browse files Browse the repository at this point in the history
  • Loading branch information
SantiMA10 committed Oct 31, 2020
1 parent 1b204f1 commit 60b2a99
Show file tree
Hide file tree
Showing 5 changed files with 139 additions and 4 deletions.
1 change: 1 addition & 0 deletions services/kappa/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"typescript": "^3.9.2"
},
"dependencies": {
"@google-cloud/error-reporting": "^2.0.0",
"@hapi/hapi": "^20.0.1",
"@streamdevs/lights-lul": "^3.8.0",
"dotenv": "^8.2.0",
Expand Down
6 changes: 6 additions & 0 deletions services/kappa/src/server.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { ErrorReporting } from "@google-cloud/error-reporting";
import { Request, ResponseToolkit, Server } from "@hapi/hapi";
import { isTestEnv } from "@streamdevs/lights-lul";

export const initServer = () => {
const server = new Server({
Expand All @@ -15,5 +17,9 @@ export const initServer = () => {
},
]);

if (!isTestEnv()) {
server.register(new ErrorReporting().hapi);
}

return server;
};
1 change: 1 addition & 0 deletions services/light/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"typescript": "^3.9.2"
},
"dependencies": {
"@google-cloud/error-reporting": "^2.0.0",
"@hapi/hapi": "^20.0.1",
"@hapi/joi": "^17.1.1",
"@streamdevs/lights-lul": "^3.8.0",
Expand Down
6 changes: 6 additions & 0 deletions services/light/src/server.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { ErrorReporting } from "@google-cloud/error-reporting";
import { Server } from "@hapi/hapi";
import Joi from "@hapi/joi";
import { isTestEnv } from "@streamdevs/lights-lul";
import { routes } from "./routes";

export const initServer = () => {
Expand All @@ -10,5 +12,9 @@ export const initServer = () => {
server.validator(Joi);
server.route(routes());

if (!isTestEnv()) {
server.register(new ErrorReporting().hapi);
}

return server;
};
129 changes: 125 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,31 @@
unique-filename "^1.1.1"
which "^1.3.1"

"@google-cloud/common@^3.0.0":
version "3.4.1"
resolved "https://registry.yarnpkg.com/@google-cloud/common/-/common-3.4.1.tgz#a1920d73c38437923b4b134e245c392d36c442e9"
integrity sha512-e5z0CwsM0RXky+PnyPtQ3QK46ksqm+kE7kX8pm8X+ddBwZJipHchKeazMM5fLlGCS+AALalzXb+uYmH72TRnpQ==
dependencies:
"@google-cloud/projectify" "^2.0.0"
"@google-cloud/promisify" "^2.0.0"
arrify "^2.0.1"
duplexify "^4.1.1"
ent "^2.2.0"
extend "^3.0.2"
google-auth-library "^6.1.1"
retry-request "^4.1.1"
teeny-request "^7.0.0"

"@google-cloud/error-reporting@^2.0.0":
version "2.0.0"
resolved "https://registry.yarnpkg.com/@google-cloud/error-reporting/-/error-reporting-2.0.0.tgz#cea112c45ba32d381091bdaef0b19e108ef3bf97"
integrity sha512-c8xw2wUaLgR6W0qML2FWtWjG/OplTY/QrJjQ3X2AFFG6d660yUYq4CLXeHG8xWTmOxnU3WBEMbT8l51U5qw0tg==
dependencies:
"@google-cloud/common" "^3.0.0"
console-log-level "^1.4.1"
is "^3.3.0"
lodash.has "^4.5.2"

"@google-cloud/firestore@^4.4.0":
version "4.4.0"
resolved "https://registry.yarnpkg.com/@google-cloud/firestore/-/firestore-4.4.0.tgz#6cdbd462f32a8f94e138c57ef81195156c79e680"
Expand Down Expand Up @@ -481,11 +506,21 @@
resolved "https://registry.yarnpkg.com/@google-cloud/projectify/-/projectify-1.0.4.tgz#28daabebba6579ed998edcadf1a8f3be17f3b5f0"
integrity sha512-ZdzQUN02eRsmTKfBj9FDL0KNDIFNjBn/d6tHQmA/+FImH5DO6ZV8E7FzxMgAUiVAUq41RFAkb25p1oHOZ8psfg==

"@google-cloud/projectify@^2.0.0":
version "2.0.1"
resolved "https://registry.yarnpkg.com/@google-cloud/projectify/-/projectify-2.0.1.tgz#13350ee609346435c795bbfe133a08dfeab78d65"
integrity sha512-ZDG38U/Yy6Zr21LaR3BTiiLtpJl6RkPS/JwoRT453G+6Q1DhlV0waNf8Lfu+YVYGIIxgKnLayJRfYlFJfiI8iQ==

"@google-cloud/promisify@^1.0.0":
version "1.0.4"
resolved "https://registry.yarnpkg.com/@google-cloud/promisify/-/promisify-1.0.4.tgz#ce86ffa94f9cfafa2e68f7b3e4a7fad194189723"
integrity sha512-VccZDcOql77obTnFh0TbNED/6ZbbmHDf8UMNnzO1d5g9V0Htfm4k5cllY8P1tJsRKC3zWYGRLaViiupcgVjBoQ==

"@google-cloud/promisify@^2.0.0":
version "2.0.3"
resolved "https://registry.yarnpkg.com/@google-cloud/promisify/-/promisify-2.0.3.tgz#f934b5cdc939e3c7039ff62b9caaf59a9d89e3a8"
integrity sha512-d4VSA86eL/AFTe5xtyZX+ePUjE8dIFu2T8zmdeNBSa5/kNgXPCx/o/wbFNHAGLJdGnk1vddRuMESD9HbOC8irw==

"@google-cloud/pubsub@^1.7.0":
version "1.7.3"
resolved "https://registry.yarnpkg.com/@google-cloud/pubsub/-/pubsub-1.7.3.tgz#0fa51d67eb4db979a66b05738d81c3cef992b5bf"
Expand Down Expand Up @@ -1938,6 +1973,11 @@
dependencies:
defer-to-connect "^1.0.1"

"@tootallnate/once@1":
version "1.1.2"
resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-1.1.2.tgz#ccb91445360179a04e7fe6aff78c00ffc1eeaf82"
integrity sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==

"@types/babel__core@^7.0.0", "@types/babel__core@^7.1.7":
version "7.1.10"
resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.10.tgz#ca58fc195dd9734e77e57c6f2df565623636ab40"
Expand Down Expand Up @@ -2498,7 +2538,7 @@ arrify@^1.0.1:
resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d"
integrity sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=

arrify@^2.0.0:
arrify@^2.0.0, arrify@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/arrify/-/arrify-2.0.1.tgz#c9655e9331e0abcd588d2a7cad7e9956f66701fa"
integrity sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==
Expand Down Expand Up @@ -3435,6 +3475,11 @@ console-control-strings@^1.0.0, console-control-strings@~1.1.0:
resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e"
integrity sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=

console-log-level@^1.4.1:
version "1.4.1"
resolved "https://registry.yarnpkg.com/console-log-level/-/console-log-level-1.4.1.tgz#9c5a6bb9ef1ef65b05aba83028b0ff894cdf630a"
integrity sha512-VZzbIORbP+PPcN/gg3DXClTLPLg5Slwd5fL2MIc+o1qZ4BXBvWyc6QxPk6T/Mkr6IVjRpoAGf32XxP3ZWMVRcQ==

[email protected]:
version "0.5.3"
resolved "https://registry.yarnpkg.com/content-disposition/-/content-disposition-0.5.3.tgz#e130caf7e7279087c5616c2007d0485698984fbd"
Expand Down Expand Up @@ -3967,7 +4012,7 @@ duplexify@^3.4.2, duplexify@^3.6.0:
readable-stream "^2.0.0"
stream-shift "^1.0.0"

duplexify@^4.0.0:
duplexify@^4.0.0, duplexify@^4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/duplexify/-/duplexify-4.1.1.tgz#7027dc374f157b122a8ae08c2d3ea4d2d953aa61"
integrity sha512-DY3xVEmVHTv1wSzKNbwoU6nVjzI369Y6sPoqfYr0/xlx3IdX2n94xIszTcjPO8W8ZIv0Wb0PXNcjuZyT4wiICA==
Expand Down Expand Up @@ -4036,6 +4081,11 @@ end-of-stream@^1.0.0, end-of-stream@^1.1.0, end-of-stream@^1.4.1:
dependencies:
once "^1.4.0"

ent@^2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/ent/-/ent-2.2.0.tgz#e964219325a21d05f44466a2f686ed6ce5f5dd1d"
integrity sha1-6WQhkyWiHQX0RGai9obtbOX13R0=

env-paths@^2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/env-paths/-/env-paths-2.2.0.tgz#cdca557dc009152917d6166e2febe1f039685e43"
Expand Down Expand Up @@ -4841,6 +4891,17 @@ gaxios@^3.0.0:
is-stream "^2.0.0"
node-fetch "^2.3.0"

gaxios@^4.0.0:
version "4.0.1"
resolved "https://registry.yarnpkg.com/gaxios/-/gaxios-4.0.1.tgz#bc7b205a89d883452822cc75e138620c35e3291e"
integrity sha512-jOin8xRZ/UytQeBpSXFqIzqU7Fi5TqgPNLlUsSB8kjJ76+FiGBfImF8KJu++c6J4jOldfJUtt0YmkRj2ZpSHTQ==
dependencies:
abort-controller "^3.0.0"
extend "^3.0.2"
https-proxy-agent "^5.0.0"
is-stream "^2.0.0"
node-fetch "^2.3.0"

gcp-metadata@^3.4.0:
version "3.5.0"
resolved "https://registry.yarnpkg.com/gcp-metadata/-/gcp-metadata-3.5.0.tgz#6d28343f65a6bbf8449886a0c0e4a71c77577055"
Expand All @@ -4857,6 +4918,14 @@ gcp-metadata@^4.1.0:
gaxios "^3.0.0"
json-bigint "^1.0.0"

gcp-metadata@^4.2.0:
version "4.2.1"
resolved "https://registry.yarnpkg.com/gcp-metadata/-/gcp-metadata-4.2.1.tgz#31849fbcf9025ef34c2297c32a89a1e7e9f2cd62"
integrity sha512-tSk+REe5iq/N+K+SK1XjZJUrFPuDqGZVzCy2vocIHIGmPlTGsa8owXMJwGkrXr73NO0AzhPW4MF2DEHz7P2AVw==
dependencies:
gaxios "^4.0.0"
json-bigint "^1.0.0"

genfun@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/genfun/-/genfun-5.0.0.tgz#9dd9710a06900a5c4a5bf57aca5da4e52fe76537"
Expand Down Expand Up @@ -5075,6 +5144,21 @@ google-auth-library@^6.0.0:
jws "^4.0.0"
lru-cache "^6.0.0"

google-auth-library@^6.1.1:
version "6.1.3"
resolved "https://registry.yarnpkg.com/google-auth-library/-/google-auth-library-6.1.3.tgz#39d868140b70d0c4b32c6f6d8f4ccc1400d84dca"
integrity sha512-m9mwvY3GWbr7ZYEbl61isWmk+fvTmOt0YNUfPOUY2VH8K5pZlAIWJjxEi0PqR3OjMretyiQLI6GURMrPSwHQ2g==
dependencies:
arrify "^2.0.0"
base64-js "^1.3.0"
ecdsa-sig-formatter "^1.0.11"
fast-text-encoding "^1.0.0"
gaxios "^4.0.0"
gcp-metadata "^4.2.0"
gtoken "^5.0.4"
jws "^4.0.0"
lru-cache "^6.0.0"

google-gax@^1.14.2:
version "1.15.3"
resolved "https://registry.yarnpkg.com/google-gax/-/google-gax-1.15.3.tgz#e88cdcbbd19c7d88cc5fd7d7b932c4d1979a5aca"
Expand Down Expand Up @@ -5365,6 +5449,15 @@ http-proxy-agent@^2.1.0:
agent-base "4"
debug "3.1.0"

http-proxy-agent@^4.0.0:
version "4.0.1"
resolved "https://registry.yarnpkg.com/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz#8a8c8ef7f5932ccf953c296ca8291b95aa74aa3a"
integrity sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg==
dependencies:
"@tootallnate/once" "1"
agent-base "6"
debug "4"

http-signature@~1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.2.0.tgz#9aecd925114772f3d95b65a60abb8f7c18fbace1"
Expand Down Expand Up @@ -5935,6 +6028,11 @@ [email protected]:
ip-regex "^2.1.0"
is-url "^1.2.2"

is@^3.3.0:
version "3.3.0"
resolved "https://registry.yarnpkg.com/is/-/is-3.3.0.tgz#61cff6dd3c4193db94a3d62582072b44e5645d79"
integrity sha512-nW24QBoPcFGGHJGUwnfpI7Yc5CdqWNdsyHQszVE/z2pKHXzh7FZ5GWhJqSyaQ9wMkQnsTx+kAI8bHlCX4tKdbg==

[email protected]:
version "0.0.1"
resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf"
Expand Down Expand Up @@ -8925,7 +9023,7 @@ ret@~0.1.10:
resolved "https://registry.yarnpkg.com/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc"
integrity sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==

retry-request@^4.0.0:
retry-request@^4.0.0, retry-request@^4.1.1:
version "4.1.3"
resolved "https://registry.yarnpkg.com/retry-request/-/retry-request-4.1.3.tgz#d5f74daf261372cff58d08b0a1979b4d7cab0fde"
integrity sha512-QnRZUpuPNgX0+D1xVxul6DbJ9slvo4Rm6iV/dn63e048MvGbUZiKySVt6Tenp04JqmchxjiLltGerOJys7kJYQ==
Expand Down Expand Up @@ -9400,6 +9498,13 @@ stream-each@^1.1.0:
end-of-stream "^1.1.0"
stream-shift "^1.0.0"

stream-events@^1.0.5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/stream-events/-/stream-events-1.0.5.tgz#bbc898ec4df33a4902d892333d47da9bf1c406d5"
integrity sha512-E1GUzBSgvct8Jsb3v2X15pjzN1tYebtbLaMg+eBOUOAxgbLoSbT2NS91ckc5lJD1KfLjId+jXJRgo0qnV5Nerg==
dependencies:
stubs "^3.0.0"

stream-shift@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/stream-shift/-/stream-shift-1.0.1.tgz#d7088281559ab2778424279b0877da3c392d5a3d"
Expand Down Expand Up @@ -9590,6 +9695,11 @@ strong-log-transformer@^2.0.0:
minimist "^1.2.0"
through "^2.3.4"

stubs@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/stubs/-/stubs-3.0.0.tgz#e8d2ba1fa9c90570303c030b6900f7d5f89abe5b"
integrity sha1-6NK6H6nJBXAwPAMLaQD31fiavls=

superstatic@^7.0.0:
version "7.0.1"
resolved "https://registry.yarnpkg.com/superstatic/-/superstatic-7.0.1.tgz#cf82b0fd03100d294636ec76ccfa4eda6f255676"
Expand Down Expand Up @@ -9712,6 +9822,17 @@ tcp-port-used@^1.0.1:
debug "4.1.0"
is2 "2.0.1"

teeny-request@^7.0.0:
version "7.0.1"
resolved "https://registry.yarnpkg.com/teeny-request/-/teeny-request-7.0.1.tgz#bdd41fdffea5f8fbc0d29392cb47bec4f66b2b4c"
integrity sha512-sasJmQ37klOlplL4Ia/786M5YlOcoLGQyq2TE4WHSRupbAuDaQW0PfVxV4MtdBtRJ4ngzS+1qim8zP6Zp35qCw==
dependencies:
http-proxy-agent "^4.0.0"
https-proxy-agent "^5.0.0"
node-fetch "^2.6.1"
stream-events "^1.0.5"
uuid "^8.0.0"

temp-dir@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/temp-dir/-/temp-dir-1.0.0.tgz#0a7c0ea26d3a39afa7e0ebea9c1fc0bc4daa011d"
Expand Down Expand Up @@ -10322,7 +10443,7 @@ uuid@^3.0.0, uuid@^3.0.1, uuid@^3.3.2:
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee"
integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==

uuid@^8.3.0:
uuid@^8.0.0, uuid@^8.3.0:
version "8.3.1"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.1.tgz#2ba2e6ca000da60fce5a196954ab241131e05a31"
integrity sha512-FOmRr+FmWEIG8uhZv6C2bTgEVXsHk08kE7mPlrBbEe+c3r9pjceVPgupIfNIhc4yx55H69OXANrUaSuu9eInKg==
Expand Down

0 comments on commit 60b2a99

Please sign in to comment.