Commit Graph

611 Commits

Author SHA1 Message Date
Dave Syer
49fbf215a1 Switch to Dropwizard metrics 3.1.0
Fixes gh-1775
2014-10-31 18:52:42 +00:00
Dave Syer
afb7156804 Add missing method for Java 1.7 2014-10-31 18:52:25 +00:00
Dave Syer
a284d7bd3f Add Codahale metrics to /metrics endpoint
All metrics in the MetricRegistry have been added unconditionally for now.

Fixes gh-1795
2014-10-31 09:33:33 +00:00
Phillip Webb
cf24af0bfb Rework logging to prevent double initialization
Prior to this commit LoggingSystem initialization would happen multiple
times. Once to configure "quiet" logging, and again to configure correct
settings once the Application was initialized. This could cause problems
if `logging.groovy` logback files were used.

The logging system is now only initialized once (when possible) by
following these steps:

- Standard logging initialization occurs via the actual logging
  implementation used (e.g. logback will load a logback.xml file if it
  exists)
- beforeInitization() is called to prevent early log output.
  Implementations now either use a Filter or simply set the root logging
  level.
- initialize() is called with an optional log configuration file (e.g
  a custom logback.xml location) and an optional log output file (the
  default is null indicating console only output).

The initialize() method will attempt to prevent double initialization
by checking if a standard configuration file exists. Double
initialization now only occurs in the following situations:

- The user has a standard configuration file (e.g. classpath:logback.xml)
  but also specifies a logging.config property. Double initialization is
  required since the specified configuration file supersedes the default.
- The user has a standard configuration file (e.g. classpath:logback.xml)
  and specifies a logging.file property. Double initialization is
  required since the standard configuration may use a ${LOG_FILE}
  reference.

In addition this commit removes the `logging.console` option and now
assumes that logging either occurs only to console or to both the
console and a file. This restriction helps simplify the LoggingSystem
implementations. If file only logging is required a custom logback.xml
can be used.

Fixes gh-1091
See gh-1612, gh-1770
2014-10-30 00:13:13 -07:00
Phillip Webb
d17b7c8195 Polish 2014-10-29 12:08:37 -07:00
Christian Dupuis
6c66ff78c0 Fix health status aggregation bug 2014-10-28 15:47:27 +01:00
Dave Syer
24e71e868f Allow /health and /info to authenticate anonymously
Then we can optionally find a non-anonymous principal if there
is one. If the user is anonymous then the health result is cached
up to endpoints.health.ttl (default 1000ms) to prevent a DOS attack.

Fixes gh-1353
2014-10-27 16:58:01 +00:00
Phillip Webb
2e7aa4685b Polish 2014-10-21 20:34:00 -07:00
Brett Wooldridge
9984939c47 Update HikariCP to 2.1.0, compile against the Java 6-compatible artifact
For those running applications on Java 8, dependency management for the
Java 8-compatible artifact is also provided.

Closes gh-1721
2014-10-16 15:21:57 +01:00
Dave Syer
d251b51338 Integrate with @TestPropertySource
Spring 4.2 has a @TestPropertySource which has some of the features of
@IntegrationTest. This change adds @TestPropertySource to the @IntegrationTest
annotation, so that (for instance) the cache key for the context includes
properties for the test.

Since @IntegrationTest has slightly different semantics I do not propose to
deprecate it. Users can use it or @TestPropertySource, the main difference being that
with @IntegrationTest the Spring Boot context loader is aware of the annotation
and it will set sensible defaults for server.port and spring.jmx.enabled.

There are some reflection hacks to overcome the usual fortifications of Spring Test.

Fixes gh-1697
2014-10-15 17:05:57 +01:00
Andy Wilkinson
7211571969 Fix some grammar issues in docs
Closes gh-1695
2014-10-13 13:18:24 +01:00
Eric Dahl
16937746a0 Fix some grammar issues in docs 2014-10-13 12:22:14 +01:00
Phillip Webb
c90633aab6 Polish 2014-10-10 17:27:26 -07:00
Spring Buildmaster
3e71a21b30 Next development version 2014-10-10 15:19:47 -07:00
Phillip Webb
dca637f51f Replace @ConditionalOnExpression with OnProperty
Replace where possible all @ConditionalOnExpression annotations with
@ConditionalOnProperty which is both faster to run and more descriptive.

Fixes gh-1685
2014-10-10 11:48:05 -07:00
Andy Wilkinson
6ec0b4ca81 Only consider letters when checking if a name is upper-case
Previously, for a string to be considered upper-case,
EmbeddedServerPortFileWriter required every character in the
string to be upper-case. This meant that strings containing numbers were
considered lower-case even if every letter in the string was upper-case.
OS X’s case-preserving, case-insensitive file system masked this problem
as the tests were still able to find the created file, even though the
case of its name was not as expected.

This commit updates EmbeddedServerPortFileWriter to only require
characters that are letters (as defined by Character.isLetter()) to be
upper-case. It also updates the tests to verify that the case of the
created file’s name is correct in such a way that it will fail, even
on OS X, when it is not.

Fixes gh-1676
2014-10-09 14:17:18 +01:00
Phillip Webb
6a423d7ad1 Add EmbeddedServerPortFileWriter
Add a EmbeddedServerPortFileWriter which can be used to write server
port information to a file.

