Commit Graph

637 Commits

Author SHA1 Message Date
Álvaro
07119ce90a
Remove hardcoded values in tests 2020-12-17 11:11:49 +01:00
Daniel García Aubert
c1ed382949 Merge branch 'master' into dgaubert/ch87185/log-system-revamp-sql-api 2020-06-30 17:50:10 +02:00
Daniel García Aubert
762a240890 Breaking changes:
- Log system revamp:
  - Logs to stdout, disabled while testing
  - Use header `X-Request-Id`, or create a new `uuid` when no present, to identyfy log entries
  - Be able to set log level from env variable `LOG_LEVEL`, useful while testing: `LOG_LEVEL=info npm test`; even more human-readable: `LOG_LEVEL=info npm t | ./node_modules/.bin/pino-pretty`
  - Be able to reduce the footprint in the final log file depending on the environment
  - Use one logger for every service: Queries, Batch Queries (Jobs), and Data Ingestion (CopyTo/CopyFrom)
  - Stop using headers such as: `X-SQL-API-Log`, `X-SQL-API-Profiler`, and `X-SQL-API-Errors` as a way to log info.
  - Be able to tag requests with labels as an easier way to provide business metrics
  - Metro: Add log-collector utility (`metro`), it will be moved to its own repository. Attaching it here fro development purposes. Try it with the following command `LOG_LEVEL=info npm t | node metro`
  - Metro: Creates `metrics-collector.js` a stream to update Prometheus' counters and histograms and exposes them via Express' app (`:9145/metrics`). Use the ones defined in `grok_exporter`

Announcements:
- Profiler is always set. No need to check its existence anymore
- Unify profiler usage for every endpoint

Bug fixes:
- Avoid hung requests while fetching user identifier
2020-06-30 17:42:59 +02:00
Álvaro Manera
3994deda1f change test description 2020-06-22 12:51:45 +02:00
Álvaro Manera
2e914d5454 fix lint 2020-06-22 09:56:48 +02:00
Álvaro Manera
a4a100e65a respond with user-id and client in the headers
added headers to the test-client callback to be able to check them
2020-06-22 09:47:22 +02:00
Daniel García Aubert
0c92fcaf96 Node.js 12 support:
- Update `gc-stats` to version 1.4.0
- Replace `zipfile` -> `adm-zip`
- Update `libxmljs` to version 0.19.7
- Update `sqlite` to version 4.2.0
- Adapted pool acquires to the new version of `cartodb-redis`
- Adapted test to use `adm-zip`
2020-05-18 11:32:41 +02:00
Raúl Marín
25f15dfc61 Fix an ogr2ogr export issue when the temporal name is too big
If the final name is going to be too big, use the hash over the proposed
path to create an unique name that fits the requirements of path length
under Linux
2020-05-11 18:35:35 +02:00
Raúl Marín
fa5c4cab83 CSV: Test behaviour of gdal 2.3+ 2020-04-17 10:54:23 +02:00
Raúl Marín
195ff3c9f1 Test: Avoid requiring specific search paths for tests 2020-04-16 18:35:29 +02:00
Raúl Marín
349c4d72c4 Remove py_sleep test
I think this was added for historical reasons when upstream plpython
was not interrumpible, but that's not the case anymore.

