Commit Graph

567 Commits (a615f8a44a924926957d5449ffd671b149b18536)

Author SHA1 Message Date
Andy Wilkinson c1eea4cf40 Ensure that a TTL of zero is honoured by HealthMvcEndpoint
See gh-2630
10 years ago
Andy Wilkinson c849a0aba1 Cache /health response irrespective of sensitivity and security
Previously, the response from /health was not cached if the request
was secure, i.e. the user has authenticated, or the endpoint was
configured as not being sensitive. 

The commit updates HealthMvcEndpoint to apply the caching logic
all the time. Users that do not want caching can disable it by 
configuring the TTL with a value of zero.

Closes gh-2630
10 years ago
Andy Wilkinson 8b20403c41 Use a String when referencing a class with @ConditionalOnMissingClass
Using a Class reference can cause reflection problems at runtime (see
gh-1065).

Closes gh-2674
10 years ago
Phillip Webb 16495d223a Polish 10 years ago
Andy Wilkinson 743482ab69 Tolerate Gauges with non-Number values
Spring Boot's metrics infrastructure requires a Metric to have a
Number value. Coda Hale's ThreadStatesGaugeSet includes a Gauge
named deadlocks with a Set<String> value (each entry in the set is a
description, including stacktrace, of a deadlocked thread). There's
no obvious way to coerce this to a Number, and there's already a
deadlocks.count metric in the set.

This commit updates MetricRegistryMetricReader to ignore the addition
of any Gauge with a non-Number value.

Fixes gh-2593
10 years ago
Andy Wilkinson 4487823ff9 Improve thread-safety of MetricRegistryMetricReader
ee567fa boldy claimed that it had made MetricRegistryMetricReader
thread-safe. It had not. This commit should actually make it thread
safe. I hope.

One notable improvement is that MetricRegistryMetricReader.findAll()
will no longer contain null values if a metric is removed on another
thread during iteration.

names is now a ConcurrentHashMap to allow it to be safely read and
written without holding a lock.

reverse is a LinkedMultiValueMap  which is not thread-safe. This could
lead to values being lost when concurrent add calls were made. Access
to reverse is now protected by synchronizing on an internal monitor
object.

Calls to containsKey(key) followed by get(key) have been reworked to
only call get(key), this avoids the possibility of the key being
removed after the contains check but before the get.

Closes gh-2590
10 years ago
Andy Wilkinson ee567fa8dd Make MetricRegistryMetricReader thread-safe
MetricRegistryMetricReader’s fields where neither final, nor volatile
but could be accessed on multiple threads. This lead to visibility
problems where the value of a field would unexpectedly be null, causing
an NPE.

This commit updates all of the fields to declare them as final, thereby
ensuring that their values are guaranteed to be visible across different
threads.

Fixes gh-2590
10 years ago
Spring Buildmaster 8f0ad02237 Next development version 10 years ago
Phillip Webb 4cac9d7382 Ensure actuator works without Spring MVC
Update MetricFilterAutoConfiguration to ensure that it is only applied
if Spring MVC is on the classpath.

Fixes gh-2542
10 years ago
Phillip Webb 56e31a8c6b Polish 10 years ago
Phillip Webb 10257d96f2 Merge branch '1.1.x' 10 years ago
Phillip Webb 8a8b5d3aa7 Polish 10 years ago
Johannes Stelzer 05e388012d Fix for empty datasource-name in metrics
If there is more than one DataSource and the non-primary bean-name is
'datasource' an incorrect metric name is chosen.

The metrics are named datasource.active and not datasource.xxx.active. To
avoid this, the shortening of the bean-name only occurs if the bean-name
is longer than 'datasource'.