Fixes gh-1275
Closes gh-1491
2014-10-08 23:03:35 -07:00
Phillip Webb
77ccd9a80b Rename ApplicationPidListener
Rename ApplicationPidListener to ApplicationPidFileWriter (keeping the
old class in a deprecated form)

Fixes gh-1673
2014-10-08 21:30:35 -07:00
Phillip Webb
4c51aa8e28 Polish 2014-10-08 11:34:11 -07:00
Andy Wilkinson
b8eb13d827 Fix tests after addition of disk space health indicator 2014-10-08 18:00:56 +01:00
Andy Wilkinson
97178915a4 Polish disk space health indicator
- Supply auto-configuration for the new indicator
 - As suggested in the pull request, include the free disk space and
   configured threshold in the health details
 - Update the documentation to describe the indicator and its
   two configuration settings
 - Use @ConfigurationProperties to bind the indicator's configuration.
   This should make the changes sympathetic to the work being done
   to automate the configuration properties documentation

Closes gh-1297
2014-10-08 17:24:38 +01:00
Mattias Severson
78d7fe9cb5 Add HealthIndicator that checks free disk space
See gh-1297
2014-10-08 17:24:30 +01:00
Phillip Webb
62eb01f0b8 Polish 2014-10-06 12:03:51 -07:00
Phillip Webb
872f30e5d0 Merge branch '1.1.x'
Conflicts:
	spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/repository/redis/RedisMetricRepository.java
2014-10-06 10:29:04 -07:00
Phillip Webb
9dfbc25eaa Polish 2014-10-06 10:26:12 -07:00
Andy Wilkinson
06e18c6a46 Merge branch 'gh-1664' 2014-10-06 12:11:25 +01:00
Andy Wilkinson
e90c8548a2 Make MetricFilter auto-configuration conditional on OncePerRequestFilter
In addition to requiring the Servlet API to be on the classpath,
MetricFilter requires spring-web to also be on the classpath as it
extends OncePerRequestFilter. This commit updates the auto-configuration
for MetricFilter so that it will be disabled in the absence of a 
dependency on spring-web.

Fixes gh-1664
2014-10-06 11:21:26 +01:00
Dave Syer
d63bbdfe44 Change constructor signature for RedisMetricRepository
Otherwise we had to rely on afterPropertiesSet() being called to
validate and compute the prefix and key (which depend on each
other).
2014-10-02 17:05:50 +01:00
Dave Syer
c18b4248e5 Merge 1.1.x with minor conflict 2014-10-02 16:44:16 +01:00
Dave Syer
e913b35227 Merge 1.1.x with minor conflict 2014-10-02 16:43:56 +01:00
Dave Syer
d724c9062b Change key value if prefix changes
Some weird looking test failures led me to track this down.
If the user changes the prefix for metric names, he probably wanted
to change the keys as welll (otherwise 2 repositories can use the
same key, which is why the test was failing for me). We can do that
in an afterPropertiesSet().
2014-10-02 16:36:07 +01:00
Dave Syer
a702ff5c36 Make ServerProperties bean conditional on being a webapp 2014-10-02 15:43:47 +01:00
joshiste
9af8fdb8a1 Expose RichGauges in MetricsEndpoint via PublicMetrics
Fixes gh-1635
2014-10-02 09:27:16 +01:00
Andy Wilkinson
c601c09ecc Upgrade to Hibernate Validator 5.1.2.Final
Closes gh-1595
2014-10-01 17:28:29 +01:00
Dave Syer
2f4b89d19b Merge branch '1.1.x' 2014-10-01 16:12:28 +01:00
Dave Syer
c3d1241e71 Allow override of pidfile location
The file name can now be overridden at runtime with a System property or
environment variable named "PIDFILE" (or "pidfile").

Fixes gh-1579
2014-10-01 16:11:11 +01:00
Dave Syer
dd8db93781 Merge branch '1.1.x' 2014-10-01 08:26:58 +01:00
Dave Syer
79deed7ec5 Remove extra trailing '-' in metric name 2014-10-01 08:26:51 +01:00
Dave Syer
bfb387bc02 Default prefix for redis keys doesn't need period 2014-09-30 15:09:22 +01:00
Spring Buildmaster
edb4b7ed7d Next development version 2014-09-25 21:02:37 -07:00
Phillip Webb
b9edf3c500 Merge branch '1.1.x' 2014-09-25 20:16:04 -07:00
Phillip Webb
fa02c01727 Polish 2014-09-25 20:15:49 -07:00
Dave Syer
9d9819c338 Merge branch '1.1.x' 2014-09-25 18:15:33 +01:00
Dave Syer
c1404b1e41 Tidy some Javadocs 2014-09-25 18:15:15 +01:00
Phillip Webb
0d0e5eb590 Merge branch '1.1.x' 2014-09-25 10:05:35 -07:00
Dave Syer
336b96b81c Copy server customization to management context
If the actuator endpoints are configured on a different port then there
are some settings in the main ServerProperties that we would like to
re-use (e.g. the access log). The easiest way to do that is to just
configure the management server using the same ServerProperties instance
and then overwrite the things that are different (and stored in
ManagementServerProperties).

Fixes gh-1581
2014-09-25 09:57:24 -07:00
Andy Wilkinson
944045cd34 Merge branch '1.1.x' 2014-09-22 09:27:13 +01:00
Marius Bogoevici
5c84e17d10 Activate WebSecurityEnabler only for web applications
Done in order to align with the rest of the configuration. Absent this
check, the bean will be installed in non-web applications without the
corresponding dependencies, causing the bootstrap to fail.

