Commit graph

246 commits

Author SHA1 Message Date
Eric Mc Sween
f3f0be5c56 Merge pull request #6211 from overleaf/em-code-sharing
Change directory layout in service containers

GitOrigin-RevId: 09ff19db2a123cbf7691d51e9ce9be6eee264287
2022-01-07 09:03:22 +00:00
Jakob Ackermann
729cbf3fce Merge pull request #6224 from overleaf/jpa-cache-install-deps
[misc] add docker image caching for install_deps, pre-fetch node image

GitOrigin-RevId: b52e52351c62b780538e0668b99fc1c28723addc
2022-01-06 09:03:07 +00:00
Jakob Ackermann
4b308553be Merge pull request #6120 from overleaf/jpa-same-linting-packages
[misc] move the linting setup to the root of the monorepo

GitOrigin-RevId: 1633e2a58598add0b727738cd3bfba0ab7bae781
2021-12-17 09:03:06 +00:00
Jakob Ackermann
2261e761f4 Merge pull request #5705 from overleaf/jpa-node-14
[misc] upgrade node version from 12 to 14

GitOrigin-RevId: 15c465c7bb5e42b0c71e2dedb09cf4fe9f1d8ec6
2021-11-19 09:02:56 +00:00
Jakob Ackermann
8945373715 Merge pull request #5724 from overleaf/jpa-lean-docker-build
[build_scripts] library: add a dockerignore file

GitOrigin-RevId: 229029f74024a9ca77c11fac53740d2d6ebd02ca
2021-11-09 09:04:02 +00:00
Brian Gough
d9d65ac31c Merge pull request #5246 from overleaf/bg-upgrade-logger-in-all-libraries
upgrade logger in libraries

GitOrigin-RevId: 5968f5abc5f77061cd90b5ebbccf86349619c4a7
2021-10-29 08:03:14 +00:00
Eric Mc Sween
c5778fdd05 Merge pull request #5488 from overleaf/em-refactor-logger
Refactor logger module to separate concerns

GitOrigin-RevId: cf9b1e367d881fb9036b2cb0f5c0529763a44695
2021-10-28 08:04:00 +00:00
Jakob Ackermann
4b996c53d3 Merge pull request #5574 from overleaf/jpa-bulk-lint-format
[misc] set up bulk lint/format in dev-env

GitOrigin-RevId: 6f7939c4c732bca72c9b658491e2c4c851c82b44
2021-10-28 08:03:47 +00:00
Brian Gough
43c381e4d5 Merge pull request #5552 from overleaf/bg-node-upgrade-other
upgrade node to v12.22.7 (other services)

GitOrigin-RevId: 889cf9a77173119fec8f200eeef9ddeefca0720b
2021-10-26 08:03:13 +00:00
Brian Gough
fa2567aa61 Merge pull request #4980 from overleaf/bg-upgrade-metrics-dependencies
upgrade metrics dependencies

GitOrigin-RevId: 3fda4017ac4d5e1ab1e196051d557c10253924b7
2021-09-07 16:26:06 +00:00
Jakob Ackermann
6a0388ff9b Merge pull request #4689 from overleaf/jpa-libraries-ci
[misc] setup cloud build trigger for libraries

GitOrigin-RevId: a66dd3e96cb1c06d4803a2162278959357694048
2021-08-13 12:56:39 +00:00
Jakob Ackermann
23efa1d977 [misc] prepare for monorepo
- add git ignore entries
- sync/create package-lock.json
- delete .nvmrc
2021-07-27 16:33:33 +01:00
Christopher Hoskin
acef9e7d8d Add basic README 2021-03-16 12:03:53 +00:00
Jakob Ackermann
e1650616b8 [misc] version bump to 3.5.1 2021-02-16 14:21:36 +00:00
Jakob Ackermann
20223d865f [misc] do not register a noop sweeping interval 2021-01-12 14:20:51 +00:00
Jakob Ackermann
29742d6a87 [misc] register the metrics sweeping interval handle for later cleanup 2021-01-12 14:20:31 +00:00
Eric Mc Sween
3581d0ce87 3.5.0 2021-01-11 08:03:49 -05:00
Eric Mc Sween
8dcbd5aec0 Add support for the swagger-tools router
The swagger-tools router puts the request path in the
req.swagger.apiPath property.
2021-01-08 14:53:29 -05:00
Eric Mc Sween
7274217d79 Decaf cleanup 2021-01-08 14:48:13 -05:00
Jakob Ackermann
8e76e79a83 [misc] version bump to 3.4.1 2020-11-25 11:25:27 +00:00
Jakob Ackermann
2d1c84ea2e [misc] fix collection of open sockets
```
> require('http').globalAgent.sockets
{ 'HOST:PORT:': [{ ... }, { ... }] }
```

