Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make capture_http_client_request_body_size config option public #3776

Merged
merged 2 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ Use subheadings with the "=====" level for adding notes for unreleased changes:
===== Bug fixes
* Fix log4j2 log correlation with shaded application jar - {pull}3764[#3764]

[float]
===== Features
* 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]

[[release-notes-1.x]]
=== Java Agent version 1.x

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,12 @@ public class WebConfiguration extends ConfigurationOptionProvider {
.addValidator(isInRange(0, MAX_BODY_CAPTURE_BYTES))
.key("capture_http_client_request_body_size")
.configurationCategory(HTTP_CATEGORY)
.tags("added[1.50.0]", "internal")
.description("Configures how many bytes of http-client request bodies shall be captured. " +
"Note that only request bodies will be captured for content types matching the capture_body_content_types configuration. " +
" The maximum allowed value is " + MAX_BODY_CAPTURE_BYTES + " , a value of 0 disables body capturing")
.tags("added[1.52.0]", "experimental")
.description("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 " + MAX_BODY_CAPTURE_BYTES + ", a value of 0 disables body capturing.\n\n" +
"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" +
"The body will be stored in the `labels.http_request_body_content` field on the span documents.")
.dynamic(true)
SylvainJuge marked this conversation as resolved.
Show resolved Hide resolved
.buildWithDefault(0);

Expand Down
42 changes: 42 additions & 0 deletions docs/configuration.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ Click on a key to get more information.
** <<config-transaction-ignore-user-agents>>
** <<config-use-path-as-transaction-name>>
** <<config-url-groups>>
** <<config-capture-http-client-request-body-size>>
* <<config-huge-traces>>
** <<config-span-compression-enabled>>
** <<config-span-compression-exact-match-max-duration>>
Expand Down Expand Up @@ -1829,6 +1830,35 @@ Prepending an element with `(?-i)` makes the matching case sensitive.
| `elastic.apm.url_groups` | `url_groups` | `ELASTIC_APM_URL_GROUPS`
|============

// This file is auto generated. Please make your changes in *Configuration.java (for example CoreConfiguration.java) and execute ConfigurationExporter
[float]
[[config-capture-http-client-request-body-size]]
==== `capture_http_client_request_body_size` (added[1.52.0] experimental)

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.

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.

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).

The body will be stored in the `labels.http_request_body_content` field on the span documents.

<<configuration-dynamic, image:./images/dynamic-config.svg[] >>


[options="header"]
|============
| Default | Type | Dynamic
| `0` | Integer | true
|============


[options="header"]
|============
| Java System Properties | Property file | Environment
| `elastic.apm.capture_http_client_request_body_size` | `capture_http_client_request_body_size` | `ELASTIC_APM_CAPTURE_HTTP_CLIENT_REQUEST_BODY_SIZE`
|============

[[config-huge-traces]]
=== Huge Traces configuration options

Expand Down Expand Up @@ -4331,6 +4361,18 @@ Example: `5ms`.
#
# url_groups=

# 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.
#
# 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).
#
# The body will be stored in the `labels.http_request_body_content` field on the span documents.
#
# This setting can be changed at runtime
# Type: Integer
# Default value: 0
#
# capture_http_client_request_body_size=0

############################################
# Huge Traces #
############################################
Expand Down
Loading