Closes gh-1588
2014-09-22 09:26:41 +01:00
Andy Wilkinson
3c93d9a803 Merge branch '1.1.x' 2014-09-17 19:41:14 +01:00
Andy Wilkinson
6dcaec2fef Make all @Bean methods public
This is a continuation of the changes made in 611f978. It makes some
more @Bean methods public and adds tests to spring-boot-actuator and
spring-boot-autoconfigure to prevent against non-public methods being
introduced in the future

Closes gh-1571
2014-09-17 19:39:39 +01:00
Phillip Webb
88f8eb7fa4 Merge branch '1.1.x' 2014-09-17 10:46:30 -07:00
Phillip Webb
611f978181 Make all @Bean methods public
Fixes gh-1571
2014-09-17 10:45:23 -07:00
Phillip Webb
4f610fa5a1 Merge branch '1.1.x'
Conflicts:
	spring-boot-samples/spring-boot-sample-tomcat-ssl/pom.xml
	spring-boot-samples/spring-boot-sample-tomcat-ssl/src/test/java/sample/tomcat/SampleTomcatSslApplicationTests.java
	spring-boot/src/main/java/org/springframework/boot/context/embedded/ConfigurableEmbeddedServletContainer.java
	spring-boot/src/main/java/org/springframework/boot/context/embedded/Ssl.java
2014-09-17 10:11:30 -07:00
Phillip Webb
fae9ab4140 Fix failing tests 2014-09-17 10:08:05 -07:00
Dave Syer
049cd4b85b Merge branch '1.1.x' 2014-09-13 10:59:32 -05:00
Dave Syer
deef784403 Blitz some more special characters from the metric names
When MVC path matchers are used as metric keys, they can still contain
invalid characters and patterns (like asterisks). This change removes
some more special characters and also tidies up the names a bit so
no key part starts or ends with "-" (which is ugly).

Fixes gh-1528
2014-09-13 10:59:20 -05:00
Dave Syer
437fb75424 Add /error to ignored paths for security autoconfig
Protecting /error doesn't make a great deal of sense and if it is
protected you don't get the ErrorPageFilter for the attempt at loading
it, so Tomcat renders its own HTML error page (when deployed as WAR).

Fixes gh-1548
2014-09-13 10:55:39 -05:00
Dave Syer
f26209f248 Blitz some more special characters from the metric names
When MVC path matchers are used as metric keys, they can still contain
invalid characters and patterns (like asterisks). This change removes
some more special characters and also tidies up the names a bit so
no key part starts or ends with "-" (which is ugly).

Fixes gh-1528
2014-09-13 07:08:06 -05:00
Spring Buildmaster
d63e4b4329 Next development version 2014-09-04 12:15:18 -07:00
Phillip Webb
8bf1f9567a Apply eclipse formatting and cleanup rules 2014-09-04 09:49:13 -07:00
Phillip Webb
eaa3bd040d Apply eclipse formatting rules 2014-09-04 09:39:58 -07:00
Phillip Webb
57a154520e Drop min/max DataSourcePool metrics 2014-09-02 09:54:16 -07:00
Phillip Webb
c8809afe1b Polish 2014-09-01 13:11:37 -07:00
Phillip Webb
5001b038cb Expose additional pool metrics
Expose `max` and `min`, alongside the existing `active` and `usage`
metrics.
2014-09-01 12:38:31 -07:00
Phillip Webb
4c8d35db43 Rename CompositeDataSourcePoolMetadataProvider
Rename CompositeDataSourcePoolMetadataProvider to
DataSourcePoolMetadataProviders.
2014-09-01 12:38:30 -07:00
Phillip Webb
a512bcf766 Always auto-configure pool metadata providers
Import DataSourcePoolMetadataProvidersConfiguration from
DataSourceAutoConfiguration so that PoolMetadataProviders are configured
even if actuator is not used.
2014-09-01 12:38:26 -07:00
Phillip Webb
69107cb1df Create metadata sub-package
Create `org.springframework.boot.autoconfigure.jdbc.metadata` package
and move DataSourcePoolMetadata classes.
2014-09-01 12:29:04 -07:00
Phillip Webb
e56be6cf3d DataSourceMetadata -> DataSourcePoolMetadata
Rename DataSourceMetadata to DataSourcePoolMetadata
2014-09-01 12:29:01 -07:00
Phillip Webb
e17769fc2f Polish DataSourceMetrics code 2014-09-01 12:27:03 -07:00
Phillip Webb
169a46b1aa Rename MetricDataSourceAutoConfiguration
Rename MetricDataSourceAutoConfiguration to
DataSourceMetricsAutoConfiguration
2014-09-01 11:43:02 -07:00
Phillip Webb
adbded33ff Apply eclipse formatting rules to 3dc932db 2014-09-01 11:42:53 -07:00
Stephane Nicoll
53c4859a6a Reuse data source validation query in health endpoint
This commit improves DataSourceMetadata to expose the validation
query. This can be used by DataSourceHealthIndicator as the query
to use instead of "guessing" which query could be applied according
to the database type.

Fixes gh-1282
2014-08-29 14:58:01 +02:00
Stephane Nicoll
2694941b93 Fix DataSourceMetadata location
This commit complements 3dc932db8 and fix the package location of
DataSourceMetadata.