- `new URL('http://HOST:PORT:')` throws
  -> test suite `open_sockets`
- gauges were not cleaned up after no agents were present for a given
   key. This lead to continuous emission of the previous connection
   count for a given hostname, following the completion of all requests.
  -> test suite `when all requests complete`
2020-11-06 15:16:14 +00:00
Eric Mc Sween
142d9a5716 3.4.0 2020-10-30 07:39:47 -04:00
Eric Mc Sween
20b3d5070c Export a configured prom-client
Metrics.initialize() and Metrics.configure() will configure the default
Prometheus registry with default "app" and "host" labels. The configured
prom-client module is available as Metrics.prom.
2020-10-29 09:49:55 -04:00
Christopher Hoskin
725478d95f Release 3.3.0 2020-10-27 14:02:21 +00:00
Christopher Hoskin
f874291998 Bump google-cloud trace-agent, debug-agent and profiler to latest 2020-10-26 17:40:18 +00:00
Christopher Hoskin
d4a649353f Commit package-lock.json 2020-10-26 17:33:43 +00:00
Christopher Hoskin
fedc3191b8 Bump node to 10.19 2020-10-26 17:33:24 +00:00
Eric Mc Sween
0fdbb2dcc0 Add .npmignore to avoid publishing config files 2020-09-17 10:44:24 -04:00
Eric Mc Sween
bd1a1dbabf 3.2.1 2020-09-17 10:40:34 -04:00
Eric Mc Sween
2f35db4087 Fix startup crash
Version 3.2.0 crashes on startup because it calls buildPromKey() without
arguments. To avoid this kind of obvious bug to happen again, I added
some basic acceptance tests.
2020-09-17 10:30:25 -04:00
Eric Mc Sween
ec0441bc89 3.2.0 2020-09-15 08:37:05 -04:00
Eric Mc Sween
c05bd83e24 Add a separate configure() method
configure() sets options in the metrics module, but does not start the
default metrics collectors and the profiling agents.
2020-09-15 08:36:03 -04:00
Eric Mc Sween
3c9c17c22f Remove "using prometheus" log
We now always use prometheus
2020-09-11 15:59:38 -04:00
Eric Mc Sween
6f69fb4869 Decaf cleanup: move functions to top level 2020-09-11 15:59:38 -04:00
Eric Mc Sween
afecfd5212 Decaf cleanup: use default parameters 2020-09-11 15:59:38 -04:00
Eric Mc Sween
d7e4b3fe33 Decaf cleanup: unnecessary returns 2020-09-11 15:59:38 -04:00
Eric Mc Sween
6c020f6e54 Decaf cleanup: remove Array.from() 2020-09-11 15:59:38 -04:00
Eric Mc Sween
971a768c4e Install prettier and eslint 2020-09-11 15:59:33 -04:00
Brian Gough
c530422f1e update package version to 3.1.0 2020-09-04 15:52:05 +01:00
Jakob Ackermann
71ba4150fe [misc] enable compression for the /metrics route 2020-09-04 15:32:48 +01:00
Brian Gough
b6b65b9638 Merge pull request #39 from overleaf/jpa-res-headers-public-api
[http] use public node api for getting the response content-length
2020-09-04 14:52:20 +01:00
Jakob Ackermann
6f4829e817 [misc] fix module importing 2020-08-17 14:43:08 +01:00
Jakob Ackermann
37fda043d4 [http] use public node api for getting the response content-length 2020-08-17 11:59:18 +01:00
Brian Gough
e5747fefd2 remove package-lock.json (not needed for library) 2020-08-06 14:52:07 +01:00
Brian Gough
5b39d49358 use scoped package name @overleaf/metrics 2020-08-05 11:27:56 +01:00
Brian Gough
d415ae0cbe remove gruntfile 2020-07-17 16:23:01 +01:00
Brian Gough
a0f856cff2 fix tests 2020-07-17 16:17:18 +01:00
Brian Gough
747a80b545 decaffeinate 2020-07-17 16:01:58 +01:00
Brian Gough
e31a819636 remove statsd 2020-07-17 15:36:37 +01:00
Eric Mc Sween
e197e4dc11 2.7.0 2020-07-06 08:20:02 -04:00
Eric Mc Sween
d69195eaa9 Log requests that don't have a route property
The v1 history service has its routes set up via swagger-tools, which
doesn't write a route property on the request. This prevents us to send
request metrics based on the route, but we can still log the request.
2020-07-03 16:38:29 -04:00
Jakob Ackermann
ea767920fc [misc] fix unit tests 2020-04-01 16:40:15 +02:00
Eric Mc Sween
8131c5ac91 2.6.2 2020-03-25 09:53:54 -04:00
Eric Mc Sween
ef7e3b0e7a Fix HTTP request timing metrics
The conversion between high resolution time and milliseconds was
incorrect.
2020-03-25 09:39:21 -04:00
Eric Mc Sween
a17843f3bf 2.6.1 2020-03-20 07:47:05 -04:00
Eric Mc Sween
25448bfef4 Downgrade all request logs to INFO
Commit 9056143fe36f1347a1ff985ef8592a1de7d798dd added logic to log
requests with different error levels depending on the status code. The
intention was to make the 5xx and 4xx requests stand out in Stackdriver.
Unfortunately, this also creates a lot of noise in Sentry since we log
the errors separately from the requests.

