Commit Graph

364 Commits (9fbd38ab3c1e43b81af3a10edec91bc4f3ef332b)

Author SHA1 Message Date
Phillip Webb e125085993 Merge branch '1.5.x' into 2.0.x 7 years ago
Andy Wilkinson f019d5c85b Merge branch '1.5.x' into 2.0.x 7 years ago
Stephane Nicoll 2b98b11c12 Polish "Less object instantiation in WebMvcTags"
Closes gh-12894
7 years ago
Jon Schneider d676147680 Less object instantiation in WebMvcTags
See gh-12894
7 years ago
Stephane Nicoll 0bc7bef5e5 Properly handle InvalidEndpointRequestException
This commit makes sure that `InvalidEndpointRequestException` is wrapped
in a `ReflectionException` when invoked via JMX.

Closes gh-12857
7 years ago
dreis2211 2bbf438c36 Fix duplicate words in comments
Closes gh-12866
7 years ago
Stephane Nicoll fa542bacc0 Translate user-defined exception when invoking JMX operation
This commit makes sure to respect the MBeanServer#invoke contract by
wrapping any user-defined exception in an MBeanException. Also, any
exception not from the JDK is translated, as it may lead to unexpected
issue on the client if that class isn't present. This is consistent
with our operation result mapping strategy.

Closes gh-10448
7 years ago
Brian Clozel b2e7be17ab Polish gh-11514
As pointed out by Rossen in gh-11514 comments, a handler might commit
the response and then send an error signal in the pipeline. In this
case, adding a callback to `beforeCommit` is useless because it won't be
triggered. In those cases, we need to collect metrics right away.
7 years ago
Brian Clozel 3fa8fe85af Deprecate RouterFunctionMetrics
Spring Boot now deploys both annotation-based and functional endpoints
under the same `HttpHandler`; this means the currently auto-configured
`MetricsWebFilter` is instrumenting all endpoints to produce metrics.

There is no need for a WebFlux functional specific support.
This commit removes mentions of `RouterFunctionMetrics` in the docs and
deprecates that class.

Closes gh-12833
7 years ago
Brian Clozel 77be10e7bc Fix "status" metrics tag for error responses
Prior to this commit, the metrics `WebFilter` would handle exceptions
flowing through the pipeline and extract tag information right away.
Since error handling turns the exception information into error HTTP
responses later in the chain, the information extracted from the
response earlier is invalid.
In this case, the "status" information could be "200" whereas error
handlers would later set that status to "500".

This commit delays the tags extraction later in the process, right
before the response is comitted. The happy path is not changed, as
handlers signal that the response is fully taken care of at that point.

Fixes gh-11514
7 years ago
Stephane Nicoll e8fac7d9c4 Properly discover endpoints that are proxied
Previously to this commit, if a `@ControllerEndpoint`,
`@RestControllerEndpoint` or `@ServletEndpoint` annotated bean was
proxied, the endpoint wasn't properly detected.

This commit makes sure that annotation retrieval works on the user class
while preserving the get (vs. find) retrieval semantic

Closes gh-12441
7 years ago
Stephane Nicoll 86b96254a1 Migrate to ApplicationContextRunner 7 years ago
Johnny Lim f03849d502 Polish
See gh-12812
7 years ago
Andy Wilkinson 8d5b9f37d5 Merge branch '1.5.x' 7 years ago
Phillip Webb 598e9bb842 Polish 7 years ago
Brian Clozel f6d16c8b99 Align WebFluxTags uri support on WebMvcTags
This commit ensures that `WebFluxTags` not only relies on
`BEST_MATCHING_PATTERN_ATTRIBUTE` or request URI to provide the "uri"
tag information.

To avoid cardinality explosion, HTTP not found and redirects are
assigned fixed uri tags.