Fixes gh-1013
2014-08-29 14:35:20 +02:00
Stephane Nicoll
3dc932db88 DataSource metrics
This commit adds an abstraction that provides a standard manner to
retrieve various metadata that are shared by most data sources.

DataSourceMetadata is implemented by the three data source
implementations that boot supports out-of-the-box: Tomcat, Hikari and
Commons dbcp.

This abstraction is used to provide two additional metrics per data
source defined in the application: the number of allocated
connection(s) (.active) and the current usage of the connection pool
(.usage).

All such metrics share the 'datasource.' prefix. The prefix is further
qualified for each data source:

* If the data source is the primary data source (that is either the
  only available data source or the one flagged @Primary amongst the
  existing ones), the prefix is "datasource.primary"
* If the data source bean name ends with "dataSource", the prefix is
  the name of the bean without it (i.e. batchDataSource becomes batch)
* In all other cases, the name of the bean is used

It is possible to override part or all of those defaults by
registering a bean with a customized version of
DataSourcePublicMetrics.

Additional DataSourceMetadata implementations for other data source
types can be added very easily, check
DataourceMetadataProvidersConfiguration for more details.

Fixes gh-1013
2014-08-29 11:22:11 +02:00
Mattias Severson
04c3e9979f Fix typo
Fixes gh-1463
2014-08-28 11:13:33 -07:00
Mattias Severson
5dcc4c3829 Fix typo
Fixes gh-1463
2014-08-28 14:30:13 +02:00
Dave Syer
171b2e452b Make ServerProperties bean conditional on being a webapp 2014-08-20 09:09:19 +01:00
Phillip Webb
fc7823bc42 Merge branch '1.1.x' 2014-08-18 17:55:21 -07:00
Phillip Webb
5c34b07742 Fix DefaultCounterService.reset
Fix DefaultCounterService.reset to call the reset method of the
underlying MetricWriter.

Fixes gh-1391
2014-08-18 17:28:23 -07:00
Phillip Webb
83bd36d8e0 Merge branch '1.1.x'
Conflicts:
	spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/JpaProperties.java
2014-08-18 13:02:44 -07:00
Phillip Webb
6e6bc25c44 Polish 2014-08-18 09:57:03 -07:00
Dave Syer
c556175381 Merge branch '1.1.x' 2014-08-13 08:15:59 -07:00
Dave Syer
2fae4afe95 Ensure status in ErrorPageFilter defaults to 200
Fixes gh-1369. Note that this is caused by the ErrorPageFilter, so
only a problem when deployed as a WAR.
2014-08-13 08:14:09 -07:00
Dave Syer
300910f7d5 Merge branch '1.1.x' 2014-08-11 17:43:14 -07:00
Dave Syer
0cf1c6f0e5 Refactor AuthenticationManagerConfiguration to make sure it works
if user also adds @EnableWebMvcSecurity. The problem is that the ordering
of the init() and configure() methods in the Spring Security configurers
can force things to happen too early unless we are careful. It's still a bit
twitchy I would say, but this relatively small change seems to fix the GS guide
and not break any existing tests.

I added a sample which mimic ths GS guide so we get an integration test that
executes the new code paths.

Fixes gh-1364
2014-08-11 17:42:30 -07:00
Phillip Webb
7d0a3ddcce Rename VanillaHealthIndicator to Application...
Rename `VanillaHealthIndicator` to `ApplicationHealthIndicator` and
changed the exposed bean name from `statusHealthIndicator` to
`applicationHealthIndicator`.

This provides less confusing JSON output:

  {"status":"UP","application":{"status":"UP"}}

vs:

  {"status":"UP","status":{"status":"UP"}}

Fixes gh-1291
2014-08-11 09:04:01 -07:00
Christian Dupuis
063f67da5f Maintain same structure in /health output
JSON output of /health now has the same structure for 1 or more HealthIndicators. This makes it easier to consume the response from scripts or apps

fixes #1291
2014-08-08 14:59:04 +02:00
Spring Buildmaster
74d0c5185a Next development version 2014-08-07 11:59:17 -07:00
Phillip Webb
7641f23f71 Merge branch '1.1.x' 2014-08-06 12:26:29 -07:00
Phillip Webb
d854c09d5a Add option to disable X-Application-Context
Add `management.add-application-context-header` option to disable
the automatic adding of the `X-Application-Context` HTTP header.

Fixes gh-1308
2014-08-06 12:25:38 -07:00
Phillip Webb
92899474ac Polish 2014-08-06 09:10:23 -07:00
Dave Syer
1e51c5db15 Merge branch '1.1.x' 2014-08-05 07:56:55 -07:00
Dave Syer
1259057acb Change unknownPath to unmapped 2014-08-05 07:56:02 -07:00
Taylor Wicksell
733b22f46a gh-1331 defaulting 404 response metrics to "unkownPath" when no matching handler can be found
Fixes gh-1331, Fixes gh-1333
2014-08-05 07:55:34 -07:00
Taylor Wicksell
c6f5961ad6 fix for gh-1331 MetricFilter now supports uri template variables when available 2014-08-04 17:19:16 -07:00
Phillip Webb
642224feff Support regex in keys-to-sanitize
Update EnvironmentEndpoint and ConfigurationPropertiesReportEndpoint
to allow regex patterns in `keys-to-sanitize`.