See gh-2320
10 years ago
Andy Wilkinson a8726c4ae1 Merge branch '1.1.x' 10 years ago
Andy Wilkinson d7ae0f3b06 Ensure that management endpoints with nested paths are secured
Previously each endpoint was secured for path, path/, and path.*.
This meant that a request to path/foo was not secured. This commit
secures path/** to ensure that requests to a nested endpoint path are
also secured.

Fixes gh-2476
10 years ago
Phillip Webb 8e398dc6a7 Polish Javadoc
Update Javadoc to add missing @return and @param elements.
10 years ago
Phillip Webb c02b99b257 Rename CodahaleMetricWriter
Deprecate CodahaleMetricWriter and create DropwizardMetricWriter to
reflect the renamed project.

Fixes gh-2442
10 years ago
Phillip Webb 0696695e16 Add package javadoc 10 years ago
Phillip Webb ccdbfd274f Fix Java 8 Javadoc compatibility
Update Javadocs to fix errors caused by Java 8 aggressive linting.

Fixes gh-2233
10 years ago
Phillip Webb 3328c1369f Merge branch '1.1.x'
Conflicts:
	spring-boot/src/main/java/org/springframework/boot/logging/LoggingApplicationListener.java
10 years ago
Phillip Webb 555827cad7 Polish 10 years ago
Stephane Nicoll 763a735bd5 Merge branch '1.1.x'
Conflicts:
	spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointMBeanExportProperties.java
	spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/integration/IntegrationAutoConfiguration.java
10 years ago
Stephane Nicoll d64cc082db Harmonize property name
The property default format is lower case using hyphen. The JMX default
domain property has been harmonized to that format.

Fixes gh-2427
10 years ago
Stephane Nicoll f5f0952837 Merge branch '1.1.x' 10 years ago
Stephane Nicoll e70c18d05b Fix name of solr health indicator
Fixes gh-2410
10 years ago
Spring Buildmaster 60725cd8bd Next development version 10 years ago
Phillip Webb 44d81d43f6 Merge branch '1.1.x' 10 years ago
Phillip Webb bd83aca63f Fix InMemoryAuditEventRepository search by date
Update InMemoryAuditEventRepository to consider the date when searching
for events. Also switch to a circular buffer implementation and update
the capacity to limit the total number of items rather than limiting
per principal.

Fixes gh-2291
10 years ago
Phillip Webb 1f775793ee Use Collections.addAll(...) instead of for loops
Replace various for loops which add items to collections with calls
to Collections.addAll(...).

Fixes gh-2277
10 years ago
Mathieu Bernatet bf839e57a5 Fix global `endpoints.enabled` property support
Update AbstractEndpoint to correctly support the `endpoints.enabled`
property. Also fix EnvironmentEnpoint which would previously prevent
the Environment from being set.

Fixes gh-2264
Closes gh-2265
10 years ago
Stephane Nicoll 0a19fd0af0 Merge branch '1.1.x' 10 years ago
Stephane Nicoll 38594cd820 Remove unused code
Closes gh-2244
10 years ago
Dave Syer 94b06be683 Change bean name metricReporitory -> actuatorMetricRepository
Fixes gh-2189
10 years ago
Phillip Webb d7a12a8791 Remove superfluous semi-colons 10 years ago
Phillip Webb 0702b4e7e3 Merge branch '1.1.x'
Conflicts:
	spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfigurationTests.java
	spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration.java
10 years ago
Phillip Webb 96d479c3d9 Make RequestMappingHandlerMapping @Primary
Update WebMvcAutoConfiguration so that the RequestMappingHandlerMapping
bean is @Primary. Prior to this commit a NoUniqueBeanDefinitionException
would be thrown then using the MvcUriComponentsBuilder.

Fixes gh-2237
10 years ago
izeye bff41358bf Remove unecessary semicolon 10 years ago
Phillip Webb 98135c964b Remove Principal handler logic from security
Update ManagementSecurityAutoConfiguration so that MVC Endpoints that
have Principal arguments are not treated in any special way. This
restores Spring Boot 1.1.x behavior where the 'sensitive' flag is used
to determine access rules.

The HealthMvcEndpoint still uses the Principal (when available) to
determine if full status information can be displayed. It now also
explicitly checks the environment for `endpoints.health.sensitive`
to determine if the user has opted-out and requires complete health
details.

The health MVC endpoint should now work as follows:

* Default configuration - No login is required, full information is only
  displayed if a Principal is available.
* endpoints.health.sensitive=true - Login is required, full information
  is displayed.
* endpoints.health.sensitive=false - Login is not required, full
  information is displayed.

Fixes gh-2211
10 years ago
Phillip Webb 8628adcb74 Order EmbeddedServletContainerCustomizers
Add Ordered interface to all EmbeddedServletContainerCustomizers with
a value of 0. Prior to this commit it was difficult for a user to
define a customizer that would be applied before ours, even if they
implemented Ordered or added @Order annotations.

Fixes gh-2123
10 years ago
izeye 3784959b6f Rename SecurityPrequisite -> SecurityPrerequisite
Closes gh-2179
10 years ago
Alex Panchenko 8f869e6be3 Remove duplicate "should" word from README 10 years ago
Phillip Webb 9f31e09cf0 Fix 'pid' references in the PortFileWriter
Fix numerous copy-paste errors in EmbeddedServerPortFileWriter
where PID concepts are referenced.

Fixes gh-2161
10 years ago
Phillip Webb 5dd40e6999 Polish 10 years ago
Stephane Nicoll 11f5c76968 Properly guard ManagementSecurityAutoConfiguration
ManagementSecurityAutoConfiguration fully relies on the presence of a
web environment, yet the configuration class itself was not guarded by
`@ConditionalOnWebApplication` (while nested config where).

This turned out to be a problem for command-line applications using
spring security (i.e. CRaSH integration).

Fixes gh-2112
10 years ago
Stephane Nicoll e96f75fdc1 Fix management endpoint without Spring Security
The method 'injectIntoSecurityFilter' added In 3c1e48c assumes that
Spring security is in the classpath so any management endpoints that are
deployed on a different port requires Spring Security all the sudden.

This commit separates the creating of the EndpointHandlerMapping in two
mutually exclusive @Configuration: one that is triggered if Spring
Security is not in the classpath and one that is triggered if Spring
Security is in the classpath. The latter apply the security filter in the
endpoint mapping if it exists.

Fixes gh-2124
10 years ago
Stephane Nicoll f8141cbb95 Restore use of management.health.*.enabled keys
The move of health.* keys to management.health.* broke them as they
are not defined as configuration keys and `ManagementServerProperties`
is strict on the whole management namespace.

This commit updates the tests to actually include that properties class
and relax the "ignoreUnknownFields" condition so that extra attributes
can be defined on the "management" namespace.

Fixes gh-2115
10 years ago
Spring Buildmaster 63e6a25097 Next development version 10 years ago
Spring Buildmaster 1a788c1741 Next development version 10 years ago
Phillip Webb c678c1f788 Polish 10 years ago
Phillip Webb a27217ae43 Provide a way to opt-in to endpoint enablement
Update AbstractEndpoint so that the `enable` property is optional and
when it not specified the `endpoints.enabled` property will be used.

This allows users to switch the way that endpoints are enabled. Rather
than opting-out specific endpoint enablement the `endpoints.enabled`
property can be set to `false` and specific endpoints can be opted-in.

Fixes gh-2102
10 years ago