Skip to content

Commit ce9b400

Browse files
authored
Make capture_http_client_request_body_size config option public (#3776)
1 parent 8086518 commit ce9b400

File tree

3 files changed

+52
-4
lines changed

3 files changed

+52
-4
lines changed

CHANGELOG.asciidoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ Use subheadings with the "=====" level for adding notes for unreleased changes:
3535
===== Bug fixes
3636
* Fix log4j2 log correlation with shaded application jar - {pull}3764[#3764]
3737
38+
[float]
39+
===== Features
40+
* Added experimental option to capture HTTP client request bodies for Apache Http Client v4 and v5, HttpUrlConnection and Spring WebClient - {pull}3776[#3776], {pull}3962[#3962], {pull}3724[#3724], {pull}3754[#3754], {pull}3767[#3767]
41+
3842
[[release-notes-1.x]]
3943
=== Java Agent version 1.x
4044

apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/configuration/WebConfiguration.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,12 @@ public class WebConfiguration extends ConfigurationOptionProvider {
129129
.addValidator(isInRange(0, MAX_BODY_CAPTURE_BYTES))
130130
.key("capture_http_client_request_body_size")
131131
.configurationCategory(HTTP_CATEGORY)
132-
.tags("added[1.50.0]", "internal")
133-
.description("Configures how many bytes of http-client request bodies shall be captured. " +
134-
"Note that only request bodies will be captured for content types matching the capture_body_content_types configuration. " +
135-
" The maximum allowed value is " + MAX_BODY_CAPTURE_BYTES + " , a value of 0 disables body capturing")
132+
.tags("added[1.52.0]", "experimental")
133+
.description("Configures that the first n bytes of http-client request bodies shall be captured. " +
134+
"Note that only request bodies will be captured for content types matching the <<config-transaction-name-groups,`transaction_name_groups`>> configuration. " +
135+
"The maximum allowed value is " + MAX_BODY_CAPTURE_BYTES + ", a value of 0 disables body capturing.\n\n" +
136+
"Currently only support for Apache Http Client v4 and v5, HttpUrlConnection, Spring Webflux WebClient and other frameworks building on top of these (e.g. Spring RestTemplate).\n\n" +
137+
"The body will be stored in the `labels.http_request_body_content` field on the span documents.")
136138
.dynamic(true)
137139
.buildWithDefault(0);
138140

docs/configuration.asciidoc

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ Click on a key to get more information.
147147
** <<config-transaction-ignore-user-agents>>
148148
** <<config-use-path-as-transaction-name>>
149149
** <<config-url-groups>>
150+
** <<config-capture-http-client-request-body-size>>
150151
* <<config-huge-traces>>
151152
** <<config-span-compression-enabled>>
152153
** <<config-span-compression-exact-match-max-duration>>
@@ -1829,6 +1830,35 @@ Prepending an element with `(?-i)` makes the matching case sensitive.
18291830
| `elastic.apm.url_groups` | `url_groups` | `ELASTIC_APM_URL_GROUPS`
18301831
|============
18311832

1833+
// This file is auto generated. Please make your changes in *Configuration.java (for example CoreConfiguration.java) and execute ConfigurationExporter
1834+
[float]
1835+
[[config-capture-http-client-request-body-size]]
1836+
==== `capture_http_client_request_body_size` (added[1.52.0] experimental)
1837+
1838+
NOTE: This feature is currently experimental, which means it is disabled by default and it is not guaranteed to be backwards compatible in future releases.
1839+
1840+
Configures that the first n bytes of http-client request bodies shall be captured. Note that only request bodies will be captured for content types matching the <<config-transaction-name-groups,`transaction_name_groups`>> configuration. The maximum allowed value is 1024, a value of 0 disables body capturing.
1841+
1842+
Currently only support for Apache Http Client v4 and v5, HttpUrlConnection, Spring Webflux WebClient and other frameworks building on top of these (e.g. Spring RestTemplate).
1843+
1844+
The body will be stored in the `labels.http_request_body_content` field on the span documents.
1845+
1846+
<<configuration-dynamic, image:./images/dynamic-config.svg[] >>
1847+
1848+
1849+
[options="header"]
1850+
|============
1851+
| Default | Type | Dynamic
1852+
| `0` | Integer | true
1853+
|============
1854+
1855+
1856+
[options="header"]
1857+
|============
1858+
| Java System Properties | Property file | Environment
1859+
| `elastic.apm.capture_http_client_request_body_size` | `capture_http_client_request_body_size` | `ELASTIC_APM_CAPTURE_HTTP_CLIENT_REQUEST_BODY_SIZE`
1860+
|============
1861+
18321862
[[config-huge-traces]]
18331863
=== Huge Traces configuration options
18341864

@@ -4331,6 +4361,18 @@ Example: `5ms`.
43314361
#
43324362
# url_groups=
43334363
4364+
# Configures that the first n bytes of http-client request bodies shall be captured. Note that only request bodies will be captured for content types matching the <<config-transaction-name-groups,`transaction_name_groups`>> configuration. The maximum allowed value is 1024, a value of 0 disables body capturing.
4365+
#
4366+
# Currently only support for Apache Http Client v4 and v5, HttpUrlConnection, Spring Webflux WebClient and other frameworks building on top of these (e.g. Spring RestTemplate).
4367+
#
4368+
# The body will be stored in the `labels.http_request_body_content` field on the span documents.
4369+
#
4370+
# This setting can be changed at runtime
4371+
# Type: Integer
4372+
# Default value: 0
4373+
#
4374+
# capture_http_client_request_body_size=0
4375+
43344376
############################################
43354377
# Huge Traces #
43364378
############################################

0 commit comments

Comments
 (0)