Fixes gh-1245
2014-07-29 15:13:45 -07:00
Phillip Webb
da5c36c3a9 Polish 2014-07-29 13:06:47 -07:00
Phillip Webb
14c6243637 Refactor PublicMetrics registration
Rework flexible PublicMetrics registration introduced in 2be6b3e4 to
restore compatibility with v1.1 VanillaPublicMetrics. The new
MetricReaderPublicMetrics class now exposes metrics from a MetricReader
and VanillaPublicMetrics is deprecated. The MetricsEndpoint can now
exposes a collection of PublicMetric interface directly.

See gh-1094
2014-07-29 12:31:40 -07:00
Andy Wilkinson
2abf3ebdc3 Merge branch '1.1.x' 2014-07-29 15:12:11 +01:00
Andy Wilkinson
333bc3e842 Avoid RS.getObject(index, Object.class) as it breaks MySQL on Java 7
Previously, when running on Java 7+, the JDBC query driven by
DataSourceHealthIndicator resulted in a call to
ResultSet.getObject(index, Object.class). When using MySQL's JDBC
driver this failed with an SQLException with the message "Conversion
not supported for type java.lang.Object". The problem does not occur
on Java 6 as the overload of getObject that takes a type does not
exist; ResultSet.getObject(index) is called instead and MySQL happily
returns whatever type it deems to be appropriate for the column.

This commit updates DataSourceHealthIndicator so that
ResultSet.getObject(index) will always be used, irrespective of the
version of Java that Boot is running on.

Closes #1306
2014-07-29 15:11:53 +01:00
Phillip Webb
53d24301d1 Merge branch '1.1.x' 2014-07-28 15:41:42 -07:00
Phillip Webb
f8bf0e2031 Polish 2014-07-28 15:40:40 -07:00
Christian Dupuis
68163a66a5 Change query in MongoHealthIndicator
This commit changes the query in MongoHealthIndicator from serverStatus to buildInfo to avoid unprivileged access and corresponding errors.

fixes #1289
2014-07-24 10:07:36 +02:00
Christian Dupuis
13ee41d04d Change query in MongoHealthIndicator
This commit changes the query in MongoHealthIndicator from serverStatus to buildInfo to avoid unprivileged access and corresponding errors.

fixes #1289
2014-07-24 10:06:40 +02:00
Christian Dupuis
99b3240ab2 Ensure custom HTTP code mappings for /health don't remove default mappings
Previously any custom http code mapping would remove the default mappings. With this commit the behaviour is changed so that default mappings will stay if a custom mapping is registered. Certainly a default mapping can be overridden.

fixes #1264
2014-07-21 17:06:41 +02:00
Christian Dupuis
977c5a988c Ensure custom HTTP code mappings for /health don't remove default mappings
Previously any custom http code mapping would remove the default mappings. With this commit the behaviour is changed so that default mappings will stay if a custom mapping is registered. Certainly a default mapping can be overridden.

fixes #1264
2014-07-21 16:11:47 +02:00
Christian Dupuis
2f28a1017c Polish and re-add author name 2014-07-18 12:37:02 +02:00
Stephane Nicoll
2be6b3e419 Flexible registration of additional PublicMetrics
This commit permits the use of several PublicMetrics instances by
default. Previously, only one PublicMetrics service could be specified
and a user configuration would remove all the defaulting.

VanillaPublicMetrics now takes a collection of PublicMetrics and
invokes them in sequence to build the final collection of metrics.
The system-related metrics have been moved to SystemPublicMetrics and
are registered by default.

Also updated the documentation to mention this feature and how it
could be fully overridden.

Fixes gh-1094
2014-07-17 16:19:05 +02:00
Christian Dupuis
99971a6578 Fix HTTP status code mapping in HealthMvcEndpoint
refs #1264
2014-07-17 16:12:06 +02:00
Stephane Nicoll
249e09d9bc Switch master to 1.2.0.BUILD-SNAPSHOT 2014-07-11 10:44:05 +02:00
Spring Buildmaster
40327e1ae6 Next development version 2014-07-08 02:33:36 -07:00
Phillip Webb
fa88c481a5 Remote trailing whitespace 2014-07-02 15:17:14 -07:00
Dave Syer
2a1ccfeade Allow /mappings to be disabled (fixes gh-1185) 2014-06-28 07:21:30 +01:00
Spring Buildmaster
981669b7c0 Next development version 2014-06-26 14:09:54 -07:00
Phillip Webb
200cd535c2 Revert "Next development version"
This reverts commit 67189477fe.
2014-06-26 11:03:09 -07:00
Spring Buildmaster
67189477fe Next development version 2014-06-26 10:51:35 -07:00
Phillip Webb
9632abf825 Formatting and cleanup 2014-06-26 09:41:15 -07:00
Dave Syer
123ffd736c Exclude @ManagedResources from Endpoint MBeans
If an Endpoint is already @ManagedResource then it doesn't need
an additional (probably wrong) MBEan registration based on the invoke()
method.
2014-06-26 16:11:56 +01:00
Phillip Webb
1f36d4657f Fix various Windows related issues
Fixes gh-1168
2014-06-25 14:31:41 -07:00
Spring Buildmaster
542f3cbda8 Next development version 2014-06-24 13:53:56 -07:00
Dave Syer
0d5c30fdcc Add instance.uptime to VanillaPublicMetrics 2014-06-24 15:16:49 +01:00
Christian Dupuis
b5d65bfc56 Delegate shell access decision to bean named "shellAccessDecisionManager"
In order to solve issues with multiple or incompatible AccessDecisionManagers, the CRaSH integration will now only delegate to an explicit shellAccessDecisionManager bean refs #1121
2014-06-20 13:58:52 +02:00
Christian Dupuis
edffabeee4 Make sure Spring related security beans for the shell are not installed if not wanted
refs #1121
2014-06-18 16:58:07 +02:00
Christian Dupuis
b439d3522e Fix VanillaHealthIndicator javadoc 2014-06-17 19:57:00 +02:00
Tobias Gesellchen
21846f3bc7 update javadoc and test method to reflect current implementation 2014-06-17 18:10:24 +02:00
Dave Syer
59e177d298 Default endpoints.jmx.domain to the spring.jmx.default_domain 2014-06-17 13:01:04 +01:00
Stephane Nicoll
b646231327 Properly close context hierarchy in tests
Prior to this commit, some tests were creating a parent/child
relationship but were only closing the child context. This could
be an issue with the autoconfig module as a lot of auto-config
kicks in by default.

