Commit Graph

1184 Commits (7c1f9eb1b9664a3b875c2bdf8da964be30d5c219)

Author SHA1 Message Date
Andy Wilkinson 02d7e2826c Don’t call ignoring.antMatchers([]) as empty array now maps to /**
Previously, if security.ignored was set to none and the error controller
was disabled, there would be no paths to ignore and we would call
IgnoredRequestConfigurer.antMatchers with an empty array. While a bit
pointless, this had no effect on Spring Security’s configuration.

This behaviour has changed in the latest 4.0.3 snapshots [1]. An empty
array passed to IgnoredRequestConfigurer.antMatchers now maps to /**. As
Spring Boot configures its ignored paths with highest precedence this
means that security is now disabled for every path.

This commit updates both the management security and application
security configuration to avoid calling antMatchers with an empty
array, thereby ensuring that we don’t inadvertently ignore every path.
Even if the change to Spring Security is reverted we can keep this
change. The behaviour will remain the same and, arguably, it makes the
intent of our configuration clearer.

Closes gh-4345

[1] 8663ac4173
9 years ago
Stephane Nicoll 86c753a149 Temporary fix the build
(I mean it this thime)

See gh-4345
9 years ago
Andy Wilkinson 79d99e1847 Update ShellPropertiesTests to expect whitespace to be trimmed
The latest Spring Framework 4.2.3 snapshots appear to be trimming
whitespace as part of the binding process. This commit updates the
test's expectations accordingly.
9 years ago
Andy Wilkinson aa3313cfc5 Update NamePatternFilter to detect regular expression character class
Previously, NamePatternFilter looked for “*”, “$”, “^”, or “+” when
trying to identify a string as being a regular expression. This meant
that it missed the use of a character class ([a-z], for example). This
commit adds “[“} to the list of characters that are considered to be
part of a regular expression.

Closes gh-4233
9 years ago
Stephane Nicoll 601225027f Merge branch '1.2.x' 9 years ago
Stephane Nicoll 2e2ebeb9fa Allow PORTFILE to always override the file to use
Previously, the `PORTFILE` system property was not checked if the
`EmbeddedServerPortFileWriter` was created using the default constructor.

This had the effect to prevent overriding of the port file when this
listener is created without any file or via `META-INF/spring.factories`.

Closes gh-4254
9 years ago
Johnny Lim 71c8a114f1 Make response headers optional in /trace endpoint
Update `WebRequestTraceFilter` so that the response respects the
TraceProperties.Include.RESPONSE enum.

See gh-3948
Closes gh-4242
9 years ago
Andy Wilkinson 0862ad7f52 Polishing: remove dead code 9 years ago
Andy Wilkinson 2109559f37 Ensure that, where appropriate, actuator endpoints always produce JSON
Previously, the Actuator’s endpoints did not specify a produces
attribute on their request mappings. With Jackson’s XML binding on the
classpath, this would lead to requests made by a browser receiving
application/xml responses (due to the Accept header indicating that
application/xml is preferred). This was problematic as some of the
response payloads were not legal xml. Problems included XML tags
beginning with ‘\’ or containing ‘#’.

This commit updates the endpoints to specify that they produce
application/json. The environment and metrics endpoints have also been
updated so that always return a JSON object, even when they are
returning a single entry. This consistency avoids problems where
clients may not consider a single scalar value to be legal JSON.

Closes gh-2449
9 years ago
Stephane Nicoll 4ae6d7c97e Remove outdated key
See gh-3696
9 years ago
Johnny Lim f67b6a233a Remove unused property in TraceProperties
Closes gh-4241
9 years ago
Phillip Webb 634bb770b2 Organize imports with new settings
See gh-4234
9 years ago
Phillip Webb 1e4d974ec0 Merge remote-tracking branch 'local12x/1.2.x' 9 years ago
Phillip Webb a79131f8d2 Organize imports with new settings
See gh-4234
9 years ago
Spring Buildmaster 2b38a861e3 Next Development Version 9 years ago
Phillip Webb 7e99d08473 Fail startup if management server can't start
Update EndpointWebMvcAutoConfiguration to no longer catch and ignore
EmbeddedServletContainerExceptions. Since commit 764e34b9, starting a
management on a different port is not even attempted when running in a
classic servlet container. This means that the catch/log logic (which
was originally added in 45315a97) is no longer necessary, and only
serves to hide genuine problems.

Fixes gh-4064
9 years ago
Wallace Wadge e3315d2252 Allow TraceWebFilter to trace more attributes
Update TraceWebFilter to optionally trace more details from the
HttpServletRequest/HttpServletResponse. The `management.trace.include`
property can be used to change what aspects are logged.

Closes gh-3948
9 years ago
Andy Wilkinson 17fde264e2 Merge branch '1.2.x' 9 years ago
Andy Wilkinson e4895f8fde Disable child context's /error endpoint if disabled in parent
Previously, EndpointWebMvcChildContextConfiguration would attempt to
create a /error endpoint, irrespective of whether or not the parent
had such an endpoint. If the endpoint was disabled in the parent this
would cause a failure due to the absence of an ErrorAttributes bean.

This commit updates EndpointWebMvcChildContextConfiguration to make
the creation of its /error endpoint conditional on the existence of
an ErrorAttributes bean.

Closes gh-4164
9 years ago
Phillip Webb 6333426cbf Reformat package-info.java files with Eclipse Mars 9 years ago
Phillip Webb 04074fece1 Merge branch '1.2.x' 9 years ago
Phillip Webb 94736719f1 Reformat package-info.java files with Eclipse Mars 9 years ago
Stephane Nicoll b9c885f5d2 Polish
Closes gh-4118
9 years ago
Marten Deinum bad8c1bee8 Added support for the DB2 AS400 Driver
Closes gh-4115
9 years ago
Phillip Webb c9fb9916b8 Reformat code using Eclipse Mars 9 years ago
Phillip Webb e473364e4e Merge branch '1.2.x' 9 years ago
Phillip Webb 6ab376e2e8 Reformat code use Eclipse Mars 9 years ago
Andy Wilkinson 08aa6f788d Merge branch '1.2.x' 9 years ago
Andy Wilkinson 9a703ab4d1 Correct quotation marks in spring-boot-actuator’s README
Closes gh-4095
9 years ago
Andy Wilkinson d793d5abcb Work around intermittent failure caused by SPR-13079
See gh-4098
9 years ago
Andy Wilkinson 6387f36efa Work around MockMvc bug (SPR-13079) that has only been fixed in 4.2
See gh-4098
9 years ago
Andy Wilkinson b7719a131b Merge branch '1.2.x' 9 years ago
Andy Wilkinson b8b4ea489e Improve MetricsFilter’s handling of async requests
Previously, MetricsFilter would treat async requests the same as
sync requests and would record their response status as soon as the
request had been processed by the filter chain. This would result in a
200 response being recorded and the actual response status produced by
the async processing being ignored. Furthermore, the time that was
recorded for the request would not include the time take for any async processing.

This commit updates MetricsFilter to check whether or not an async
request has been started before it records the metrics for the request.
In the event of an async request having been started no metrics are
recorded. Instead, the StopWatch is stored in a request attribute that
is then retrieved during the filtering of the request’s async
dispatch(es). Once the async processing has completed (isAsyncStarted()
returns false), the StopWatch is stopped, removed from the request’s
attributes and the metrics for the request are recorded.

Closes gh-4098
9 years ago
Stephane Nicoll 7d182028af Remove unecessary modifier 9 years ago
izeye a13b23e7f8 Polish
Closes gh-4087
9 years ago
Phillip Webb 5e58645202 Log warning for template folder not found problems
Update template auto-configurations to log a warning message rather
than throw an exception if the template folder cannot be found.

Fixes gh-4075
9 years ago
Phillip Webb 6a31c1dda1 Include debug message on management context fail
Update EndpointWebMvcAutoConfiguration to log exception details at DEBUG
in addition to the WARNING message when the child context fails to
start.

See gh-4064
9 years ago
Phillip Webb e272b3a957 Introduce AbstractEndpointMvcAdapter
Pull up functionality from EndpointMvcAdapter to a new
AbstractEndpointMvcAdapter which doesn't define any @RequestMappings and
update HealthMvcEndpoint to make use of it.
9 years ago
Phillip Webb c3b7764b72 Polish 9 years ago
Stephane Nicoll b2c3e7e2ed Rename error.* properties to server.error.*
Closes gh-4050
9 years ago
Dave Syer 4b1389179d Attempt to fix test failures caused by ordering issues 9 years ago
Dave Syer e1070cce07 Check authorities of user in HealthMvcEndpoint
We need to be a bit cautious about whether Spring Security is on
the classpath or not, but if it is we can test for the admin role
(as specified in `management.security.role`).

Fixes gh-4060
9 years ago
Dave Syer 972557851a All MVC endpoint paths to be separately customized from the id
This change applies only to "standard" MVC endpoints (not the extended
ones like /env and /jolokia which already have this feature). Allows
users to supply an endpoints.{name}.path.

Fixes gh-2790
9 years ago
Phillip Webb 5cbb81c64f Fix management security when using different port
Update ManagementWebSecurityAutoConfiguration to reinstate lazy creation
of EndpointHandlerMapping from the EndpointPathRequestMatcher.

Fixes a regression introduced in eb2984781 and picked up my one of the
sample integration tests.

Fixes gh-4059
9 years ago
Andy Wilkinson 2964fd28a0 Polishing 9 years ago
Dave Syer 933aad3c06 Make checkstyle happier 9 years ago
Dave Syer c8021fa526 Comment out logback config 9 years ago
Dave Syer eb29847814 Hone the security rules for actuator endpoints
Takes into account the fact that the new /actuator endpoint sometimes
loses its path (it is "" relative to a non-empty management context path).

Fixes gh-4059
9 years ago
Stephane Nicoll 623fcfeff1 Properly guard cache statistics providers
Previously, a `NoClassDefFoundError` could be thrown if EhCache or Guava
is on the classpath without `spring-context-support` as the respective
cache statistics provider both needs the implementation and the spring
abstraction implementation.

The `@ConditionalOnClass` definition has been updated to properly guard
those beans.

Closes gh-3960
9 years ago
Andy Wilkinson 0d1729cb65 Fix Checkstyle warning 9 years ago
Andy Wilkinson 64bcba47a9 Polish contribution
- Add @author tag
 - Remove unnecessary final modifiers
 - Avoid writing to volatile field when new gauge is used

Closes gh-3977
9 years ago
Jay Anderson 3fb0ae3e3b Register dropwizard gauges once and then update them
The previous implementation would remove and add a new Gauge each time
a metric was written. After this change the Gauge is registered once
and the value is updated on subsequent calls.
9 years ago
Andy Wilkinson ff5e4631e3 Add MockMvc-based integration tests for management.security.enabled
See gh-3997
9 years ago
Phillip Webb 69d57f9a35 Polish 9 years ago
Phillip Webb fa040c9e26 Fix tests failing on Windows 9 years ago
Phillip Webb 3b93a82dd6 Support relaxed HealthMvcEndpoint status mappings
Update HealthMvcEndpoint so that relaxed names can be used as keys in
the `endpoints.health.mapping` property.

Fixes gh-2465
9 years ago
Phillip Webb a168670a8d Use static Patterns in MetricsFilter
Update MetricsFilter to use static `Pattern` instances for regex
replacements rather than compiling them each time.

Fixes gh-3996
9 years ago
Phillip Webb 57a698f388 Fix broken Cassandra tests
See gh-2064
9 years ago
Julien Dubois c401330901 Add Cassandra support
Add auto-configuration support and health checks for Cassandra and
Spring Data Cassandra.

Fixes gh-2064
Closes gh-2214
9 years ago
Andy Wilkinson c55900b433 Simplify Jackson-related auto-configuration for HATEOAS and Data REST
This commit simplifies the Jackson-related auto-configuration that’s
applied when Spring HATEOAS and Spring Data REST are on the classpath.

Previously, Boot used Jackson2HalModule to apply the HAL-related
ObjectMapper configuration to the context’s primary ObjectMapper. This
was to allow HAL-formatted responses to be sent for requests accepted
application/json (see gh-2147). This had the unwanted side-effect of
polluting the primary ObjectMapper with HAL-specific functionality.
Furthermore, Jackson2HalModule is an internal of Spring HATEOAS that
@olivergierke has asked us to avoid using.

This commit replaces the use of Jackson2HalModule with a new approach.
Now, the message converters of any RequestMappingHandlerAdapter beans
are examined and any TypeConstrainedMappingJackson2HttpMessageConverter
instances are modified to support application/json in addition to their
default support for application/hal+json. This behaviour can be disabled
by setting spring.hateoas.use-hal-as-default-json-media-type to false.
This property is named after Spring Data REST’s configuration option
which has the same effect when using Spring Data REST. The new property
replaces the old spring.hateoas.apply-to-primary-object-mapper property.

Previously, when Spring Data REST was on the classpath,
JacksonAutoConfiguration would be switched off resulting in the context
containing multiple ObjectMappers, none of which was primary.

This commit configures RepositoryRestMvcAutoConfiguration to run after
JacksonAutoConfiguration. This gives the latter a chance to create its
primary ObjectMapper before the former adds its ObjectMapper beans to
the context.

Previously, the actuator’s hypermedia support assumed that the
HttpMessageConverters bean would contain every HttpMessageConverter
being used by Spring MVC. When Spring HATEOAS is on the classpath this
isn’t the case as it post-processes RequestMappingHandlerAdapter beans
and adds a TypeConstrainedMappingJackson2HttpMessageConverter to them.
This wasn’t a problem in the past as the primary ObjectMapper, used by a
vanilla MappingJackson2HttpMessageConverter, was configured with Spring
HATEOAS’sJackson2HalModule. Now that this pollution has been tidied up
the assumption described above no longer holds true. MvcEndpointAdvice,
which adds links to the actuator’s json responses, has been updated
to look at the HttpMessageConverters of every
RequestMappingHandlerAdapter when it’s trying to find a converter to
use to write a response with additional hypermedia links.

Integration tests have been added to spring-boot-actuator to ensure
that the changes described above have not regressed the ability to
configure its json output using spring.jackson.* properties (see
gh-1729).

Closes gh-3891
9 years ago
Phillip Webb 676efe7ad6 Fixup following package auto-configuration moves
A string based exclude was missed in commit c629813165.

See gh-4002
9 years ago
Simon Buettner 70031cca66 Add statsd metric export auto-configuration
Update MetricExportAutoConfiguration to auto-configure statsd metrics
export when a `spring.metrics.export.statsd.host` property is set.

Closes gh-3719
9 years ago
Thomas Badie 2fd1cacbf3 Fix synchronization issue in OpenTSDBMetricWriter
Closes gh-4010
9 years ago
Phillip Webb c629813165 Rationalize Spring Data auto-configurations
Relocate several auto-configuration classes to `...autoconfigure.data`
to make it clearer that they are Spring Data specific.

Also moved `EntityManagerFactoryBuilder` to `spring-boot` since it is
generally useful and doesn't need to be directly tied to the
auto-configuration module.

Fixes gh-4002
9 years ago
Andy Wilkinson d10dd13714 Fix deprecation warning in ConfigurationPropertiesReportEndpoint 9 years ago
Spring Buildmaster 9409c49c10 Next development version 9 years ago
Phillip Webb e674d751de Polish Javadoc 9 years ago
Phillip Webb e07df7e4c6 Remove redundant modifiers 9 years ago
Phillip Webb 460ca75fce Polish newline at end of file 9 years ago
Phillip Webb d09805fd75 Polish license headers 9 years ago
Phillip Webb 6e29ee4557 Polish 9 years ago
Phillip Webb 67402405db Reformat code 9 years ago
Phillip Webb 2615990ffb Organize imports 9 years ago
Phillip Webb 0335053139 Merge branch '1.2.x' 9 years ago
Phillip Webb 15686ed4fd Reformat code 9 years ago
Phillip Webb 690da89c82 Fix warnings 9 years ago
Phillip Webb 60b8cb8a47 Fix package tangle in spring-boot-actuator
Introduce ManagementServletContext interface as a facade for
ManagementServerProperties to resolve the package tangle between
`o.s.boot.actuate.endpoint.mvc` and `o.s.boot.actuate`

Fixes gh-3887
9 years ago
Phillip Webb 4aa2fed48b Revert "configure JRE that is different from compiler target level"
This reverts commit 678f36cfef.
9 years ago
Phillip Webb 6193b640a4 Polish 9 years ago
Andy Wilkinson 1f202e3e47 Upgrade to HAL Browser 9f96c74
Closes gh-3880
9 years ago
Stephane Nicoll 8f520dafc7 Remove hard-coded list of values in description
Since the meta-data now provide an explicit support for value hints, we
should not copy/paste them in the description as the IDE is able to
process them any way it wants.

Closes gh-3863
9 years ago
izeye 3ec97c1bb9 Make metric type more sensible
Closes gh-3532
9 years ago
izeye e2119d3329 Fix typos
Closes gh-3809
9 years ago
Dave Syer 9303efd435 Allow counter names like counter-foo
Checking for a prefix "counter." is more correct than "counter" because
the readers (repositories) assume the former prefix is there.

Fixes gh-3801
9 years ago
Martin Lippert 678f36cfef configure JRE that is different from compiler target level 9 years ago
Stephane Nicoll 7c0c953f81 Add value alias for SpringApplicationConfiguration
Given that Spring Boot uses java config accross the board, a new `value`
attribute is now aliased to the existing `classes` attribute such that
one could write the following:

@SpringApplicationConfiguration(MyConfig.class)
public class MyTest {}

Closes gh-3635
9 years ago
Stephane Nicoll a6f8586270 Merge branch '1.2.x'
Conflicts:
	spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfiguration.java
9 years ago
Stephane Nicoll 11b82cc6fe Properly guard DB health indicator
The DataSource health indicator uses `JdbcTemplate` behind the scenes
but nothing was checking that it is actually available.

`DataSourcesHealthIndicatorConfiguration` is now disabled if
`spring-jdbc` is not on the classpath.

Fixes gh-3765
9 years ago
Dave Syer 56115b9baa Fix broken test (use web app context) 9 years ago
Dave Syer 84a3e3827b Ensure tomcat on the classpath does not imply web application 9 years ago
Stephane Nicoll 9d2d34216b Remove references to endpoints.hal
See gh-3696
9 years ago
Andy Wilkinson dad0574fd5 In absence of HAL browser, serve browsers JSON from actuator entry point
Following the changes made to combines the /links and /hal endpoints
into a single /actuator endpoint, a web browser accessing /actuator
would receive a 406 response if HAL browser was not on the classpath.

This commit updates the /actuator main entry point so that it will
serve JSON to a web browser when HAL browser is not on the classpath.

The actuator's embedded documentation has also been updated to reflect
the recent changes.

Closes gh-3696
9 years ago
Andy Wilkinson 25709385e6 Update Hypermedia samples following /hal and /links being combined
See gh-3696
9 years ago
Andy Wilkinson 58db5a3889 Combine /links and /hal into a single /actuator endpoint
This commit provides a single endpoint, /actuator, that serves HTML
(the HAL browser) or JSON depending on the request’s accept header
that enables discovery of all of the actuator’s other endpoints.

When the management context path is configured, the /actuator endpoint
moves to the configured path, e.g. if the management context path is
set to /management, the actuator endpoint will be available from
/management.

Closes gh-3696
9 years ago
Phillip Webb 28f32da74f Don't user root path for HAL endpoints
Update LinksMvcEndpoint and HalBrowserMvcEndpoint so that no longer try
to use the `/` context path. Links are now available from `/links` and
the HAL browser is available from `/hal`.

The actuator HAL browser now works with either WebJars or the Spring
Data version. It also now transforms the initial HTML so that the
form is pre-populated with `/links`.

When using Spring Data's HAL browser, the root includes a link to
`/links` with a rel of `actuator`.

See gh-3621
9 years ago
Phillip Webb 44aacd9559 Polish 9 years ago
Phillip Webb 8d92236eea Polish 9 years ago
Stephane Nicoll c25c07dfdd Remove dead code
ConfigurationPropertiesReportEndpoint parses the meta-data to inspect
entities that have potential cycles in them. The whole logic is based on
the lookup of `META-INF/spring-configuration-metadata.json` files on the
classpath. Unfortunately, the lookup instruction had a typo and did not
retrieve any file.

Surely that code was written with a clear intention in mind but it was
effectively dead code outside tests so it has been removed.

Closes gh-3310
9 years ago
Stephane Nicoll 7c9f2ae19c Polish
See gh-3555
9 years ago
Arthur Kalimullin b7b6e84d4b Add firebird specific health query
Closes gh-3555
9 years ago
Stephane Nicoll bf0b857357 polish 9 years ago
Phillip Webb 891dd5a0f6 Polish 9 years ago
Stephane Nicoll b569918db1 Add property to disable default health indicators
Add a "management.health.defaults.enabled" property that controls whether
the default health indicators are enabled. This allow to disable them all
by default and still enable individual ones using their respective
specific property.

Closes gh-2298
9 years ago
Stephane Nicoll d3e15805b4 Polish 9 years ago
Dave Syer 6d2af95d59 Allow path with / in JolokiaMvcEndpoint
See gh-3629
9 years ago
Dave Syer ff7717932a Weed out duplicate links if there are 2 endpoints with the same path
Fixes gh-3570
9 years ago
arghya88 6e71af2d21 Fix copyright date
Closes gh-3632
9 years ago
Stephane Nicoll 4a327dc08b Add missing meta-data
Closes gh-3620
9 years ago
Stephane Nicoll a90970060d Polish 9 years ago
Stephane Nicoll e32efc179c Polish 9 years ago
Stephane Nicoll 41bc3b386e Rename ManagementSecurityAutoConfiguration
Since `ManagementSecurityAutoConfiguration` is cnfiguring web-related
things, it has been renamed to `ManagementWebSecurityAutoConfiguration`.

Closes gh-2163
9 years ago
Stephane Nicoll 42e230192f Polish 9 years ago
izeye cb0c6843d2 Remove default paths in HAL and Links endpoints as value varies
The default values of fields in @ConfigurationProperties classes are,
where possible, included in the configuration metadata. The default
values for the HAL and Links endpoints vary depending on other
configuration settings. As a result, including a default in the
metadata is misleading.

This commit removes the default assignment of "" to the path fields so
that no default value will be included in the metadata.

Closes gh-3567
9 years ago
Stephane Nicoll 16dac01886 Polish 9 years ago
Phillip Webb 5d74ea2861 Merge branch '1.2.x' 9 years ago
Phillip Webb d2d71934b6 Polish 9 years ago
Stephane Nicoll 3e26273013 Polish 9 years ago
Stephane Nicoll 43c5151ee1 Merge branch '1.2.x' 9 years ago
Stephane Nicoll 539b009d12 Clean management context path if necessary
Various areas of the code expect the management's context path to not
contain any trailing slash but nothing is enforcing it. We now make sure
to remove any trailing slash, including the one for '/' and make that
explicit via the Javadoc of the getter.

Fixes gh-3553
9 years ago
Phillip Webb 728e64b929 Polish 9 years ago
Andy Wilkinson bedf2edffa Update auto-configuration @Bean methods to return most specific type
Closes gh-2536
Closes gh-2403
9 years ago
Stephane Nicoll f2d32d3e98 Add support for property deprecation
Previously, an item could only have a 'deprecated' boolean flag to
indicate that the property is deprecated. It is desirable to provide an
additional description for the deprecation as well as the name of the
property to use instead.

The `deprecated` boolean flag is now supported. Instead, a `deprecated`
object can be specified with two optional attributes: `reason` to provide
an explanation for the deprecation and `replacement` to refer to the
property that should be used instead. If none of them is present, an
empty deprecation object should be set.

For backward compatibility, the `deprecated` field is still set.

Deprecation information can only set via manual meta-data.

Closes gh-3449
9 years ago
Dave Syer de95012635 Workaround problems with order of endpoint handler mapping
When Spring Data REST is owning the home page it has its own
HandlerMapping with a fix (relatively) low priority. The /links
endpoint wants to own the home page as well, and our handler mapping
has a high priority for good reasons. This change addresses the
issue by checking if Spring Data REST is configured and if
the management context path (or  more specifically, the links
endpoint) is the same as the home page.

Fixes gh-3486
9 years ago
Phillip Webb fd6024ebf1 Move and refactor Redis test server @Rule
Move the Redis JUnit @Rule so that it can be used with
SessionAutoConfigurationTests. Also refactored the internals a little.
9 years ago
Phillip Webb 9ebe15232e Polish 9 years ago
Phillip Webb 6fdcdd888b Merge branch '1.2.x' 9 years ago
Phillip Webb dc18d8d1bb Formatting 9 years ago
Dave Syer e5d3fa0c6c Merge remote-tracking branch '1.2.x' 9 years ago
izeye d06f3b1a25 Fix typo
Closes gh-3473
9 years ago
Dave Syer d0cf6b534b Add 3xx redirects to the "unmapped" class of requests for metrics
When Spring Security sends 302 responses to a login page we don't get
any information about the request matching in Spring MVC. Consequently
apps can end up with a lot of counter.status.302.* metrics (where
"*" can be whatever the user sent).

This change treats 3xx the same as 4xx (if it is unmapped it just gets
added to a metric called "unmapped" instead of using the actual request
path).

Fixes gh-2563
9 years ago
Dave Syer 82da28f627 Add support for custom Exporter with declarative schedule 9 years ago
Andy Wilkinson 58509ed7c5 Merge branch '1.2.x' 9 years ago
Johannes Stelzer fdb83ec338 Correct assertion for indicators parameter in CompositeHealthIndicator
Closes gh-3417
9 years ago
Phillip Webb 67f7079cb2 Formatting 9 years ago
Stephane Nicoll 97634e85ac Remove unnecessary keyword 9 years ago
Phillip Webb 5938c967a3 Polish 9 years ago
Dave Syer 7ceb7ce6f6 Add send count to Integration metrics
Fixed gh-3364
9 years ago
Dave Syer 94e41b4190 Fix assertion in broken test 9 years ago
Dave Syer 7410eee34f Add custom condition for /logfile endpoint
Fixes gh-3360
9 years ago
Dave Syer c71196b92d Better segregation of export and redis keys 9 years ago
Stephane Nicoll 54619bec3f Clarify javadoc
This might just be me but when I read the original javadoc it made me
think that caching worked only if the endpoint is accessed anonymously.
9 years ago
Phillip Webb 7dcb79b3b3 Support more lenient DB2 product lookups
Update DataSourceHealthIndicator to support pattern based matching for
DB2 products. Prior to this commit product identifiers of the form
`DB2/LINUXX8664` were not supported.

Fixes gh-3377
10 years ago
Phillip Webb 85535f0882 Disable DB migrations in ApplicationHierarchyTests 10 years ago
Eddú Meléndez 3995c16ba6 Add 'flyway' and 'liquibase' actuator endpoints
Add `/flyway` and `/liquibase` actuator endpoints to provide details of
any database migrations that have been applied.

Fixes gh-3434
Closes gh-3435
10 years ago
Phillip Webb 7e58483ead Add serialization endpoint tests
Test basic serialization in Endpoint tests to ensure that JSON
can always be produced.
10 years ago
Phillip Webb 9b78f5d52e Replace @ConditionalOnExpression conditions
Replace @ConditionalOnExpression usage in auto-configuration in favor
of faster direct Environment access.
10 years ago
Phillip Webb 71dbec381a Create @ManagementContextConfiguration annotation
Replace the previously used `EndpointWebMvcConfiguration`
`spring.factories` key with a dedicated ManagementContextConfiguration
annotation.

Also renamed the EndpointWebMvcHypermediaConfiguration and
EndpointWebMvcConfiguration classes to make it clearer that they are
for the management context.

See gh-3345
10 years ago
Phillip Webb b2fcd77d93 Rework EndpointWebMvcAutoConfiguration port logic
Update the `ManagementServerPort` detection logic to attempt direct
property resolution before looking for a local property bean
definition. Bean definitions provided by auto-configuration classes
are ignored.

This change allow `OnManagementMvcCondition` to use the
`ManagementServerPort` to determine when `EndpointWebMvcConfiguration`
should apply (removing the need to create a temporary context).

See gh-3345
10 years ago
Phillip Webb 4c8c376829 Refactor EndpointPathRequestMatcher
Refactor `EndpointPathRequestMatcher` so that the side effect of setting
`endpointHandlerMapping` in the parent class is a little more obvious.
10 years ago
Stephane Nicoll 774474f8b7 Add hint providers for core properties
Closes gh-3322
10 years ago
Phillip Webb e8085016ba Polish Actuator hypermedia support 10 years ago
izeye 99cd9bdc31 Fix typo
Closes gh-3416
10 years ago
izeye b4f636b33f Fix typo
Closes gh-3411
10 years ago
Dave Syer 74e9e0749b Add support for Spring HATEOAS hypermedia in Actuator endpoints
If spring-hateoas is on the classpath and an MvcEndpoint returns a
@ResponseBody it will be extended and wrapped into a Resource with links.
All the existing endpoints that return sensible JSON data can be extended
this way (i.e. not /logfile). The HAL browser will also be added as an
endpoint if available on the classpath. Finally, asciidocs for the
Actuator endpoints are available as a separate jar file, which if
included in an app will also generate a new (HTTP) endpoint.

Fixes gh-1390
10 years ago
Spring Buildmaster 7ce391db4f Next development version 10 years ago
Phillip Webb b1f8a692a8 Merge branch '1.2.x' 10 years ago
Phillip Webb 3ef667f0d8 Fix MetricWriterMessageHandler to deal with reset
Update MetricWriterMessageHandler to deal with 'reset' messages and to
log unsupported payload types.

Fixes gh-3378
10 years ago
Phillip Webb d61c38167e Formatting 10 years ago
Dave Syer 5541b3be43 Remove @OnManagementMvcCondition and use a private class
Fixes gh-3373
10 years ago
Phillip Webb b5c435f8c4 Polish Actuator MVC customization support
See gh-3345
10 years ago
Dave Syer 1e464da248 Refactor the Actuator MVC configuration to allow more customization
There is a new spring.factories entry for
org.springframework.boot.actuate.autoconfigure.EndpointWebMvcConfiguration
which loads extra beans into the MVC config for the Actuator.
If the management context is a child context all the beans go in the
child (except the Spring Security filter still). A big bonus is that
you can add WebConfigurerAdapters to configure static resources etc.
A new component called ManagementContextResolver can be used to
locate the ApplicationContext for the MVC endpoints.

Fixes gh-3345
10 years ago
Phillip Webb b68382f3ba Polish 10 years ago
Dave Syer 1f6ac52b96 Change default behaviour of /health when not secured
The default is now to reveal all details unless sensitive=true
(instead of only revealing then if sensitive was explicitly false).
The definition of "secure" also changes to something more sensible
where it is only true if security is enabled.

Fixes gh-2816
10 years ago
Dave Syer c3c1d91f74 Fix Redis metrics default settings
The default should be to generate a key from the prefix. Otherwise
if user sets the prefix and not the key it can pick up metrics from
another repository (which is what happens in the tests).
10 years ago
Stephane Nicoll 12767a43e2 Remove unnecessary import
See gh-3335
10 years ago
izeye 761c985337 Remove unnecessary `@After` callback
`@After` callback was trying to remove the wrong file anyway. This is
now taken care of by the `TemporaryFolder` rule.

Closes gh-3335
10 years ago
Stephane Nicoll 56b13800ae Fix json structure 10 years ago
Phillip Webb 134bc02404 Extract common metric Buffer code
Extract common features from CounterBuffers and GuageBuffers into
a shared superclass. The new extracted types allows the service
implementations to be simplified.

Fixes gh-3257
10 years ago
Stephane Nicoll 41b4d41f11 Remove dead code 10 years ago
Stephane Nicoll e9baa779cc Remove dead code 10 years ago
Johannes Stelzer 308a5eaff5 Add /logfile MVC actuator endpoint
Add a `/logfile` endpoint which can be used to fetch the contents of
the log file (if one is being used).

Fixes gh-2137
Closes gh-2294
10 years ago
Phillip Webb 61fc4f3f12 Polish copyright headers 10 years ago
Stephane Nicoll d0698bd8ed Remove unnecessary System.out in tests 10 years ago
Tomasz Przybyła becced5f0b Add `spring.pid.fail-on-write-error` support
Update `ApplicationPidFileWriter` to support a 'fail on write error'
properties which allows the user to exit the application if the PID
file cannot be written.

This commit also deprecates `spring.pidfile` in favor of
`spring.pid.file` so that the new property can be added without overlap.

Fixes gh-2764
10 years ago
Andy Wilkinson d3d713d0c9 Merge branch '1.2.x' 10 years ago
olivier bourgain 5ed2a9632b Make InMemoryTraceRepository thread-safe
Closes gh-3027
10 years ago
Phillip Webb 2f16a01dd5 Polish 10 years ago
dgomesbr 1ebbf8ac4d Upgrade to Hazelcast 3.5
Closes gh-3267
Closes gh-3272
10 years ago
Stephane Nicoll 7ed1aa279a Add Informix specific health query
Closes gh-1287
10 years ago
Johannes Stelzer ea2a09cbf6 Add DB2 specific health query
Closes gh-2565
10 years ago
Stephane Nicoll fd5d6ef303 Polish 10 years ago
nlejeune 205c86f54c Better sanitizer default for sensitive keys
Add the CloudFoundry vcap_services key, as well as a regular expression
to sanitize any key containing the word 'credentials'.

Fixes gh-3248
Closes gh-3266
10 years ago
Stephane Nicoll c177a774a5 Provide seamless support for local.server.port
Previously, the actual HTTP port on which a web application is running on
was only exposed in tests. This commit makes sure to provide that feature
regardless of the environment so that applications can know on which port
they are actually running on.

If there are several containers, each is exposed via the namespace of
their respective application context.

Closes gh-3259
10 years ago
Phillip Webb 8b9c38085a Merge pull request #3117 from izeye/metrics
* metrics2:
  Remove duplicate code in new metrics code
10 years ago
izeye b47634176f Remove duplicate code in new metrics code
Refactor BufferMetricReader, CounterBuffers and GaugeBuffers to reduce
duplicate code.

Closes gh-3117
10 years ago
izeye de91dc0de7 Change Codahale to Dropwizard in Javadoc. 10 years ago
Phillip Webb af5338f26e Formatting 10 years ago
Stephane Nicoll 8c7b8afedb Polish 10 years ago
izeye 2b9775d593 Fix EhCache hit/miss ratio
The hitRatio is the ratio of two windowed rates that are calculated
independently. They are not updated or read transactionally, hence the
ratio of the two can drift slightly from what might be expected.

We now make sure that the hit or miss ratio can't be higher than 1

Closes gh-3235
10 years ago
Stephane Nicoll 641ceca3a9 Lower logging level of audit events
Closes gh-3107
10 years ago
Andy Wilkinson f73d86e700 Upgrade to Elasticsearch 1.5.2
Closes gh-3194
10 years ago
Stephane Nicoll be26cba01e Merge branch '1.2.x' 10 years ago
Stephane Nicoll 5a57913732 Tune spring-boot-actuator logging config
Closes gh-3060
10 years ago
Phillip Webb 7609c43685 Switch Javadoc <code>...</code> to {@code ...}
Update Javadoc to use the {@code ...} syntax when possible.
10 years ago
Phillip Webb 6230d905c6 Polish 10 years ago
Stephane Nicoll 9b5e5f7bf8 Fix Javadoc 10 years ago
Eddú Meléndez baca62a6c0 Fix typos 10 years ago
Dave Syer cc169c5009 Change the way the AggregateMetricReader works to make it easier
for users to get started. It also makes it more flexible if different
aggregation keys are needed depending on the environment. The most
important new feature is the
spring.metrics.export.redis.aggregateKeyPattern configuration, which
fits the *.redis.key and prefix defaults. The aggregate reader uses
a prefix based on the key by default, with a naming convention that
the key starts with "keys.".
10 years ago
Phillip Webb 683c19ee8b Polish 10 years ago
Stephane Nicoll f6115a0713 polish
Closes gh-3110
10 years ago
izeye 5096a5d242 Remove duplicate in MetricExportProperties
Closes gh-3109
10 years ago
Dave Syer 6c653038f6 Remove getDefault() from MetricExportProperties
Fixes gh-3112
10 years ago
Dave Syer c108b1483a Restore and deprecate DropwizardMetricWriter
Fixes gh-3113
10 years ago
Phillip Webb 31d6a0f17a Polish updated metrics code 10 years ago
Phillip Webb d2f11c465e Polish cache code 10 years ago
Phillip Webb 412b7b9e50 Polish 10 years ago
Spring Buildmaster 5d81c87b43 Next Development Version 10 years ago
Phillip Webb 4a097f8550 Merge branch '1.2.x' 10 years ago
Phillip Webb df0ba5c03a Guard against metric failures in MetricsFilter
Update MetricsFilter so that failures to record metrics are logged and
ignored.

Fixes gh-2777
10 years ago
Phillip Webb 49c4710f63 Merge branch '1.2.x' 10 years ago
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
10 years ago
Phillip Webb aaa2ff54dd Extract @ConditionalOnEnabledEndpoint
Extract @ConditionalOnEnabledEndpoint to a top level class.

See gh-2798
10 years ago
Phillip Webb 968b68c322 Polish 10 years ago
Stephane Nicoll 18d7634947 Add basic cache metrics support for Infinispan
Closes gh-3066
10 years ago
Stephane Nicoll 28d2955d03 Fix Hazelcast cache statistics condition
Make sure the Hazelcast statistics support is not triggered if the Spring
support is not present. The Hazelcast dependency alone may be used with
JCache and this should not trigger the support of the native Hazelcast
metrics infra.

See gh-2633
10 years ago
Dave Syer 33f06e1cb0 Ensure redis export properties are actually set using a @Value()
Previously the @Value annotation was not on a top level @Bean field
(it was nested inside). Manually constructing the bean in a separate
configuration class seems like the best way to get it to actually bind
at runtime.
10 years ago
Dave Syer 8a83bd12bd Refactor annotations for metric export
Users can add @ExportMetric[Reader,Writer] to readers and writers that
they want to participate in the default exporter. There is also still an
@ActuatorMetricWriter that is used for the legacy (non-Java8) Gauge and
CounterServices.
10 years ago
Dave Syer 80ff92919c Add redis properties as convenience in spring.metrics.export
The redis export and aggregate use case is a lot nicer with this
shared data between the two component types.

Also made MetricExportProperties itself a Trigger (so the default
delay etc. can be configured via spring.metrics.export.*).
10 years ago
Dave Syer a49901f0dc Tweak conditions on metric export to make it easier to override 10 years ago
izeye 8f0fd21f11 Fix redudant assertion in test
Closes gh-3064
10 years ago
izeye 88612393f3 Fix allowCredentials property handling
Closes gh-3059
10 years ago
Andreas Ahlenstorf 9805643e41 Fix spring-security versions
Closes gh-3050
10 years ago
Stephane Nicoll a6f671be3e Add excludeName to EnableAutoConfiguration
Allow user to exclude an auto-configuration class by specifying the fully
qualified name instead of the class reference.

Closes gh-2660
10 years ago
Stephane Nicoll fc61f2e837 Improve documentation for JMX related keys
Closes gh-2747
10 years ago
Stephane Nicoll ab55331863 Improve configuration keys documentation 10 years ago
Dave Syer 5468949a55 Update to latest 1.3 code 10 years ago
Andy Wilkinson 3eb5c348fb Align test with Spring MVC's internals once again
The internals have been updated so that the field that was originally
used, interceptors, can be used again.

This reverts commit 2a1bca6806.
10 years ago
Andy Wilkinson 2a1bca6806 Update field that’s checked reflectively to match Spring MVC’s internals 10 years ago
Andy Wilkinson 129c24926e Fix metrics speed tests on Windows
Write to NUL on Windows and /dev/null on other platforms. Increase the
default number of iterations to avoid problems with the reduced timing
precision on Windows.

Closes gh-2976
10 years ago
Andy Wilkinson a0c0822293 Use array of correct size when turning List<MetricReader> into an array 10 years ago
Andy Wilkinson 54b0613179 Gracefully handle null readers in MetricExportAutoConfiguration 10 years ago
Dave Syer 20cea2aefc Remove duplicate declaration of s-i-core 10 years ago
Dave Syer a065b80e57 Add MetricsEndpointMetricReader for exporting all metrics
User can add a bean of type MetricsEndpointMetricReader to opt in
to exporting all metrics via the MetricsEndpoint (instead of via
MetricReaders). There are disadvantages (like no accurate timestamps)
so it's best to leave it as an opt in.

Also improved tests for metric auto configuration a bit.
10 years ago
Dave Syer 5ceb35473d Allow multiple readers/writers to be @ActuatorMetric*
In principle you might have multiple "system" repositories, all
of which you want to go to public metrics or not be metrics exporters.
This change adds a new annotation and renames the old one, so that
reades and writers can be distinguished, and also changes the
autowiring of them to accept multiple values.

Also adds automatic public metrics for Spring Integration.
10 years ago
Stephane Nicoll 80ecb8220d Add explicit dependency to CacheAutoConfiguration
Make sure that the cache statistics auto-configuration is evaluated after
the cache auto-configuration itself.

See gh-2633
10 years ago
Stephane Nicoll d63d2dded8 polish
Improve documentation of cors settings.

See gh-2936
10 years ago
Andy Wilkinson b45a2bcfc0 Update javadoc following removal of deprecated APIs
See gh-2697
10 years ago
Andy Wilkinson e3a53cb087 Remove classes and methods deprecated since 1.2 and earlier
Closes gh-2697
10 years ago
Andy Wilkinson 84d3a34c49 Add CORS support to the actuator’s endpoints
This commit adds CORS support to the Actuator’s MVC endpoints. CORS
support is disabled by default and is only enabled once the
endpoints.cors.allowed-origins property has been set.

The new properties to control the endpoints’ CORS configuration are:

endpoints.cors.allow-credentials
endpoints.cors.allowed-origins
endpoints.cors.allowed-methods
endpoints.cors.allowed-headers
endpoints.cors.exposed-headers

The changes to enable Jolokia-specific CORS support (57a51ed) have been
reverted as part of this commit. This provides a consistent approach
to CORS configuration across all endpoints, rather than Jolokia using
its own configuration.

See gh-1987
Closes gh-2936
10 years ago
Dave Syer 64af3272a1 Extract metric export into a separate autoconfig class
This avoids a potential problems with ordering between Dropwizard and
normal repository configuration. A Dropwizard sample has been added to
verify the behaviour.
10 years ago
Dave Syer 7be13b28bd Add tests for new features 10 years ago
Dave Syer 270d5e3205 Add @ActuatorMetricRepository to qualify the "native" repository
Primarily when it is needed for metric export.
10 years ago
Dave Syer 2f2750e713 Extract metric writers into a MetricExporters composite
Adds a separate exporter per MetricWriter and allows individual
configuration of exporters for fine-grained control of schedules
and patterns etc.
10 years ago
Dave Syer 0ce72105b9 Add JMX to Redis sample 10 years ago
Dave Syer 089b1d05dc Add support for sendLatest=true/false in exporter
Also fix bug in includes/excludes
10 years ago
Dave Syer 3fda744522 Add samples and tweak metrics reader/writers till they work 10 years ago
Dave Syer 60a4943520 Add support for metric export to OpenTSDB 10 years ago
Dave Syer a32c530c36 Add @Primary to default InMemoryMetricRepository if there is one 10 years ago
Dave Syer 2aaf556a1c Ensure the default MetricWriter in Java 7 is not used in exporter 10 years ago
Dave Syer 0bd845d183 Add support for Statsd metric export 10 years ago
Dave Syer 0fde04d325 Add AggregateMetricReader able to aggregate counters and gauges
Different physical sources for the same logical metric just need to
publish them with a period-separated prefix, and this reader will
aggregate (by truncating the metric names, dropping the prefix).

Very useful (for instance) if multiple application instances are
feeding to a central (e.g. redis) repository and you want to
display the results. Useful in conjunction with a
MetricReaderPublicMetrics for hooking up to the /metrics endpoint.
10 years ago
Dave Syer 710423d176 Add JmxMetricWriter for exporting metric values to MBeans
User can add a @Bean of type JmxMetricWriter and get all values
automatically exported in a form that is usable in jconsole
or jvisualvm.
10 years ago
Dave Syer 5edc404a7e Add support for includes and excludes patterns in MetricCopyExporter
Also rename Codahale* to Dropwizard* and move them to a new package
10 years ago
Dave Syer 53a61474aa Add counter and gauge services based on in-memory buffers
This seems pretty efficient (approx 12M write/s as opposed to 2M with
the DefaultCounterService). N.B. there is no need to change most of
the rest of the metrics stuff because metrics are write-often, read-
seldom, so we don't need high performance reads as much.

The Spring Integration configuration and Dropwizard support has changed
a bit. Functionally very similar and probably opaque to users, but now
the messaging operates as an Exporter on a @Scheduled method, and
Dropwizard is a replacement [Gauge,Counter]Service.

Metrics are all
collected live in-memory (and can be very fast with Java 8), buffered
there and shipped out to a MessageChannel (if one exists with id
"metricsChannel") in a background thread.

We can still use Java 8 library APIs (like LongAdder) but to compile
to java 7 compatible byte code we have to forgo the use of lambdas :-(
and shorthand generics (<>).

Fixes gh-2682, fixes gh-2513 (for Java 8 and Dropwizard users).
10 years ago
Andy Wilkinson 57a51ed289 Update configuration of Jolokia’s AgentServlet to support CORS
Spring Framework 4.2 introduces improved support for CORS. Notably this
means that a DispatcherServlet will now process an OPTIONS request if
it contains an Origin header, without having to enable OPTIONS request
dispatching for every endpoint.

This commit takes advantage of these changes in Spring Framework 4.2 by
configuring the controller that wraps Jolokia’s AgentServlet to handle
OPTIONS requests. This allows Jolokia’s CORS support to be configured
using Jolokia’s standard configuration, as described in section 4.1.5
of the Jolokia documentation [1].

Closes gh-1987

[1] https://jolokia.org/reference/html/security.html
10 years ago
Andy Wilkinson d2804dcf8c Merge branch '1.2.x' 10 years ago
Andy Wilkinson ffcc854d42 Include exception in warning message when pid file cannot be created
Closes gh-2905
10 years ago
Andy Wilkinson 080c8ff286 Merge branch '1.2.x' 10 years ago
Josh Thornhill b16a973d6a Honor the endpoint.enabled property when registering MBeans
Fixes gh-2873
Closes gh-2890
10 years ago
Rob Winch 8ee4166709 Merge remote-tracking branch 'local1.2.x/gh-2466' 10 years ago
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
10 years ago
Andy Wilkinson 6847608308 Merge branch '1.2.x'
In addition to the changes already made in 1.2.x, this commit updates
the tests in spring-boot-actuator to ensure that any Elasticsearch
data files are written into the target directory. This avoids problems
when switching branches caused by different versions of Elasticsearch
trying to read the files.
10 years ago
Phillip Webb a6644991be Attempt to fix broken javadoc build
See gh-2633
10 years ago
Phillip Webb 0451f16acc Refactor CacheStatisticsProvider to use generics
Update CacheStatisticsProvider to use a generic to indicate the type
of cache supported. Also extract individual CacheStatisticsProvider
implementations and made statistics an auto-configuration.

See gh-2633
10 years ago
Andy Wilkinson 3f44a6fc4d Merge branch '1.2.x' 10 years ago
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
10 years ago
Andy Wilkinson 825d01ea7d When cache names clash include clash manager name in all prefixes
Previously, when multiple cache managers had a cache with the same name,
the prefix for the first cache that was processed would not include its
cache manager’s name, but all subsequent prefixes would include the
cache manager’s name. This was inconsistent, and due to the cache
managers being unordered, the prefixing was not deterministic.

This commit updates the prefixing logic so that when there is a clash,
all of the affected prefixes will include the name of the cache manager.
For example, with cache managers named first and second and each
with a cache named users, the prefixes will be cache.first_users and
cache.second_users rather than cache.users and
cache.{first|second}_users.

Closes gh-2824
10 years ago
Andy Wilkinson 834276aa2b Improve diagnostics in PublicMetricsAutoConfigurationTests
multipleCacheManagers fails on the CI server but does not fail
locally. This commit updates assertMetrics to include information
about the actual metrics so it's clear why the expectation was not
met.
10 years ago
Stephane Nicoll bbbb34a690 Expose cache statistics as metrics
Add an abstraction that provides a standard manner to retrieve a
statistics snapshot of a cache.

Specific implementations for JSR-107, ehcache, hazelcast, guava and
concurrent map are provided. At the moment the size of the cache and
the hit/miss ratios are recorded. Cache metrics are exposed via the
`cache.` prefix followed by the name of the cache. In case of conflict,
the name of the cache manager is added as a qualifier.

It is possible to easily register a new CacheStatisticsProvider for an
unsupported cache system and the CacheStatistics object itself can be
extended to provide additional metrics.

See gh-2633
Closes gh-2770
10 years ago
Stephane Nicoll e55c9a1b80 Add missing dot in property description 10 years ago
Andy Wilkinson 5608a594bc Merge branch '1.2.x' 10 years ago
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
10 years ago
Christian Laakmann 24ca44dbb4 Fix Elasticsearch health indicator
- added setIndices to ElasticsearchHealthIndicatorProperties to enable
  setting the indices property from configuration files
- Elasticsearch cannot handle "null" if the health of all indices should
  be checked; use "_all" instead

Closes gh-2812
10 years ago
Stephane Nicoll bbaaaeb9cf Merge branch '1.2.x' 10 years ago
Stephane Nicoll 08959286e2 Fix "keys-to-sanitize" property doc 10 years ago
Sergey Egorov a60df81845 Add additional MetricsMvcEndpoint regex tests
Update MetricsMvcEndpointTests to test for regular expression based
calls.

Closes gh-2252
10 years ago
Phillip Webb 8ca5635b69 Add regex support to /metrics and /env endpoints
Update MetricsMvcEndpoint and EnvironmentMvcEndpoint to support regex
filter of names.

See gh-2252
Add it
10 years ago
Phillip Webb ffc5d565c8 Merge branch '1.2.x' 10 years ago
Phillip Webb e94de70358 Polish 10 years ago
Andy Wilkinson ba3d4e9e3c Upgrade to Spring Security 4
This commit updates Spring Boot to use Spring Security 4. As a result
of this, the coordinates of Thmyeleaf's Spring Security extra, for
which dependency management and auto-configuration is provided, have
been updated to the Spring Security 4 variant.

Closes gh-2727
10 years ago
Andy Wilkinson d3c70fa198 Merge branch '1.2.x' 10 years ago
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.
10 years ago
Dave Syer 76ca00fa0d Merge branch '1.2.x' (trace repository reverse) 10 years ago
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
10 years ago
Andy Wilkinson 03b109a2c8 Polish Elasticsearch health indicator
- Nest the configuration class in HealthIndicatorAutoConfiguration,
   bringing it into line with the other health indicator configuration
   classes
 - Include the statistics from the response in the health’s details
 - Map YELLOW to UP rather than UNKNOWN as it indicates that the cluster
   is running but that “the primary shard is allocated but replicas are
   not” [1]. The details can be used to determine the precise state of
   the cluster.
 - Add a property to configure the time that the health indicator will
   wait to receive a response from the cluster
 - Document the configuration properties
 - Update the tests to cover the updated functionality

See gh-2399

[1] http://www.elastic.co/guide/en/elasticsearch/reference/1.x/cluster-health.html
10 years ago
Binwei Yang 58c8c2ccdc Add a health indicator for an Elasticsearch cluster
Closes gh-2399
10 years ago
Andy Wilkinson bbaf585dd0 Merge branch '1.2.x' 10 years ago
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
10 years ago
Andy Wilkinson 5e3aab5153 Merge branch '1.2.x' 10 years ago
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
10 years ago
Phillip Webb 718a090b32 Restore Java 6 source/target settings
Update spring-boot-actuator to restore Java 6 compatibility.
10 years ago
Phillip Webb 8143d1f36d Apply animal sniffer to entire build
Move animal sniffer configuration out of spring-boot-dependencies to
spring-boot-parent and apply it to all projects.

See gh-716
10 years ago
Dave Syer c9c1e8b517 Add animal sniffer for Java 6 and jdk1.8 to actuator
The build now requires java 8 (although no language features are yet
in use). Bamboo has been updated.

Fixes gh-716
10 years ago
Spring Buildmaster e03c11dda8 Next development version 10 years ago
Phillip Webb fbf34e261e Polish 10 years ago
Andy Wilkinson becbc00a4d Use configured ObjectMapper, if available, in all EndpointMBeans
Prior to this commit, every EndpointMBean used its own ObjectMapper.
Each of these ObjectMappers was created using new ObjectMapper() with
no opportunity for configuration.

This commit uses the ObjectMapper from the application context and
shares it among all EndpointMBeans. This gives the user control over
the ObjectMapper’s configuration using spring.jackson.* properties,
their own Jackson2ObjectMapperBuilder bean, etc. In the absence of an
ObjectMapper in the application context a single ObjectMapper is
instantiated and is used by all EndpointMBeans instead.

To allow the ObjectMapper to be shared, a number of constructors have
been overloaded to also take the ObjectMapper as a parameter. In these
cases the old constructor has been preserved for backwards compatibility
but has been deprecated.

Closes gh-2393
10 years ago
Andy Wilkinson 8850286937 List excluded auto-config classes in the auto-config report and endpoint
Prior to this commit, the auto-configuration report (both in its logged
form and the actuator endpoint) listed the positive and negative matches
but did not list the classes, if any, that the user had excluded.

This commit updates the logged report and the actuator endpoint to
expose a list of the excluded class names configured via the exclude
attribute on @EnableAutoConfiguration.

Closes gh-2085
10 years ago
Andy Wilkinson ee3521b6a2 Test that total space is included in disk health information
Closes gh-2705
10 years ago
izeye e270a21b82 Add total space to disk health information
Previously, disk health information only included the amount of free
space and the configured threshold. This commit adds the disk’s total
space.

See gh-2705
10 years ago
Phillip Webb 10da3d390e Polish 10 years ago
Stephane Nicoll f5023fd415 Use testConnection() method
Update MailHealthIndicator to use the new testConnection() method
available as of Spring Framework 4.2

Closes gh-2666
10 years ago
Phillip Webb 7d3465f858 Merge branch '1.2.x' 10 years ago
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
10 years ago
Stephane Nicoll 9820fa9c88 Remove dead code
Fixes gh-2686
10 years ago
Andy Wilkinson ebf68978e8 Merge branch '1.2.x' 10 years ago
Andy Wilkinson c1eea4cf40 Ensure that a TTL of zero is honoured by HealthMvcEndpoint
See gh-2630
10 years ago
Andy Wilkinson 3b979eb828 Merge branch '1.2.x' 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 8d89f8fcea Merge branch '1.2.x' 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 182754a582 Polish HealthIndicatorAutoConfiguration
Update HealthIndicatorAutoConfiguration to reduce the amount of
duplication in inner configuration classes.
10 years ago
Phillip Webb 4af70f1840 Polish 10 years ago
Phillip Webb c349b402e8 Merge branch '1.2.x' 10 years ago
Phillip Webb 16495d223a Polish 10 years ago
Stephane Nicoll bfee98e1f3 Add JMS health indicator
Define an additional health indicator for each ConnectionFactory instance
defined in the context. Extracts the provider name from the connection
meta-data.

Fixes gh-2016
10 years ago
Stephane Nicoll 9094706f6a polish 10 years ago
Johannes Stelzer cd8c3d7327 Add mail health check
Define an additional health indicator for each JavaMailSenderImpl
instance in the context.

Closes gh-2017 and gh-2617
10 years ago
Andy Wilkinson 6811a41817 Merge branch '1.2.x' 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 af5de18bf3 Merge branch '1.2.x' 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 3ce45c0bab Merge branch '1.2.x' 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
Phillip Webb a57a88f5cf Move master to 1.3.0.BUILD-SNAPSHOT 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