Commit Graph

584 Commits

Author SHA1 Message Date
Phillip Webb
df0ba5c03a Guard against metric failures in MetricsFilter
Update MetricsFilter so that failures to record metrics are logged and
ignored.

Fixes gh-2777
2015-06-02 14:30:59 -07:00
Phillip Webb
1d5a62b3df Show endpoint.isEnabled in /configprops
Update `ConfigurationPropertiesReportEndpoint` so that properties that
are set with a Boolean class but read with a boolean primitive still
appear in the report. The allows the Endpoint.isEnabled() property to
be displayed.

Fixes gh-2929
2015-06-02 12:01:47 -07:00
Phillip Webb
aaa2ff54dd Extract @ConditionalOnEnabledEndpoint
Extract @ConditionalOnEnabledEndpoint to a top level class.

See gh-2798
2015-06-02 11:17:23 -07:00
Phillip Webb
968b68c322 Polish 2015-06-02 11:17:16 -07:00
Andy Wilkinson
ffcc854d42 Include exception in warning message when pid file cannot be created
Closes gh-2905
2015-05-05 16:40:48 +01:00
Josh Thornhill
b16a973d6a Honor the endpoint.enabled property when registering MBeans
Fixes gh-2873
Closes gh-2890
2015-04-30 15:28:45 +01:00
Rob Winch
b54960f072 Management Security uses Spring Realm
Previously ManagementSecurityAutoConfiguration used Spring Security's
default realm of "Realm" when authentication failed. This was confusing
because when prompted for authentication (i.e. no credentials provided)
the realm "Spring" was requested.

This commit ensures the Realm that is used is consistent for all of of the
security auto configuration.

Fixes #2466
2015-04-27 17:32:47 -05:00
Andy Wilkinson
764e34b9db Don’t start child context for actuator endpoints when not embedded
Prior to this commit, EndpointWebMvcAutoConfiguration would start a
child context if the management port was different to the server port
and the application context was a web application context. This caused
two problems:

If a user built an executable war and configured the management port so
that it was different to the server port, their application would run
successfully when launched with java -jar, but it would fail when
deployed to Tomcat as an attempt would be made to start embedded Tomcat.

Secondly, if a user ran a test annotated with @WebAppConfiguration the
main embedded Tomcat instance would not be started, but the child
context would trigger the creation of a Tomcat instance listening on the
configured management port. This is unexpected as @WebIntegrationTest
or @IntegrationTest and @WebAppConfiguration should be required to have
the test trigger full startup of the application and listen on the
configured ports.

This commit updates EndpointWebMvcAutoConfiguration so that it will only
start a child context when the management port is different to the
server port and the EmbeddedWebApplicationContext has an embedded
servlet container. This resolves the two problems described above as
there will be no embedded servlet container when deployed to a
standalone container or when a test is run without @IntegrationTest.

Fixes gh-2798
2015-04-15 13:47:30 +01:00
Andy Wilkinson
0c7708bf9f Update MetricFilter to treat an unsuccessful call to doFilter as a 500
Previously, if a call to doFilter in MetricFilter failed (i.e. it threw
an exception), it would be handled as if it had a response status of
200. This is because the servlet container was yet to handle the
exception and set the response status to 500.

This commit updates MetricFilter to assume that an exception thrown from
doFilter will result in a response with a status of 500. Strictly
speaking, even though the filter has highest precedence and will
therefore run last on the way back out, this may not always be the case.
For example, a custom Tomcat Valve could handle the exception and result
in a 200 response but that’s an edge case that’s into shooting yourself
in the foot territory.

Closes gh-2818
2015-04-14 12:24:32 +01:00
Stephane Nicoll
08959286e2 Fix "keys-to-sanitize" property doc 2015-04-13 12:28:34 +02:00
Phillip Webb
e94de70358 Polish 2015-04-09 10:42:53 -07:00
Dave Syer
8cdff1cf70 Fix bug in trace repository
When reverse==false we have to be careful to remove the right element
when capacity is reached.
2015-04-09 13:11:59 +01:00
Dave Syer
8ef21b31ad Add flag to TraceRepository to reverse order of listing
Default to true (so existing apps change their behaviour, but that
seems to be the majority vote).

Fixes gh-2794
2015-04-09 12:04:19 +01:00
Andy Wilkinson
83f842a226 Reinstate support for relaxed binding for endpoint enablement
This commit improves upon the changes made in a8bf9d3 by adding
support for relaxed binding of the endpoints.enabled and
endpoints.<name>.enabled properties. This is achieved by replacing
use of @ConditionalOnExpression (which does not support relaxed
binding) with a custom condition implementation that uses
RelaxedPropertyResolver.