This commit adds a new test utility designed to properly handle
those situations. Updated tests that were creating a context
hierarchy to benefit from that.

Fixes gh-1034
2014-06-17 10:58:33 +01:00
Phillip Webb
24471bc51e Polish 2014-06-16 12:39:15 -07:00
Dave Syer
9cc6bff177 Increase priority of EndpointHandlerMapping
The Actuator endpoints ought to take precedence over others (since
they are important and users can isolate them using management.contextPath
if necessary). This change puts the @Order at -100 (well before the default
order of the RequestMappingHandlerMapping at 0).

Fixes gh-1107
2014-06-16 17:26:54 +01:00
Dave Syer
3378ede231 Ensure CompositePropertySources are listed in EnvironmentEndpoint 2014-06-16 14:45:06 +01:00
Dave Syer
1bf256dd58 Ensure Weblogic and Websphere JMX are covered
To ensure an MBeanServer is available when needed you have to
look in JNDI before resorting to the JDK platform factory.

I had to copy some private code from Spring, but it seems
worth it.

Fixes gh-1092
2014-06-13 11:27:41 +01:00
Spring Buildmaster
4ca26a21dc Next development version 2014-06-11 10:46:27 -07:00
Spring Buildmaster
05ed7b3bcd Next development version 2014-06-10 12:40:35 -07:00
Phillip Webb
3007a777d0 Roll back to 1.1.0.BUILD-SNAPSHOT 2014-06-10 09:00:08 -07:00
Spring Buildmaster
c650f2391e Next development version 2014-06-09 21:55:19 -07:00
Phillip Webb
b5d267ca89 Polish 2014-06-09 12:33:49 -07:00
Christian Dupuis
5d25588d7b Make properties to sanitize configurable in EnvironmentEndpoint.
Add "key" to default keys that will be sanitized. fixes #1027
2014-06-09 15:07:36 +02:00
Dave Syer
aa30fdba18 Add MBeanServer @Bean in case it is needed
Anywhere that an MBeanServer is needed it should be
created @Conditionally, so that user can exclude the
JmxAutoConfiguration and still get the other JMX
behaviours automatically.
2014-06-09 10:21:49 +01:00
Phillip Webb
e891aa3525 Polish 2014-06-06 22:58:43 -07:00
Phillip Webb
2df4ead4d6 Convert README.md -> README.adoc 2014-06-06 22:56:44 -07:00
Dave Syer
09200361de Align expectations of various JMX configurations
They all want to create an MBeanServer and when that happens
user sees no MBeans, or sometimes just one set (Spring Core,
Spring Integration or Spring Boot). To harmonise them we
create a @Bean of type MBeanServer and link to it in the
other autoconfigs

Fixes gh-1046
2014-06-06 17:52:14 +01:00
Dave Syer
c41fa08a80 Cross link Actuator and User Guide docs
Not having READMEs in github is a mistake IMO, so here's one
restored and with a link to the docs. Docs also updated to
more accurately reflect the location of the actuator features
in implementation.

See https://github.com/spring-guides/gs-actuator-service/pull/7
for the Getting started guide change

Fixes gh-1014
2014-06-04 14:27:29 +01:00
Andy Wilkinson
c0c3c78f8d Add missing entries to the tables of auto-configuration classes
Closes #998
2014-06-04 12:53:33 +01:00
Andy Wilkinson
9b44c322d4 Update dependencies to latest maintenance releases
Despite Javassist 3.18.2-GA being available, it has not be upgraded.
This is to keep it in sync with Hibernate.
2014-06-03 17:03:26 +01:00
Dave Syer
b31295246c Make WebRequestTraceFilter once per request 2014-06-01 09:47:23 +01:00
Dave Syer
5e3cc95ccf Adjust security.basic.enabled=false behaviour
Actually the web-secure sample is misusing
security.basic.enabled=false (IMO) - it should be a flag
to say that you want to temporarily disable the basic security
fallback on application endpoins, not  way to disable all
security autoconfiguration.

Added test case to web-secure sample to ensure a user
can log in.

Fixes gh-979
2014-05-29 13:25:01 +01:00
Phillip Webb
a91e85b848 Add local.management.port when on same port
Add a `local.management.port` alias when the management server is
running on the same port as the main server.