Closes gh-12685
7 years ago
Phillip Webb 98a2a91d16 Polish 7 years ago
Brian Clozel ebb2f70e0b Make WebMvgTags use matched patterns for HTTP 404
Prior to this commit, `WebMvcTags' would always mark as "NOT_FOUND" or
"REDIRECTION" *any* exchange with responses of 404 and 3xx status, even
if those responses are actually returned by Controller handlers.

This commit checks inverts those checks and first considers if the
"BEST_MATCHING_PATTERN_ATTRIBUTE" request attribute is present and uses
it - then falls back to "NOT_FOUND" and "REDIRECTION" to avoid
cardinality explosion.

Fixes gh-12577
7 years ago
Madhura Bhave 8b29823885 Prevent StackOverFlowException in metadata processor
Fixes gh-11037
7 years ago
dreis2211 3b0f6e7168 Use Supplier variants of Assert methods
See gh-12630
7 years ago
Johnny Lim 625bf93598 Polish
See gh-12584
7 years ago
Phillip Webb 78534a753d Polish "Iterate map by using lambda function"
See gh-12528
7 years ago
igor-suhorukov ffc883b005 Iterate map by using lambda function
Closes gh-12528
7 years ago
Phillip Webb 6e2ecb8a43 Fix broken endpoint integration tests
Ensure that JSON response is returned when extracting data from the
error details.

See gh-12513
7 years ago
Andy Wilkinson 2da4897aa8 Polish 7 years ago
Johnny Lim 2e6914ea88 Add missing super() calls
Closes gh-12459
7 years ago
dreis2211 8626daf135 Replace Mockito.times(0) with Mockito.never()
Closes gh-12475
7 years ago
dreis2211 0d3f3e46dd Fix typos
Closes gh-12468
7 years ago
Andy Wilkinson 2f1b2e3ce2 Log summary of web-exposed endpoints during startup
Closes gh-12442
7 years ago
igor-suhorukov 12185251c1 "toString()" should never be called on a String object
Closes gh-12452
7 years ago
igor-suhorukov aebb475bc5 Reorder modifiers to comply with the JLS
See gh-12432
7 years ago
Johnny Lim 3c9cee2a8c Invoke mapStatus() only when necessary
Closes gh-12419
7 years ago
Madhura Bhave 89e42d40c5 Provide security matchers for actuator links
Fixes gh-12353
7 years ago
Johnny Lim 751c444166 Polish
See gh-12326
7 years ago
Phillip Webb 7bc535e4fa Polish 7 years ago
Johnny Lim f12c7ab38a Remove an unnecessary method in EndpointDiscoverer
Closes gh-12284
7 years ago
Phillip Webb 29c3be3590 Polish 7 years ago
Stephane Nicoll 306c79f0de Merge branch '1.5.x' 7 years ago
Stephane Nicoll cd522dadcd Revert "Add Kafka health indicator"
Closes gh-12225
7 years ago
Phillip Webb 4b9c3c137e Polish Collection.toArray
Consistently use `StringUtils.toStringArray`, `ClassUtils.toClassArray`
or zero length when converting collections to arrays.

Fixes gh-12160
7 years ago
Phillip Webb 3076a5523a Fix checkstyle violation 7 years ago
Phillip Webb 8c24988faa Fix checkstyle violation 7 years ago
Phillip Webb 0925a0957e Polish 7 years ago
Phillip Webb 05faac2b09 Polish 7 years ago
Andy Wilkinson 8f699cd6f6 Use RoleVoter for role checks in ReactiveSecurityContext
See gh-11869
7 years ago
Andy Wilkinson ae45b6730b Apply ROLE_ prefix when needed in ReactiveSecurityContext isUserInRole
See gh-11869
7 years ago
Andy Wilkinson daa280faff Drop AuthorityReactiveAuthorizationManager and avoid need to block
See gh-11869
7 years ago
Stephane Nicoll 7c365bb253 Polish 7 years ago
Andy Wilkinson 87ef9a1d97 Polish 7 years ago
Andy Wilkinson 3e4baf744e Use role-based security to show details in the health endpoint
Closes gh-11869
7 years ago
Jon Schneider 16867f866c Consistent prefix for datasource pool metrics
See gh-12127
7 years ago
Phillip Webb 20109e27be Add ApplicationConversionService and fix binder
Create a new `ApplicationConversionService` similar in design to the
DefaultFormattingConversionService from Spring Framework. The new
conversion service provides a central place for custom conversion logic
supported by Spring Boot.

Also replace the `BindingConversionService` with an internal
`BindConverter` class that now invokes the `SimpleTypeConverter`
directly. Binding for `@ConfigurationProperties` has been updated so
that any custom property editors registered with the BeanFactory can
be used.

Fixes gh-12095
7 years ago
Johnny Lim 88b184ca23 Polish 7 years ago
Jon Schneider ec5ef0f246 Fix URI tag on RestTemplate requests based on URIs
Move leading slash logic from `MetricsClientHttpRequestInterceptor` to
`RestTemplateExchangeTags` so that URI based calls are also managed.

Closes gh-12126
7 years ago
Andy Wilkinson c3a31fafe2 Remove tangle between actuate.endpoint and actuate.endpoint.invoke
See gh-11854
7 years ago
Andy Wilkinson 19ce68d2d8 Prefix endpoint's path to controller endpoint mappings with no path
Previously, if a controll endpoint included a mapping with no path,
it would be mapped to the root of the application rather than the
root of the endpoint's path.

This commit updates the handler mappings for both reactive and Servlet
web applications to treat a mapping with no paths as being a mapping
with a single empty path. This ensures that a path with the endpoint's
path prepended is used for the mapping.

Closes gh-12104
7 years ago
Phillip Webb 9e75680e6f Polish 7 years ago
Andy Wilkinson 17c7f027e0 Add details of the request mapping conditions to mappings endpoint
Closes gh-12080
7 years ago
Andy Wilkinson 2c19257d6d Add HandlerMethod and HandlerFunction details to mappings endpoint
Closes gh-11864
7 years ago
Phillip Webb 6771cc9674 Polish 7 years ago
Andy Wilkinson d238a31d3d Polish 7 years ago
Stephane Nicoll b28cabdb12 Polish "Remove unnecessary config options for metrics"
Closes gh-12017"
7 years ago
Jon Schneider 49f21a2264 Remove unnecessary config options for JDBC, Rabbit, and Cache metrics
See gh-12017
7 years ago
Stephane Nicoll 28f5392787 Polish "Add health indicator for reactive MongoDB"
Closes gh-11997
7 years ago
Yulin Qin eee2694648 Add health indicator for reactive MongoDB
See gh-11997
7 years ago
Stephane Nicoll d468a0714e Polish "Polish modifier order"
Closes gh-12019
7 years ago
Johnny Lim 87bf0b26df Polish modifier order
See gh-12019
7 years ago
igor-suhorukov 71351de694 Remove redundant casts
See gh-12011
7 years ago
Phillip Webb 3bec55e16c Formatting 7 years ago
Madhura Bhave 16a499b2fa Cloud Foundry health should always show details
Fixes gh-12014
7 years ago
Phillip Webb f34aa6f4d8 Migrate to Spring Integration Micrometer support
Remove custom `SpringIntegrationMetrics` and instead provide
auto-configuration to the direct Micrometer support added in Spring
Integration 5.0.2.

Closes gh-11985
7 years ago
Phillip Webb 0348889fd7 Polish 7 years ago
Stephane Nicoll 7473642f58 Harmonize endpoints exclude property
Closes gh-11914
7 years ago
Andy Wilkinson bc814d2039 Prevent authenticated principal from clashing with argument of same name
Closes gh-11988
7 years ago
Phillip Webb d259f68fbf Drop recordRequestPercentiles property
Drop the `recordRequestPercentiles` property as it overlaps with the
property based `MeterFilter` support.

Fixes gh-11982
7 years ago
Andy Wilkinson 2993dccd1e Provide links to all types of endpoints
Previously, links were only provide to web endpoints. This commit
expands link resolution to also provide links for servlet endpoints,
controller endpoints, and rest controller endpoints.

Closes gh-11902
7 years ago
Phillip Webb d2418b99ef Fix checkstyle errors 7 years ago
Phillip Webb 5de46c3186 Polish 7 years ago
Phillip Webb 387804e600 Format with Eclipse Oxygen SR2 7 years ago
Andy Wilkinson dec37ec5e2 Move EndpointMapping into spring-boot-actuator 7 years ago
Andy Wilkinson 4beb6be179 Rename HTTP trace properties and packages
Closes gh-11934
7 years ago
Stephane Nicoll 7cd19822c6 Polish "Add Kafka health indicator"
Closes gh-11515
7 years ago
Juan Camilo Rada 0dbd9429cc Add Kafka health indicator
See gh-11515
7 years ago
Andy Wilkinson 76a450dfba Format with Eclipse Oxygen SR2 7 years ago
Madhura Bhave dd3bcc5691 Polish 7 years ago
Andy Wilkinson efc3f888da Avoid exception throw-catch for non-MatchableHandlerMapping mappings
Closes gh-11912
7 years ago
Andy Wilkinson 8605499a64 Provide more control over when the health endpoint shows details
Closes gh-11869
7 years ago
Andy Wilkinson 1975d51106 Add support for injecting a Principal into web endpoint operations
Closes gh-11941
7 years ago
Andy Wilkinson 7d561f5ed0 Polish "Align with Micrometer's standardized cache metrics"
Closes gh-11918
7 years ago
Jon Schneider ba52aa3674 Align with Micrometer's standardized cache metrics
See gh-11918
7 years ago
Phillip Webb b5c4ce230d Ensure full commit id is always available
Update `GitProperties` so that the `commit.id` entry is also copied to
`commit.id.full`.

Prior to this commit, when returning full details, the value of
`commit.id` would be replaced with a `Map` containing only `abbriv` as
a key. By  copying the value to a sub-key we ensure that it remains
available both in the FULL and SIMPLE modes.

Fixes gh-11892
7 years ago
Phillip Webb 69234f8c08 Polish 7 years ago
dreis2211 81459efffa Use HTTPS URLs where applicable 7 years ago
Andy Wilkinson 8a123d3289 Polish 7 years ago
Andy Wilkinson 875091ed85 Polish “Remove or use unused method parameters”
Closes gh-11812
7 years ago
igor-suhorukov 717bd2c580 Remove or use unused method parameters 7 years ago
Phillip Webb eb83b2e0c2 Fix DataSourceHealthIndicator test failure
Fix failure introduced in commit 8af02ce05b.

See gh-11880
7 years ago
Phillip Webb 8af02ce05b Allow custom AbstractHealthIndicator warning logs
Update `AbstractHealthIndicator` so that the warning message can be
customized. Also updated our existing indicators with better messages.

Fixes gh-11880
7 years ago
Phillip Webb 1e3bae9ba2 Third attempt to fix polish commit 7 years ago
Phillip Webb 84438183e1 Fix compile error due to previous polish 7 years ago
Phillip Webb 7d5e41f7dc Polish 7 years ago
Johnny Lim 3cead7693d Polish
Closes gh-11871
7 years ago
Stephane Nicoll c1ad9b73ba Allow caching for an Endpoint operation with optional arguments
This commit makes sure that caching is enabled if an operation has
nullable parameters and the actual invocation provides null values.

Closes gh-11795
7 years ago
Andy Wilkinson 42135cd5fc Polish "Aggregate max statistics in metrics endpoint with Double#max"
Closes gh-11852
7 years ago
Jon Schneider 92287f75f7 Aggregate max statistics in metrics endpoint with Double#max
See gh-11852
7 years ago
Andy Wilkinson 356efaa7c8 Rename trace to httptrace
Closes gh-11806
7 years ago
Phillip Webb c90a5a9e9e Polish 7 years ago
Phillip Webb 5632d043ff Fix enums following upstream micrometer change
See gh-11575
7 years ago
dreis2211 e7248ff273 Use interfaces for collection declarations
Closes gh-11839
7 years ago
Phillip Webb 3a12f98bab Migrate callbacks to LambdaSafe util
Migrate existing code to the new `LambaSafe` callback handler.

Closes gh-11584
7 years ago
Andy Wilkinson e834b25ef1 Polish 7 years ago
Phillip Webb af50a18da9 Polish 7 years ago
Johnny Lim 914bdb393f Polish
See gh-11811
7 years ago
dreis2211 a7663c88d3 Replace casted Mockito.any() calls
Closes gh-11817
7 years ago
Phillip Webb 5767350380 Polish 7 years ago
Phillip Webb 53b0f0db60 Fix NPE when normalizing client tag URIs
See gh-11798
7 years ago
Stephane Nicoll 6569ed8739 Polish contribution
Closes gh-11809
7 years ago
Johnny Lim a0fb138771 Fix to assert parameter names in EndpointServlet.withInitParameters()
See gh-11809
7 years ago
Johnny Lim 6d68806275 Polish
Closes gh-11805
7 years ago
Phillip Webb 1d8942941e Normalize micrometer client tag URIs
Update `MetricsClientHttpRequestInterceptor` so that captured URIs
are normalize to always contain a leading slash.

Fixes gh-11798
7 years ago
Phillip Webb 25815ca7e1 Refine WebMvcMetricsFilter for async support
Rework `WebMvcMetricsFilter` so that async requests can be handled
correctly.

See gh-11348
7 years ago
Jon Schneider 112ffd7890 Cleanup URLs before using them for metrics
Update `WebMvcTags` to cleanup URLs by removing any double
slashes and any trailing slash.

Fixes gh-11808
7 years ago
Phillip Webb 1da0f2c6b0 Remove FIXME
See gh-11807
7 years ago
Phillip Webb 643cda480f Migrate to updated micrometer Tags class
See gh-11575
7 years ago
Jon Schneider d1de1cd053 Upgrade to micrometer 1.0.0-SNAPSHOT
Move to the snapshots and rework changed APIs in preparation for
the upcoming rc8 release.

See gh-11575
7 years ago
Phillip Webb b234501af3 Polish 7 years ago
Johnny Lim a46e047c5d Polish
Closes gh-11792
7 years ago
Johnny Lim 946593238e Align missed bits from trace endpoint changes
Closes gh-11789
7 years ago
Andy Wilkinson 3565961d68 Rework HTTP exchange tracing and add support for WebFlux
Closes gh-9980
7 years ago
Andy Wilkinson 9cae416755 Explicitly configure and document WebFilter orderings
Closes gh-11756
7 years ago
Andy Wilkinson 4c23afdcd8 Polish 7 years ago
Phillip Webb d61ba241b5 Move "testdb" naming to DataSourceProperties
Move the "testdb" naming logic to `DataSourceProperties` and expose
the `deduceDatabaseName` method so they can be used in
auto-configuration.

See gh-11719
7 years ago
Stephane Nicoll b67903a04a Keep "testdb" default datasource name internal
Previously, Hikari's pool name was auto-configured with the value of
`spring.datasource.name` that defaults  to `testdb`, which brings some
confusion.

This commit removes the default `testdb` value on
`spring.datasource.name` as it is a sane default only for an embedded
datasource. It is applied whenever applicable instead.

Closes gh-11719
7 years ago
Phillip Webb 017efda6ec Add @EndpointServlet and migrate Jolokia
Add first class support for Servlet based endpoints and rework the
Jolokia endpoint to use it.

Fixes gh-10264
7 years ago
dreis2211 542c3b7c1e Remove usage of Vector collection
Closes gh-11759
7 years ago
igor-suhorukov 093ca0a687 Use EnumMap whenever possible
Replace regular Map instances with EnumMap to reduce memory consumption.

Closes gh-11760
7 years ago
Phillip Webb ab6ad6aa4b Polish 7 years ago
Stephane Nicoll 1f4a32f0ad Add a way to signal that an endpoint request is invalid
This commit adds InvalidEndpointRequestException as a technology
agnostic way to signal that an endpoint request is invalid. When such
exception is thrown, the web layer translates that to a 400.

Rather than overriding the reason, this commit makes sure to reuse the
error infrastructure.

Closes gh-10618
7 years ago
andrey.onufreyko b19dcb13e2 Replace string arguments with char
Optimize method calls by replacing single character String arguments
with char.

Closes gh-11680
7 years ago
Johnny Lim 768e7c07e6 Polish
Closes gh-11720
7 years ago
Brian Clozel a8baf42f2f Ensure that CharacterEncodingFilter is ordered first
This commit makes sure that `CharacterEncodingFilter` is ordered with
the `Ordered.HIGHEST_PRECEDENCE` and that other filters, potentially
reading the request body, are ordered after.

In this particular case, both `WebMvcMetricsFilter` and
`ErrorPageFilter` are now ordered at `Ordered.HIGHEST_PRECEDENCE + 1` to
avoid cases where the request body is read before the encoding
configuration is taken into account.

Closes gh-11607
7 years ago
Andy Wilkinson 66164bff14 Polish 7 years ago
Andy Wilkinson fbb1ba1bb3 Move actuator mappings introspection classes into dedicated packages
Closes gh-9979
7 years ago
Stephane Nicoll 886ee9c870 Polish 7 years ago
Phillip Webb 80bba046a3 Fix broken javadoc import 7 years ago
Phillip Webb bda9b892b3 Add direct WebFlux and WebMvc endpoint support
Add `@ControllerEndpoint` and `@RestControllerEndpoint` annotations that
can be used to develop a Spring-only request mapped endpoint. Both
Spring MVC and Spring WebFlux are supported.

This feature is primarily for use when deeper Spring integration is
required or when existing Spring Boot 1.5 projects want to migrate to
Spring Boot 2.0 without re-writing existing endpoints. It comes at the
expense of portability, since such endpoints will be missing from
Jersey.

Fixes gh-10257
7 years ago
Phillip Webb 340ef52f78 Refactor endpoint path concerns
Create a `PathMappedEndpoint` interface that allows any `ExposedEndpoint`
to provide root path details. The `EndpointPathResolver` interface has
been renamed to `PathMapper` and is now only used during endpoint
discovery.

`EndpointPathProvider` has been replaced with `PathMappedEndpoints`
which simply finds relevant path mapped endpoints.

Fixes gh-10985
7 years ago
Phillip Webb 1d39feffea Overhaul actuator endpoint code
Refactor several areas of the actuator endpoint code in order to make
future extensions easier. The primary goal is to introduce the concept
of an `ExposableEndpoint` that has technology specific subclasses and
can carry additional data for filters to use. Many other changes have
been made along the way including:

* A new EndpointSupplier interface that allows cleaner separation of
  supplying vs discovering endpoints. This allows cleaner class names
  and allows for better auto-configuration since a user can choose to
  provide their own supplier entirely.

* A `DiscoveredEndpoint` interface that allows the `EndpointFilter`
  to be greatly simplified. A filter now doesn't need to know about
  discovery concerns unless absolutely necessary.

* Improved naming and package structure. Many technology specific
  concerns are now grouped in a better way. Related concerns are
  co-located and concepts from one area no longer leakage into another.

* Simplified `HandlerMapping` implementations. Many common concerns have
  been pulled up helping to create simpler subclasses.

* Simplified JMX adapters. Many of the intermediary `Info` classes have
  been removed. The `DiscoveredJmxOperation` is now responsible for
  mapping methods to operations.

* A specific @`HealthEndpointCloudFoundryExtension` for Cloud Foundry.
  The extension logic used to create a "full" health endpoint extension
  has been made explicit.

Fixes gh-11428
Fixes gh-11581
7 years ago
Phillip Webb dc935fba48 Polish 7 years ago
Andy Wilkinson fedc4647e1 Use same InetAddress for client and server in endpoint tests
Previously, the server was created with out an explicitly configured
address. This lead to it using any local address which will prefer
IPv6 (::0) if it's available. By contrast, the client was created
with a base URL that specified localhost as the host. This meant the
the client would prefer to connect to IPv4. Normally this wouldn't
cause a problem as nothing would be listening on the port in the IPv4
stack so the client would then connect to the server being tested
using the IPv6 stack. However, if another process was listening to the
port in the IPv4 stack, the client would connect to the wrong server.
This could lead to an unexpected 404 response (if the wrong server
was an HTTP server) or a hang if it was not.

There's a chance, although I think it's unlikely, that the problem
described above is the cause of gh-10569. I think it's unlikely as
the hang tracked by gh-10569 only occurs when running the WebFlux
endpoint integration tests using Reactor Netty. If it was the problem
described above, there's no reason that I can think of why we
wouldn't have also seen it with the Web MVC endpoint integration
tests.
7 years ago