From 21d73bc090cf59191255b8aaa2ba8c9d90b57082 Mon Sep 17 00:00:00 2001 From: Itay Weinberger Date: Sun, 29 Dec 2019 12:34:33 +0200 Subject: [PATCH] updated README.md --- README.md | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a5ab6b7..1414fec 100644 --- a/README.md +++ b/README.md @@ -8,10 +8,65 @@ The proxy intercepts search requests and record them into Elasticsearch for furt ## Data schema +``` +{ + "user": {}, + "times": { + "start": "2019-12-29T10: 23: 47.085Z", + "end": "2019-12-29T10: 23: 47.097Z", + "req_took_ms": 12, + "elastic_took_ms": 5 + }, + "query": { + "params": {}, + "body": null, + "headers": { + "host": "localhost:9205", + "user-agent": "curl/7.61.0", + "accept": "*/*", + "x-opaque-id": "123", + "content-type": "application/json", + "x-query-tracker-id": "1234", + "x-query-tracker-tags": "itay, or" + }, + "tags": [ + "itay", + "or" + ], + "id": "1234" + }, + "is_search_request": true, + "response": { + "took": 5, + "timed_out": false, + "shards": { + "total": 1, + "successful": 1, + "skipped": 0, + "failed": 0 + }, + "total": { + "value": 3, + "relation": "eq" + } + } +} +``` ## Tagging your data +The proxy support custom HTTP headers for better segmentation of the data: + +| Header | Description | Example | +|--------------|------------| -----------| +| x-query-tracker-tags | Comma seperated list of tags | auth,login +| x-query-tracker-id | A unique query identifier | query-1234 +Here's an example curl: + +``` +$ curl -v -H"Content-Type: application/json" -H"X-query-tracker-id: query-1234" -H"X-query-tracker-tags: auth, login" localhost:9205/_search +``` ## Running Elastic Query Tracker @@ -23,7 +78,7 @@ $ node index.js The proxy accepts the following environment variables: -| env var | default value | +| Environment var | Default value | |--------------|-----------------------| | PORT | 9095 | | ELASTIC_HOST | http://localhost:9200 |