This commit brings back the former behaviour of logging all requests at
the INFO level. We can revisit this if we integrate the strategy
implemented in filestore of logging once per request.
2020-03-18 08:41:11 -04:00
Eric Mc Sween
62e82d7469 Send the status code with the HTTP request size metric 2020-03-12 06:24:46 -04:00
Eric Mc Sween
4a92be80ea Send HTTP request size metric
The metric is a "summary" called http_request_size_bytes.
2020-03-11 16:39:49 -04:00
Brian Gough
03e81153db avoid step effects in summary metrics
reduce the window size from 10 minutes to 1 minute,  so that short
spikes do not cause a 10 minute long "table" graph.
2020-03-10 15:01:09 +00:00
Simon Detheridge
74c2afc12d Bump package version 2020-03-04 10:31:12 +00:00
Simon Detheridge
9a8cddbbb6 Don't set UV_THREADPOOL_SIZE if already set 2020-03-03 17:09:35 +00:00
Brian Gough
2273978e7b fix gauge usage 2019-12-16 11:42:10 +00:00
Brian Gough
3a5374c6f9 increase minor version for backwards compatible addition 2019-12-16 10:22:50 +00:00
Brian Gough
93df87eff3 allow options for count 2019-12-16 10:18:30 +00:00
Simon Detheridge
53aa2490f5 Merge pull request #20 from overleaf/spd-metrics-ttl
Add mechanism to expire old prometheus metrics
2019-10-28 17:21:57 +00:00
Simon Detheridge
feecda8ea8 Use map instead of hash for metrics 2019-10-28 14:39:53 +00:00
Simon Detheridge
e0cf10a886 Fix typo, gague -> gauge 2019-10-28 12:34:04 +00:00
Eric Mc Sween
7b7b6d0793 2.3.0 2019-10-25 07:17:43 -04:00
Eric Mc Sween
166211b278 Stackdriver logging
When the environment variable STACKDRIVER_LOGGING is set to true, send
request logs in a format that Stackdriver knows how to interpret. Also,
set the log level accordint to the status code. 4xx responses are logged
as warnings and 5xx responses are logged as errors.
2019-10-24 22:05:12 -04:00
Simon Detheridge
07e4eb4dfb Add mechanism to expire old prometheus metrics
Adds a wrapper around the prometheus client, which keeps track of the
last time a metrics was accessed, and removes old ones once they have
not been accessed for a period of time.
2019-10-23 17:07:45 +01:00
Brian Gough
286eb747ad add status label to gauges 2019-06-06 10:34:55 +01:00
Henry Oswald
816c49daf2 bump metrics to 2.1.2 2019-04-12 12:36:47 +01:00
Henry Oswald
d4faaaa60e use console.log not logger.log
we don't habe verbiouse lossing enabled that early in the apps lifecycle
also best not to require modules before enabling profiler
2019-04-12 12:34:17 +01:00
Henry Oswald
15d14d8e2b add injectMetricsRoute into statsd so it doens't blow up 2019-02-07 09:47:29 +00:00
Henry Oswald
bf18c6e513 MVP for running both statsd and prom side by side
statsd code is from v1.8.1
2019-01-30 11:11:37 +00:00
Henry Oswald
85011ed0e7 add path into inc options 2019-01-28 14:37:54 +00:00
Christopher Hoskin
02907fd2e7 Fix Register II 2019-01-15 16:16:12 +00:00
Christopher Hoskin
20e45b7a2e Fix Register 2019-01-15 16:12:15 +00:00
Christopher Hoskin
d4caa48118 Bump package version 2019-01-15 15:44:01 +00:00
Christopher Hoskin
93bef54c39 Make register public so we can support other servers e.g. hapi 2019-01-15 15:36:35 +00:00
Henry Oswald
dfead32d69 Update package.json 2018-12-13 09:19:05 +00:00
Henry Oswald
1a34f3db1b Update package.json 2018-12-13 08:46:58 +00:00
Henry Oswald
287effb139 use ENABLE_PROFILE_AGENT 2018-12-12 21:17:12 +00:00
Henry Oswald
db4ae84bda require logger 2018-12-12 21:05:33 +00:00
Henry Oswald
a86c4d8abd add profiler 2018-12-12 20:11:40 +00:00
Henry Oswald
9eac49ad84 add some logging in 2018-12-11 16:07:34 +00:00
Henry Oswald
c257482e15 add ENABLE_DEBUG_AGENT and don't require modules unless they are enabled 2018-12-11 15:46:29 +00:00
Christopher Hoskin
6f82309829 Bump version to 2.0.10 2018-12-11 12:52:38 +00:00
Christopher Hoskin
61e6cf0493 Add host label to timing metrics 2018-12-11 12:01:22 +00:00
Henry Oswald
425a6f55ff set build version via env var and bump build version 2018-12-10 22:02:25 +00:00
Henry Oswald
7a227adaeb add if statment around traceagenet and bump to 2.0.8 2018-12-05 13:58:40 +00:00
Henry Oswald
02071584ae bump to 2.0.7 2018-12-05 12:31:16 +00:00
Henry Oswald
b2f49351c0 few tidy up changes 2018-12-05 11:03:40 +00:00
Henry Oswald
93f4a7eeaf small cleanup 2018-12-04 17:01:30 +00:00
Henry Oswald
85d4b03bcb bump to 2.0.6 2018-12-04 16:29:09 +00:00
Henry Oswald
2d4283fdf0 add DEBUG_METRICS env var 2018-12-04 16:20:52 +00:00
Henry Oswald
31fa5cef51 add logging 2018-12-04 16:09:09 +00:00
Henry Oswald
27e6db1e51 inc process_startup on init 2018-12-04 15:57:19 +00:00
Henry Oswald
752541b7f1 remove logging and bump to 2.0.4 2018-11-29 16:10:55 +00:00
Henry Oswald
9a737bef2f bump to 2.0.3 2018-11-28 10:45:11 +00:00