Right now, either we adapt it to use plpython2u or plpython3u depending
on what's available, or we just remove it since upstream was fixed
several years ago. It's simpler to remove it
2020-04-13 12:33:25 +02:00
Esther Lozano
ac8086a8e3
Rename accepted headers for metrics events (#641)
* Rename accepted headers for metrics events
2020-02-18 11:14:06 +01:00
Esther Lozano
90ee8af129
Allow metrics custom headers in cors (#640)
* Allow metrics custom headers in cors

* Update NEWS.md
2020-02-13 11:30:14 +01:00
Daniel García Aubert
014158c968 Eslint errors 2019-12-26 17:46:27 +01:00
Daniel García Aubert
43481b42e5 Eslint errors 2019-12-26 17:16:29 +01:00
Daniel García Aubert
90bdb6d487 More eslint errors 2019-12-26 16:57:24 +01:00
Daniel García Aubert
2e8c0bdbdd Fix test 2019-12-26 16:43:12 +01:00
Daniel García Aubert
44ff21b7c0 Fix eslint errors 2019-12-26 16:10:41 +01:00
Daniel García Aubert
ac7d60d97d Fix lint errors 2019-12-26 14:51:09 +01:00
Daniel García Aubert
e242d94d30 Fix eslint errors 2019-12-26 14:38:53 +01:00
Daniel García Aubert
cc535b13d2 Use asert.strict mode 2019-12-26 14:23:21 +01:00
Daniel García Aubert
5a96dbb59c Run eslint --fix 2019-12-23 18:19:08 +01:00
Javier Goizueta
8db90dc3ab Lint fix 2019-11-20 13:06:36 +01:00
Javier Goizueta
41ba98b8f4 Fix tests 2019-11-20 13:00:03 +01:00
Javier Goizueta
f026121ad5 Simplify throttling logic
This introduces a couple of changes in the parameter interpretation:
copy_from_minimum_input_speed is now the total number of bytes in the interval
(so we could multiply the currently configured values by the interval to preserve min. throughput.
the minimum speed is now inclusive (only smaller values will cause an exception).
2019-11-20 12:09:06 +01:00
Daniel García Aubert
0b74ae798a Leave me alone JSHint 2019-10-15 13:42:11 +02:00
Daniel García Aubert
2ec65375fc Be able to synchronize the TTL of cache-control header to expire in a coherent way 2019-10-15 13:11:49 +02:00
Daniel García Aubert
06a47a8afc Changed folder structure to reflect application functionallity. Renamed files using hyphens instead of underscore to have a more consistent naming across the whole project 2019-10-03 18:24:39 +02:00
Daniel García Aubert
b5bb06db6c Add test to validate custom middlewares 2019-10-02 19:10:32 +02:00
Román Jiménez
e7eb2083f2
Add Rate limit headers to CORS (#618) 2019-09-27 09:52:51 +02:00
Raúl Marín
d57f00c4e5
query_tables_update: Update to 0.6.0 (#613) 2019-09-13 13:45:43 +02:00
Raúl Marín
df523960a2
Fix test timeouts (#612)
* Tests: Work with re-runs

* Test: Adapt copyfrom test
- Reduce timeout from 10 to 1 ms.
- Increase the size of the file from 6 to 2016 rows.

* Use node-cartodb-psql 0.14.0

Ref: https://github.com/CartoDB/CartoDB-SQL-API/pull/612
2019-09-13 11:28:37 +02:00
Raul Marin
7b02bf13af Add tests for x-sqlapi-log length 2019-07-31 15:58:05 +02:00
Daniel García Aubert
fcb7591051 Extract query may write middleware 2019-07-26 18:23:14 +02:00
Daniel García Aubert
2aed90392e Unify query params parsing in same middleware with differente strategies 2019-07-26 16:06:53 +02:00
Daniel García Aubert
668b809e3f Extract query params parses to its middleware 2019-07-26 11:27:46 +02:00
Daniel García Aubert
46190008f5 Remove table cache 2019-07-24 17:44:04 +02:00
Daniel García Aubert
b3de428adb Add test 2019-07-05 16:12:09 +02:00
Daniel García Aubert
9408be108b Add missing test 2019-07-04 12:24:42 +02:00
Daniel García Aubert
50a35fa8c7 Add test 2019-07-04 12:21:31 +02:00
Daniel García Aubert
ccb0bbfb86 Set directive 'max-age' to 5 min when there are affacted tables where we can't know when were updated for the last time, e.g: non cartodified tables or foreing tables without cartodb support 2019-07-04 10:45:35 +02:00
Daniel García Aubert
4a342bce83 Merge branch 'master' into 498-pgtypes 2019-06-03 20:49:10 +02:00
Daniel García Aubert
88f8ad3013 Fix assertion 2019-06-03 20:48:12 +02:00
Daniel García Aubert
bd9de97b79 Add tests 2019-06-03 20:42:49 +02:00
Raul Marin
f6f8836152 Test: Remove some console.log calls 2019-06-03 17:42:19 +02:00
Daniel García Aubert
6417a734a0 Retrieve exact Pg field type information in JSON format 2019-06-03 17:37:40 +02:00
Daniel García Aubert
8ab98f705d Going green, be able to handle post method for copyto endpoint 2019-05-31 11:54:20 +02:00
Daniel García Aubert
12a8fad251 Going red: test to check copyto endpoint through POST method 2019-05-31 10:55:00 +02:00
Daniel García Aubert
f20a38b3c8 Revert "typo"
This reverts commit 1eb7c86562.
2019-05-31 10:38:36 +02:00
Daniel García Aubert
1eb7c86562 typo 2019-05-31 10:34:30 +02:00