Closes gh-2767
2015-04-08 11:29:41 +01:00
Andy Wilkinson
a8bf9d34d5 Honour endpoint.enabled:false for nested paths
Previously, only invocations of /metricName/ would honour the enabled
property and return a not found (404) response. For endpoints which
support nested paths, access to /metricName/foo would ignore the enabled
flag and return an OK (200) response. Furthermore, there was a comment
in EndpointMvcAdapter that suggested that an endpoint shouldn’t be
called when it is disabled, however this was not the case.

This commit updates EndpointWebMvcAutoConfiguration and
JolokiaAutoConfiguration to only register their MvcEndpoint beans if
the underlying endpoint is enabled. This means that an
EndpointMvcAdapter should not be called if its delegate is disabled,
making the comment described above accurate.

The check for the delegate being enabled has been retained so as not to
rely upon the auto-configurations’ behaviour. The methods which handle
nested paths (MetricsMvcEndpoint.value() and
EnvironmentMvcEndpoint.value()) have been updated to add the same check
for the enablement of their delegate.

Fixes gh-2767
2015-04-07 17:43:02 +01:00
Spring Buildmaster
e03c11dda8 Next development version 2015-03-30 22:56:20 -07:00
Phillip Webb
4c50c9eaa8 Allow basic SystemPublicMetrics on GAE
Update SystemPublicMetrics to silently ignore ManagementFactory
NoClassDefFoundErrors which can occur when deploying to Google App
Engine.

Fixes gh-2701
2015-03-24 13:56:12 -07:00
Andy Wilkinson
c1eea4cf40 Ensure that a TTL of zero is honoured by HealthMvcEndpoint
See gh-2630
2015-03-19 17:16:08 +00:00
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
2015-03-19 16:23:04 +00:00
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
2015-03-18 11:16:58 +00:00
Phillip Webb
16495d223a Polish 2015-03-16 14:11:43 -07:00
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
2015-03-05 11:07:58 +00:00
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
2015-03-04 15:03:03 +00:00
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
2015-03-03 16:54:30 +00:00
Spring Buildmaster
8f0ad02237 Next development version 2015-02-26 15:26:53 -08:00
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
2015-02-24 13:08:42 -08:00
Phillip Webb
56e31a8c6b Polish 2015-02-23 19:21:37 -08:00
Phillip Webb
10257d96f2 Merge branch '1.1.x' 2015-02-23 18:02:23 -08:00
Phillip Webb
8a8b5d3aa7 Polish 2015-02-23 13:34:55 -08:00
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
2015-02-13 09:31:31 +01:00
Andy Wilkinson
a8726c4ae1 Merge branch '1.1.x' 2015-02-12 17:53:07 +00:00
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
2015-02-12 17:50:38 +00:00
Phillip Webb
8e398dc6a7 Polish Javadoc
Update Javadoc to add missing @return and @param elements.
2015-02-03 11:35:06 -08:00
Phillip Webb
c02b99b257 Rename CodahaleMetricWriter
Deprecate CodahaleMetricWriter and create DropwizardMetricWriter to
reflect the renamed project.

Fixes gh-2442
2015-02-02 22:19:06 -08:00
Phillip Webb
0696695e16 Add package javadoc 2015-02-02 17:05:38 -08:00
Phillip Webb
ccdbfd274f Fix Java 8 Javadoc compatibility
Update Javadocs to fix errors caused by Java 8 aggressive linting.

Fixes gh-2233
2015-02-02 17:05:37 -08:00
Phillip Webb
3328c1369f Merge branch '1.1.x'
Conflicts:
	spring-boot/src/main/java/org/springframework/boot/logging/LoggingApplicationListener.java
2015-02-01 20:28:11 -08:00
Phillip Webb
555827cad7 Polish 2015-02-01 20:00:11 -08:00
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
2015-01-29 16:45:00 +01:00
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
2015-01-29 16:42:24 +01:00
Stephane Nicoll
f5f0952837 Merge branch '1.1.x' 2015-01-26 03:28:17 +01:00
Stephane Nicoll
e70c18d05b Fix name of solr health indicator
Fixes gh-2410
2015-01-26 03:27:53 +01:00
Spring Buildmaster
60725cd8bd Next development version 2015-01-07 23:37:07 -08:00
Phillip Webb
44d81d43f6 Merge branch '1.1.x' 2015-01-06 12:00:41 -08:00
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
2015-01-06 11:58:28 -08:00
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
2015-01-04 11:49:06 -08:00
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
2014-12-31 19:05:25 -08:00
Stephane Nicoll
0a19fd0af0 Merge branch '1.1.x' 2014-12-28 10:52:16 +01:00
Stephane Nicoll
38594cd820 Remove unused code
Closes gh-2244
2014-12-28 10:51:53 +01:00
Dave Syer
94b06be683 Change bean name metricReporitory -> actuatorMetricRepository
Fixes gh-2189
2014-12-27 07:44:17 +00:00