Skip to content

Commit

Permalink
Add elasticsearch_capture_body_urls option (#670)
Browse files Browse the repository at this point in the history
* Add elasticsearch_capture_body_urls option

* Update tracing-instrumentation-db.md

* leading '/' anchor in patterns; add sql and eql search endpoints

Co-authored-by: Felix Barnsteiner <[email protected]>

* Fix url fields

Co-authored-by: Trent Mick <[email protected]>

* The body MUST be decoded

Co-authored-by: Trent Mick <[email protected]>
  • Loading branch information
felixbarny and trentm authored Aug 18, 2022
1 parent a357475 commit ca8a335
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion specs/agents/tracing-instrumentation-db.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,15 @@ The following fields are relevant for database and datastore spans. Where possib
|`action`| `request` |
| __**context.db._**__ |<hr/>|<hr/>|
|`_.instance`| e.g. `my-cluster` | [Cluster name](#cluster-name), if available.
|`_.statement`| e.g. <pre lang="json">{"query": {"match": {"user.id": "kimchy"}}}</pre> | For Elasticsearch search-type queries, the request body may be recorded. Alternatively, if a query is specified in HTTP query parameters, that may be used instead. If the body is gzip-encoded, the body should be decoded first.|
|`_.statement`| e.g. <pre lang="json">{"query": {"match": {"user.id": "kimchy"}}}</pre> | For Elasticsearch search-type queries, the request body SHOULD be recorded according to the `elasticsearch_capture_body_urls` option (see below). If the body is gzip-encoded, the body MUST be decoded first.|
|`_.type`|`elasticsearch`|
|`_.user`| :heavy_minus_sign: |
|`_.link`| :heavy_minus_sign: |
|`_.rows_affected`| :heavy_minus_sign: |
| __**context.http._**__ |<hr/>|<hr/>|
|`_.status_code`|`200`|
|`_.method`|`GET`|
|`_.url`|`https://localhost:9200/index/_search?q=user.id:kimchy`|
| __**context.destination._**__ |<hr/>|<hr/>|
|`_.address`|e.g. `localhost`|
|`_.port`|e.g. `5432`|
Expand All @@ -146,6 +150,18 @@ The Elasticsearch cluster name is not always available in ES clients, as a resul
- Instrument `_node/http` calls and cache the result in the agent with `host:port` as key.
- execute a request to Elasticsearch and cache the result in the agent with `host:port` as key.

#### `elasticsearch_capture_body_urls` configuration

The URL patterns for which the agent is capturing the request body for Elasticsearch clients.

Agents MAY offer this configuration option.
If they don't, they MUST use a hard-coded list of URLs that correspond with the default value of this option.

| | |
|----------------|------------|
| Type | `List<`[`WildcardMatcher`](../../tests/agents/json-specs/wildcard_matcher_tests.json)`>` |
| Default | `*/_search, */_search/template, */_msearch, */_msearch/template, */_async_search, */_count, */_sql, */_eql/search`|
| Central config | `false`

### MongoDB

Expand Down

0 comments on commit ca8a335

Please sign in to comment.