Skip to content

Commit

Permalink
updated README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
itayw committed Dec 29, 2019
1 parent 059e556 commit 21d73bc
Showing 1 changed file with 56 additions and 1 deletion.
57 changes: 56 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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 |
Expand Down

0 comments on commit 21d73bc

Please sign in to comment.