Fixes gh-952
2014-05-27 21:25:33 +01:00
Phillip Webb
91bd78047e Rename TraceWebFilterAutoConfigurationTest
Rename TraceWebFilterAutoConfigurationTest to
TraceWebFilterAutoConfigurationTests
2014-05-27 21:25:33 +01:00
Christian Dupuis
057e149846 Introduce Health.Builder to clean up HealthIndicator implementations 2014-05-27 20:44:54 +02:00
Dave Syer
68448a8c68 Use the ServerProperties to add prefixes to paths
when server.servletPath is set we need to add prefixes to
the security filter paths.

Fixes gh-945
2014-05-24 08:33:14 +01:00
Phillip Webb
96a0d672af Rename SimpleDataSourceHealthIndicator
Rename SimpleDataSourceHealthIndicator to DataSourceHealthIndicator.
2014-05-23 10:58:40 +01:00
Phillip Webb
aa03d9a41c Make Health and Status immutable
Update Health and Status objects to be immutable, update the existing
builder methods to return new instances and add static convenience
methods to Health.
2014-05-23 10:58:40 +01:00
Eric Dahl
3457cc4f39 Fix multiple typos in documentation, as well as "thread.deamon" typo in actuator 2014-05-22 21:18:08 -05:00
Christian Dupuis
297d14f5f8 Polish 2014-05-22 22:44:45 +02:00
Phillip Webb
1a475102de Polish 2014-05-22 20:33:08 +01:00
Andy Wilkinson
d8e783f856 Update SolrHealthIndicator to extend AbstractHealthIndicator 2014-05-22 19:51:33 +01:00
Christian Dupuis
db74d27ea0 Extract AbstractHealthIndicator
to make it more simple to implement HealthIndicator
2014-05-22 19:06:15 +02:00
Andy Wilkinson
b76a519f65 Add a HealthIndicator for Solr 2014-05-22 17:29:12 +01:00
Christian Dupuis
40b55b0ff6 Extract AbstractHealthAggregator
This commit makes it easier for users to implement HealthAggregators
2014-05-22 17:40:38 +02:00
Christian Dupuis
f9aeb6aefe Polish 2014-05-22 17:31:43 +02:00
Dave Syer
59c108a4b0 Fix bug in group names (again) 2014-05-22 15:48:29 +01:00
Dave Syer
1fabfaa259 Align behaviour of in-memory and redis mult repos
The in-memory version has to force the incoming metric keys to
start with the group name. Redis doesn't have that restriction
but normally we expect both to be used in such a way that
the metric keys already match the prefix. In that case the two
repositories behave the same now in terms of set and get.
2014-05-22 15:35:55 +01:00
Dave Syer
0dca2dd978 Small docs tweaks in metrics 2014-05-22 14:51:19 +01:00
Dave Syer
b12d7c705c Improve redis repository implementations
Storing values in zset makes them less prone to races.

Fixes gh-929
2014-05-22 12:41:24 +01:00
Christian Dupuis
b77a9c5a8e Remove List.sort usage for Collections.sort 2014-05-22 13:17:20 +02:00
Dave Syer
0cbd0b609a Add increment() to PrefixMetricWriter
In the redis repository we also switch to store the value in the
zset (so it can be atomically incremented) rather than in the
regular key-value.

Fixes gh-929
2014-05-22 12:05:56 +01:00
Christian Dupuis
14899ba3b2 Fix compile problem
Something slipped the recent merge
2014-05-22 12:45:15 +02:00
Christian Dupuis
0c2bc99af3 Return different http return status codes for different system health states
fixes #880
2014-05-22 12:27:03 +02:00
Christian Dupuis
4bc6a0f49e Rename Status.status to Status.code 2014-05-22 12:27:03 +02:00
Christian Dupuis
4648188782 Rework HealthEndpoint and HealthIndicator
With this commit the state of a component or subsystem becomes a first-class citizen in Boot's application health support. HealthIndicators now return a Health instance with status and some contextual details.

An aggregation strategy has been introduced to aggregate several Health instances into one final application Health instance. Out of the box OrderedHealthAggregator can be configured to allow different ordering or a custom HealthAggregator bean can be registered.
2014-05-22 12:27:03 +02:00
Dave Syer
d59cbc830a Group resolution for RedisMultiMetricRepository with prefix
The prefix needs to be added before looking for keys. In addition
I rationalized the constructor and final fields (it didn't make
any sense for the prefix to be mutable).

Fixes gh-927
2014-05-22 09:35:08 +01:00
Dave Syer
ed2876e931 Add a PrefixMetricWriter interface to cleanly separate write/read
The PrefixMetricGroupExporter only really makes sesne if the writer
is aware of the groups, so it seemed better to use a new interface
than mix read/write.
2014-05-22 09:10:49 +01:00
Dave Syer
94e891e924 Rename method count() -> countGroups()
Fixes gh-923
2014-05-22 09:10:49 +01:00
Phillip Webb
8bcda1bcbe Polish 2014-05-20 18:26:56 +01:00
Christian Dupuis
3f498a4803 Add configuration properties to disable out of the box health checks 2014-05-19 15:54:32 +02:00
Christian Dupuis
4ffe816a21 Fix typo 2014-05-19 15:54:31 +02:00
Christian Dupuis
fef998f914 Remove autowired injection of HealthIndicators into HealthEndpoint
Moved into EndpointAutoConfiguration
2014-05-19 15:54:31 +02:00
Phillip Webb
938609fdc0 Merge branch '1.0.x'
Conflicts:
	spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/CrshAutoConfiguration.java
	spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration.java
2014-05-15 16:35:43 +01:00
Christian Dupuis
875e77d420 Correctly decode URL coming into the Jolokia endpoint
fixes #869
2014-05-15 17:29:21 +02:00
Phillip Webb
fa7da5925b Remove checked exceptions from @PostConstructs
Update all @PostConstruct methods to ensure that they don't throw
checked exceptions. Required to allow deployment of Spring Boot
applications on Glassfish.

Fixes gh-868
2014-05-15 15:47:44 +01:00
Dave Syer
5249f54c5a Integrate @ConfigurationProperties @Beans with DataSource configuration
We now have a much simpler DataSourceAutoConfiguration that binds to whatever
DataSource concrete type it finds at runtime. To be able to quickly switch between
Hikari and the other types of DataSource there's a minute shim for translating
the common properties (username, password, url, driverClassName), but actually
only url is different. The shim and also DataSource initialization is supported
through DataSourceProperties, but the other native properties get bound directly
through the concrete runtime type of the DataSource.

The /configprops endpoint works (and is exposed in the actuator sample).

Fixes gh-840, fixes gh-477, see also gh-808.
2014-05-13 16:46:04 +01:00
Dave Syer
660b73b5c6 Ensure only bindable properties are reported in /configprops
Introspects the properties that are being exposed in the report
and only renders the ones that are a) convertible from String
and b) have a setter. That goes a long way to making it a bullet
proof generic renderer of any Java object that can be bound with
@ConfigurationProperties.
2014-05-13 16:46:03 +01:00
Dave Syer
85719f75e4 Add @Bean-level config properties to /configprops 2014-05-13 16:45:48 +01:00
Christian Dupuis
9e56c38b7a Rename DefaulErrorAttributes to DefaultErrorAttributes
fixes #853
2014-05-13 17:43:28 +02:00
Phillip Webb
30ac768cbf Remove @ControllerAdvice from BasicErrorController
Update the BasicErrorController so that it no longer needs to implement
@ControllerAdvice or have an @ExceptionHandler method.

A new ErrorAttributes interface is now used to obtain error details,
the DefaultErrorAttributes implementation uses a
HandlerExceptionResolver to obtain root exception details if the
`javax.servlet.error.*` attributes are missing.

This change also removes the need for the extract(...) method on
ErrorController as classes such as WebRequestTraceFilter can
now use the ErrorAttributes interface directly.

See gh-839, gh-538
Fixes gh-843
2014-05-12 19:46:57 +01:00
Andy Wilkinson
fec136e213 Merge branch '1.0.x'
Conflicts:
	spring-boot-dependencies/pom.xml
2014-05-12 10:37:06 +01:00
Andy Wilkinson
f761daf253 Upgrade to CRaSH 1.3.0-beta18
Closes #841
2014-05-12 10:35:20 +01:00
Lukasz Kryger
e7484c66f5 Registering PID file to be deleted on JVM exit 2014-05-11 09:21:19 -07:00
Phillip Webb
bd38893f55 Rename rabbitHealthIndicator bean
Rename the rabbitHealthIndicator bean which was accidentally named
redisHealthIndicator.
2014-05-10 22:34:18 +01:00
Christian Dupuis
a62bc9ca60 Polish 2014-05-10 11:15:31 +02:00
Christian Dupuis
b026b13c66 Add HealthIndicator for Rabbit 2014-05-10 11:12:04 +02:00
Phillip Webb
1acffdf649 Polish 2014-05-09 08:52:11 +01:00
Christian Dupuis
51dddc2dc4 Add gc information to /metrics endpoint 2014-05-08 17:10:37 +02:00
Christian Dupuis
dfd6f91aef Merge pull request #819 from cdupuis/health-indicator
Rework HealthIndicator support
2014-05-08 16:40:44 +02:00
Christian Dupuis
288e7a5d92 Rename missing test 2014-05-08 16:32:50 +02:00
Christian Dupuis
916a85c615 Rename SimpleHealthIndicator to SimpleDataSourceHealthIndicator 2014-05-08 16:20:50 +02:00
Christian Dupuis
eeaa96725f Rename SimpleHealthIndicator to SimpleDataSourceHealthIndicator 2014-05-08 16:20:22 +02:00
Christian Dupuis
c5ec735afb Add unit test for (Mongo|Redis)HealthIndicator 2014-05-08 15:56:29 +02:00
Dave Syer
14d3b46809 Add constants to SecurityProperties and ManagementServerProperties
For the convenience of users who want to selectively override the
access rules in an application without taking complete control of the
security configuration we now have some constants:

* SecurityProperties.ACCESS_OVERRIDE_ORDER for overriding just the
application endpoint access rules

* ManagementServerProperties.ACCESS_OVERRIDE_ORDER for overriding the
application endpoint and management endpoint access rules

Fixes gh-803
2014-05-08 05:32:43 -07:00
Christian Dupuis
127328a833 Rework HealthEndpoint and HealthIndicators
Refactored HealthEndpoint to be able to take multiple HealthIndicators. Extracted configuration of HealthIndicators out of EndpointAutoConfiguration and added new HealthIndicatorAutoConfiguration class.

Added HealthIndicators for Redis and Mongo.
2014-05-08 12:37:37 +02:00