Commit Graph

1184 Commits (7c1f9eb1b9664a3b875c2bdf8da964be30d5c219)

Author SHA1 Message Date
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
Phillip Webb d7a12a8791 Remove superfluous semi-colons 10 years ago
Phillip Webb 0702b4e7e3 Merge branch '1.1.x'
Conflicts:
	spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfigurationTests.java
	spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration.java
10 years ago
Phillip Webb 96d479c3d9 Make RequestMappingHandlerMapping @Primary
Update WebMvcAutoConfiguration so that the RequestMappingHandlerMapping
bean is @Primary. Prior to this commit a NoUniqueBeanDefinitionException
would be thrown then using the MvcUriComponentsBuilder.

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

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

The health MVC endpoint should now work as follows:

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

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

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

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

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

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

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

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

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

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

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

Fixes gh-2102
10 years ago
Dave Syer de3ce18ad6 Defensive check for cglib proxy in RequestMappingEndpoint
Since AbstractHandlerMethodMapping.getHandlerMap() is final it can't
be cglibbed and a proxy will barf if you try and call that method.
The RequestMappingEndpoint can be protected simply by defensively
checking if the mapping is a proxy before trying to inspect it.
10 years ago
Phillip Webb b63922d59d Polish 10 years ago
Stephane Nicoll d33c0ebf8f Fix data type of telnet and ssh ports
Define shell.ssh.port and shell.telnet.port as integer properties
so that the generated meta-data exposes the proper type.

Fixes gh-2076
10 years ago
Phillip Webb 4b7c6f61b4 Polish 10 years ago
Phillip Webb fc746b802a Polish 10 years ago
Stephane Nicoll f40f17a758 Add missing description 10 years ago
Phillip Webb d7c61ef01c Drop ShellProperties.setAdditionalProperties
Drop the setAdditionalProperties method from ShellProperties to ensure
that it is not included in the meta-data JSON. The additional properties
are usually wired in using @Autowired and it is pretty unlikely that
anyone is using the setter directly.

Fixes gh-2055
10 years ago
Dave Syer 0b19884f58 Remove unecessary reflection hacks 10 years ago
Phillip Webb 4c7cc58a19 Correct ApplicationPidFileWriter property javadoc
Fixes gh-2041
10 years ago
Dave Syer 9de82f9c69 Add some space between the trace filter and the end of the chain 10 years ago
Phillip Webb 09dac5ff00 Apply formatting and cleanup rules 10 years ago
Phillip Webb 48db5457f1 Polish 10 years ago
Phillip Webb 237defaf18 Merge branch '1.1.x' 10 years ago
Phillip Webb 41c15f205f Polish concurrent gaugeLocks map access
See gh-1995
10 years ago
Phillip Webb 53637eaa7c Merge branch '1.1.x'
Conflicts:
	spring-boot/src/main/java/org/springframework/boot/logging/LoggingApplicationListener.java
10 years ago
Phillip Webb 49858a0ff1 Fix concurrent gaugeLocks map access
Use putIfAbsent to ensure atomic creation of lock objects.

Fixes gh-1995
10 years ago
Dave Syer 3c1e48c89a Better handling of anonymously accessible endpoints
Shares the /health endpoint request mapping between security config
and MVC dispatcher. Generalizes so that instead of a marker
interface (AnonymouslyAccessibleMvcEndpoint), an MvcEndpoint
signals that it wants to control its own access rules by adding
a Principal to the @RequestMapping method parameters (more @MVC).

Fixes gh-2015 slightly differently
10 years ago
Andy Wilkinson 2ce057ca96 Allow /health to be accessed anonymously irresepctive of its sensitivity
The changes in 3bb598a overload the health endpoint's sensitive
property such that it's now considered sensitive if management
security is enabled. When an endpoint is sensitive anonymous
access is prevented. This breaks the health endpoint which should
return a filtered view of the server's health when it's accessed
anonymously rather than rejecting the request.

This commit introduces AnonymouslyAccessibleMvcEndpoint, a marker
extension of the MvcEndpoint interface. It is implemented by
HealthMvcEndpoint. ManagementSecurityAutoConfiguration has been
updated to allow anonymous access to endpoints that aren't sensitive
or that implement AnonymouslyAccessibleMvcEndpoint.

Fixes gh-2015
10 years ago
Stephane Nicoll 65e9d6a6e0 Add property description
Set the field javadoc of many properties that are managed via
configuration so that the "description" field is available in the
meta-data.

Closes gh-1808
10 years ago
Spencer Gibb 2fb4d2ece6 Check if managementServerProperties.getSecurity() is not null
before checking isEnabled(). It is explicitly constructed as null
in ManagementServerProperties to prevent class not found errors
at runtime when Security is not on the classpath.

Fixes gh-2003, fixes gh-2004
10 years ago
Dave Syer 3bb598a421 Only hide /health details if the app is actually secure
Also gives the user the option to override (by setting
endpoints.health.sensitive=false).

Fixes gh-1977 in a slightly different way
10 years ago
Andy Wilkinson 337e9bd013 Use and wait for a latch to check that the interceptor is called
Spring MVC drives the postHandle method on any interceptors after the
response has been sent to the client. This meant that there was a
race between the test receiving the response and asserting that the
interceptor had been driven and Spring MVC driving the interceptor.

This commit updates the interceptor to use a CountDownLatch to track
whether or not it's been called. The test now waits for up to 30
seconds for the latch to be decremented.

Closes gh-1997
10 years ago
Andy Wilkinson 26a511495e Allow the user to opt-out of anonymous access restrictions for /health
By default, when /health is accessed anonymously, the details are
stripped, i.e. the response will only indicate UP or DOWN. Furthermore
the response is cached for a configurable period to prevent a denial
of service attack.

This commit adds a configuration property,
endpoints.health.restrict-anonymous-access, that can be set to false
to allow full anonymous access to /health. When full access is
allowed, the details will be included in the response and the response
will not be cached.

Closes gh-1977
10 years ago
Andy Wilkinson 5854ea189e Make TestInterceptor thread-safe
Previously, TestInterceptor used an int to keep a count of how often
it had been called. The count was incremented on one thread and
read on another thread. This lead to intermittent test failures as the
field was not declared volatile and a stale value would sometimes be
returned.

This commit updates TestInterceptor to use an AtomicInteger that's
held in a final field. This ensures that getCount() will not return
stale values and also ensures that the count can safely be incremented
concurrently.

Closes gh-1997
10 years ago
Stephane Nicoll 76451d13f5 Add metadata for info.*
Closes gh-1993
10 years ago
Dave Syer 9db86bbd2a Lookup metadata bean from context instead of injecting
That way, if there is one, it will always be the right one
(otherwise you might be processing teh parent context with
metadata from the child).

Fixes gh-1982
10 years ago
Stephane Nicoll 7b4de0921f Remove useless @ConfigurationProperties
Fixes gh-1972
10 years ago
Dave Syer cd092e02dc Remove unecessary Jackson dependency in trace filter 10 years ago
Stephane Nicoll 11894a5412 Fix manual metadata format inconsistency
Fixes gh-1961
10 years ago
Phillip Webb c34cfb27a3 Polish 10 years ago
Dave Syer ae23ba13b5 Fix for Java < 1.8
Uses raw class instead of Java Type API (which has a
default method in 1.8, unavailble in 1.7).
10 years ago
Dave Syer 5d2d39e87d Add EndpointHandlerMappingCustomizer callback
Users can add @Beans of this type to customize the
EndpointHandlerMapping (e.g. add interceptors) even if
it is in a child context.

Fixes gh-1933
10 years ago
Dave Syer 1254508357 Fix tests some more
Eclipse (by default) does not create the JSON metadata when
it compiles the @ConfigurationProperties beans. So running on
the command lilne gets scarily different than in an IDE. Fixed
by externalizing the metadata location and setting it to something
empty in the tests.
10 years ago
Dave Syer 0757d24d91 Fix /configprops tests 10 years ago
Dave Syer 6ad626de49 Allows /configprops endpoint to show nested properties
Including maps and lists. Beans with no metadata (in
/META-INF/*spring-configuration-metadata.json) are just serialized
as they come (so might have problems like cycles). Serialization
errors are caught and rendered as an "error" for that bean. Any
problems can be fixed by preparing metadata and specifying which
properties are to be rendered that way.

Fixes gh-1746, fixes gh-1921
10 years ago
Phillip Webb b583262211 Use SmartInitializingSingleton when possible
Switch implementations of ApplicationListener<ContextRefreshEvent> for
SmartInitializingSingleton when possible.

Fixes gh-1939
10 years ago
Phillip Webb 6cdd27a34d Merge branch '1.1.x' 10 years ago
Phillip Webb f224c7ac9e Find @ConfigurationProperties annotation on proxy
Update ConfigurationPropertiesReportEndpoint to find
@ConfigurationProperties using `context.findAnnotationOnBean` rather
than `AnnotationUtils.findAnnotation`. This will correctly find the
annotation even if the bean is an interface based proxy.

Fixes gh-1927
10 years ago
Stephane Nicoll 16e2130896 Add missing properties metadata
Fixes gh-1829
10 years ago
Phillip Webb 0a6c635f5e Use getMaxActiveSessions() in Tomcat metrics
Replace the getMaxActive() call with getMaxActiveSessions().

Fixes gh-1902
10 years ago
Dave Syer 90d25bd582 Use Set (again) for enumerating MvcEndpoints
This reverts a change that I assume was orphaned from work in
progress to address #1353, but is no longer needed. Anyway
there is no reason to restrict MvcEndpoints to be unique by
path since they can declare their own @RequestMappings
(and if there are duplicates they will be detected when those
are scanned).

Fixes gh-1911
10 years ago
Spring Buildmaster 46b7738334 Next development version 10 years ago
Johannes Stelzer c2a3ccde3e Add Tomcat public metrics for session usage
Fixes gh-1860
10 years ago
Phillip Webb d8c5c3262a Co-locate PublicMetrics auto-configuration
Fixes gh-1900
10 years ago
Phillip Webb 3e02b81e98 Merge branch '1.1.x' 10 years ago
Phillip Webb 52967017a0 Polish 10 years ago
Johannes Stelzer 7770b92411 Add systemload.average to SystemPublicMetrics
Fixes gh-1865
10 years ago
Phillip Webb d097c9a2f9 Formatting 10 years ago
Stephane Nicoll 6df001d30f Fix json format 10 years ago
Stephane Nicoll 00961611b2 Move health.* properties to management.health.*
Fixes gh-1841
10 years ago
Phillip Webb 004904af87 Fix meta-data JSON formatting error 10 years ago
Phillip Webb ea6162254d Update pidfile property and add documentation
Change the pidfile property from `spring.application.pidfile` to
`spring.pidfile` (to save confusion with SpringApplication properties).

Also added documentation and meta-data information.

See gh-1579
10 years ago
Phillip Webb 026b89f58c Support PID file location in Spring Environment
Update ApplicationPidFileWriter to support the Spring Environment,
picking up the `spring.application.pidfile` property if specified.

Fixes gh-1579
10 years ago
Stephane Nicoll fbf8f56a97 Generate standard configuration meta-data
Update the `spring-boot`, `spring-boot-autoconfigure` and
`spring-boot-actuator` project to generate configuration meta-data
files during compilation.

See gh-1001
10 years ago
Phillip Webb d6f2f0deee Merge branch '1.1.x' 10 years ago
Phillip Webb 5f80f3556b Use more specific WebSecurityConfigurer @Bean type
Update ManagementSecurityAutoConfiguration to return
IgnoredPathsWebSecurityConfigurerAdapter rather than
WebSecurityConfigurer<WebSecurity>.
10 years ago
Dave Syer 49fbf215a1 Switch to Dropwizard metrics 3.1.0
Fixes gh-1775
10 years ago
Dave Syer afb7156804 Add missing method for Java 1.7 10 years ago
Dave Syer a284d7bd3f Add Codahale metrics to /metrics endpoint
All metrics in the MetricRegistry have been added unconditionally for now.

Fixes gh-1795
10 years ago
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
10 years ago
Phillip Webb d17b7c8195 Polish 10 years ago
Christian Dupuis 6c66ff78c0 Fix health status aggregation bug 10 years ago
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
10 years ago
Phillip Webb 2e7aa4685b Polish 10 years ago
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
10 years ago
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
10 years ago
Andy Wilkinson 7211571969 Fix some grammar issues in docs
Closes gh-1695
10 years ago
Eric Dahl 16937746a0 Fix some grammar issues in docs 10 years ago
Phillip Webb c90633aab6 Polish 10 years ago
Spring Buildmaster 3e71a21b30 Next development version 10 years ago
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
10 years ago
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
10 years ago
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
10 years ago
Phillip Webb 77ccd9a80b Rename ApplicationPidListener
Rename ApplicationPidListener to ApplicationPidFileWriter (keeping the
old class in a deprecated form)

Fixes gh-1673
10 years ago
Phillip Webb 4c51aa8e28 Polish 10 years ago
Andy Wilkinson b8eb13d827 Fix tests after addition of disk space health indicator 10 years ago
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
10 years ago
Mattias Severson 78d7fe9cb5 Add HealthIndicator that checks free disk space
See gh-1297
10 years ago
Phillip Webb 62eb01f0b8 Polish 10 years ago
Phillip Webb 872f30e5d0 Merge branch '1.1.x'
Conflicts:
	spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/repository/redis/RedisMetricRepository.java
10 years ago
Phillip Webb 9dfbc25eaa Polish 10 years ago
Andy Wilkinson 06e18c6a46 Merge branch 'gh-1664' 10 years ago
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
10 years ago
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).
10 years ago
Dave Syer c18b4248e5 Merge 1.1.x with minor conflict 10 years ago
Dave Syer e913b35227 Merge 1.1.x with minor conflict 10 years ago
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().
10 years ago
Dave Syer a702ff5c36 Make ServerProperties bean conditional on being a webapp 10 years ago
joshiste 9af8fdb8a1 Expose RichGauges in MetricsEndpoint via PublicMetrics
Fixes gh-1635
10 years ago
Andy Wilkinson c601c09ecc Upgrade to Hibernate Validator 5.1.2.Final
Closes gh-1595
10 years ago
Dave Syer 2f4b89d19b Merge branch '1.1.x' 10 years ago
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
10 years ago
Dave Syer dd8db93781 Merge branch '1.1.x' 10 years ago
Dave Syer 79deed7ec5 Remove extra trailing '-' in metric name 10 years ago
Dave Syer bfb387bc02 Default prefix for redis keys doesn't need period 10 years ago
Spring Buildmaster edb4b7ed7d Next development version 10 years ago
Phillip Webb b9edf3c500 Merge branch '1.1.x' 10 years ago
Phillip Webb fa02c01727 Polish 10 years ago
Dave Syer 9d9819c338 Merge branch '1.1.x' 10 years ago
Dave Syer c1404b1e41 Tidy some Javadocs 10 years ago
Phillip Webb 0d0e5eb590 Merge branch '1.1.x' 10 years ago
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
10 years ago
Andy Wilkinson 944045cd34 Merge branch '1.1.x' 10 years ago
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
10 years ago
Andy Wilkinson 3c93d9a803 Merge branch '1.1.x' 10 years ago
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
10 years ago
Phillip Webb 88f8eb7fa4 Merge branch '1.1.x' 10 years ago
Phillip Webb 611f978181 Make all @Bean methods public
Fixes gh-1571
10 years ago
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
10 years ago
Phillip Webb fae9ab4140 Fix failing tests 10 years ago
Dave Syer 049cd4b85b Merge branch '1.1.x' 10 years ago
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
10 years ago
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
10 years ago
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
10 years ago
Spring Buildmaster d63e4b4329 Next development version 10 years ago
Phillip Webb 8bf1f9567a Apply eclipse formatting and cleanup rules 10 years ago
Phillip Webb eaa3bd040d Apply eclipse formatting rules 10 years ago
Phillip Webb 57a154520e Drop min/max DataSourcePool metrics 10 years ago
Phillip Webb c8809afe1b Polish 10 years ago
Phillip Webb 5001b038cb Expose additional pool metrics
Expose `max` and `min`, alongside the existing `active` and `usage`
metrics.
10 years ago
Phillip Webb 4c8d35db43 Rename CompositeDataSourcePoolMetadataProvider
Rename CompositeDataSourcePoolMetadataProvider to
DataSourcePoolMetadataProviders.
10 years ago
Phillip Webb a512bcf766 Always auto-configure pool metadata providers
Import DataSourcePoolMetadataProvidersConfiguration from
DataSourceAutoConfiguration so that PoolMetadataProviders are configured
even if actuator is not used.
10 years ago
Phillip Webb 69107cb1df Create metadata sub-package
Create `org.springframework.boot.autoconfigure.jdbc.metadata` package
and move DataSourcePoolMetadata classes.
10 years ago
Phillip Webb e56be6cf3d DataSourceMetadata -> DataSourcePoolMetadata
Rename DataSourceMetadata to DataSourcePoolMetadata
10 years ago
Phillip Webb e17769fc2f Polish DataSourceMetrics code 10 years ago
Phillip Webb 169a46b1aa Rename MetricDataSourceAutoConfiguration
Rename MetricDataSourceAutoConfiguration to
DataSourceMetricsAutoConfiguration
10 years ago
Phillip Webb adbded33ff Apply eclipse formatting rules to 3dc932db 10 years ago
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
10 years ago
Stephane Nicoll 2694941b93 Fix DataSourceMetadata location
This commit complements 3dc932db8 and fix the package location of
DataSourceMetadata.

Fixes gh-1013
10 years ago
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
10 years ago
Mattias Severson 04c3e9979f Fix typo
Fixes gh-1463
10 years ago
Mattias Severson 5dcc4c3829 Fix typo
Fixes gh-1463
10 years ago
Dave Syer 171b2e452b Make ServerProperties bean conditional on being a webapp 10 years ago
Phillip Webb fc7823bc42 Merge branch '1.1.x' 10 years ago
Phillip Webb 5c34b07742 Fix DefaultCounterService.reset
Fix DefaultCounterService.reset to call the reset method of the
underlying MetricWriter.

Fixes gh-1391
10 years ago
Phillip Webb 83bd36d8e0 Merge branch '1.1.x'
Conflicts:
	spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/JpaProperties.java
10 years ago
Phillip Webb 6e6bc25c44 Polish 10 years ago
Dave Syer c556175381 Merge branch '1.1.x' 10 years ago
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.
10 years ago
Dave Syer 300910f7d5 Merge branch '1.1.x' 10 years ago
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
10 years ago
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
10 years ago
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
10 years ago
Spring Buildmaster 74d0c5185a Next development version 10 years ago
Phillip Webb 7641f23f71 Merge branch '1.1.x' 10 years ago
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
10 years ago
Phillip Webb 92899474ac Polish 10 years ago
Dave Syer 1e51c5db15 Merge branch '1.1.x' 10 years ago
Dave Syer 1259057acb Change unknownPath to unmapped 10 years ago
Taylor Wicksell 733b22f46a gh-1331 defaulting 404 response metrics to "unkownPath" when no matching handler can be found
Fixes gh-1331, Fixes gh-1333
10 years ago
Taylor Wicksell c6f5961ad6 fix for gh-1331 MetricFilter now supports uri template variables when available 10 years ago
Phillip Webb 642224feff Support regex in keys-to-sanitize
Update EnvironmentEndpoint and ConfigurationPropertiesReportEndpoint
to allow regex patterns in `keys-to-sanitize`.

Fixes gh-1245
10 years ago
Phillip Webb da5c36c3a9 Polish 10 years ago
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
10 years ago
Andy Wilkinson 2abf3ebdc3 Merge branch '1.1.x' 10 years ago
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
10 years ago
Phillip Webb 53d24301d1 Merge branch '1.1.x' 10 years ago
Phillip Webb f8bf0e2031 Polish 10 years ago
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
10 years ago
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
10 years ago
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
10 years ago
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
10 years ago
Christian Dupuis 2f28a1017c Polish and re-add author name 10 years ago
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
10 years ago
Christian Dupuis 99971a6578 Fix HTTP status code mapping in HealthMvcEndpoint
refs #1264
10 years ago
Stephane Nicoll 249e09d9bc Switch master to 1.2.0.BUILD-SNAPSHOT 11 years ago
Spring Buildmaster 40327e1ae6 Next development version 11 years ago
Phillip Webb fa88c481a5 Remote trailing whitespace 11 years ago
Dave Syer 2a1ccfeade Allow /mappings to be disabled (fixes gh-1185) 11 years ago
Spring Buildmaster 981669b7c0 Next development version 11 years ago
Phillip Webb 200cd535c2 Revert "Next development version"
This reverts commit 67189477fe.
11 years ago
Spring Buildmaster 67189477fe Next development version 11 years ago
Phillip Webb 9632abf825 Formatting and cleanup 11 years ago
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.
11 years ago
Phillip Webb 1f36d4657f Fix various Windows related issues
Fixes gh-1168
11 years ago
Spring Buildmaster 542f3cbda8 Next development version 11 years ago
Dave Syer 0d5c30fdcc Add instance.uptime to VanillaPublicMetrics 11 years ago
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
11 years ago
Christian Dupuis edffabeee4 Make sure Spring related security beans for the shell are not installed if not wanted
refs #1121
11 years ago
Christian Dupuis b439d3522e Fix VanillaHealthIndicator javadoc 11 years ago
Tobias Gesellchen 21846f3bc7 update javadoc and test method to reflect current implementation 11 years ago
Dave Syer 59e177d298 Default endpoints.jmx.domain to the spring.jmx.default_domain 11 years ago
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
11 years ago
Phillip Webb 24471bc51e Polish 11 years ago
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
11 years ago
Dave Syer 3378ede231 Ensure CompositePropertySources are listed in EnvironmentEndpoint 11 years ago
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
11 years ago
Spring Buildmaster 4ca26a21dc Next development version 11 years ago
Spring Buildmaster 05ed7b3bcd Next development version 11 years ago
Phillip Webb 3007a777d0 Roll back to 1.1.0.BUILD-SNAPSHOT 11 years ago
Spring Buildmaster c650f2391e Next development version 11 years ago
Phillip Webb b5d267ca89 Polish 11 years ago
Christian Dupuis 5d25588d7b Make properties to sanitize configurable in EnvironmentEndpoint.
Add "key" to default keys that will be sanitized. fixes #1027
11 years ago
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.
11 years ago
Phillip Webb e891aa3525 Polish 11 years ago
Phillip Webb 2df4ead4d6 Convert README.md -> README.adoc 11 years ago
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
11 years ago
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
11 years ago
Andy Wilkinson c0c3c78f8d Add missing entries to the tables of auto-configuration classes
Closes #998
11 years ago
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.
11 years ago
Dave Syer b31295246c Make WebRequestTraceFilter once per request 11 years ago
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
11 years ago
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
11 years ago
Phillip Webb 91bd78047e Rename TraceWebFilterAutoConfigurationTest
Rename TraceWebFilterAutoConfigurationTest to
TraceWebFilterAutoConfigurationTests
11 years ago
Christian Dupuis 057e149846 Introduce Health.Builder to clean up HealthIndicator implementations 11 years ago
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
11 years ago
Phillip Webb 96a0d672af Rename SimpleDataSourceHealthIndicator
Rename SimpleDataSourceHealthIndicator to DataSourceHealthIndicator.
11 years ago
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.
11 years ago
Eric Dahl 3457cc4f39 Fix multiple typos in documentation, as well as "thread.deamon" typo in actuator 11 years ago
Christian Dupuis 297d14f5f8 Polish 11 years ago
Phillip Webb 1a475102de Polish 11 years ago
Andy Wilkinson d8e783f856 Update SolrHealthIndicator to extend AbstractHealthIndicator 11 years ago
Christian Dupuis db74d27ea0 Extract AbstractHealthIndicator
to make it more simple to implement HealthIndicator
11 years ago
Andy Wilkinson b76a519f65 Add a HealthIndicator for Solr 11 years ago
Christian Dupuis 40b55b0ff6 Extract AbstractHealthAggregator
This commit makes it easier for users to implement HealthAggregators
11 years ago
Christian Dupuis f9aeb6aefe Polish 11 years ago
Dave Syer 59c108a4b0 Fix bug in group names (again) 11 years ago
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.
11 years ago
Dave Syer 0dca2dd978 Small docs tweaks in metrics 11 years ago
Dave Syer b12d7c705c Improve redis repository implementations
Storing values in zset makes them less prone to races.

Fixes gh-929
11 years ago
Christian Dupuis b77a9c5a8e Remove List.sort usage for Collections.sort 11 years ago
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
11 years ago
Christian Dupuis 14899ba3b2 Fix compile problem
Something slipped the recent merge
11 years ago
Christian Dupuis 0c2bc99af3 Return different http return status codes for different system health states
fixes #880
11 years ago
Christian Dupuis 4bc6a0f49e Rename Status.status to Status.code 11 years ago
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.
11 years ago
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
11 years ago
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.
11 years ago
Dave Syer 94e891e924 Rename method count() -> countGroups()
Fixes gh-923
11 years ago
Phillip Webb 8bcda1bcbe Polish 11 years ago
Christian Dupuis 3f498a4803 Add configuration properties to disable out of the box health checks 11 years ago
Christian Dupuis 4ffe816a21 Fix typo 11 years ago
Christian Dupuis fef998f914 Remove autowired injection of HealthIndicators into HealthEndpoint
Moved into EndpointAutoConfiguration
11 years ago
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
11 years ago
Christian Dupuis 875e77d420 Correctly decode URL coming into the Jolokia endpoint
fixes #869
11 years ago
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
11 years ago
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.
11 years ago
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.
11 years ago
Dave Syer 85719f75e4 Add @Bean-level config properties to /configprops 11 years ago
Christian Dupuis 9e56c38b7a Rename DefaulErrorAttributes to DefaultErrorAttributes
fixes #853
11 years ago
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
11 years ago
Andy Wilkinson fec136e213 Merge branch '1.0.x'
Conflicts:
	spring-boot-dependencies/pom.xml
11 years ago
Andy Wilkinson f761daf253 Upgrade to CRaSH 1.3.0-beta18
Closes #841
11 years ago
Lukasz Kryger e7484c66f5 Registering PID file to be deleted on JVM exit 11 years ago
Phillip Webb bd38893f55 Rename rabbitHealthIndicator bean
Rename the rabbitHealthIndicator bean which was accidentally named
redisHealthIndicator.
11 years ago
Christian Dupuis a62bc9ca60 Polish 11 years ago
Christian Dupuis b026b13c66 Add HealthIndicator for Rabbit 11 years ago
Phillip Webb 1acffdf649 Polish 11 years ago
Christian Dupuis 51dddc2dc4 Add gc information to /metrics endpoint 11 years ago
Christian Dupuis dfd6f91aef Merge pull request #819 from cdupuis/health-indicator
Rework HealthIndicator support
11 years ago
Christian Dupuis 288e7a5d92 Rename missing test 11 years ago
Christian Dupuis 916a85c615 Rename SimpleHealthIndicator to SimpleDataSourceHealthIndicator 11 years ago
Christian Dupuis eeaa96725f Rename SimpleHealthIndicator to SimpleDataSourceHealthIndicator 11 years ago
Christian Dupuis c5ec735afb Add unit test for (Mongo|Redis)HealthIndicator 11 years ago
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
11 years ago
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.
11 years ago
Christian Dupuis 126fedc14a Add support for disabling crash commands
fixes #587 and #588
11 years ago
Stephane Nicoll 33082fd56d Harmonized maven dependency management
This commit harmonizes the dependency management of internal modules
so that versions can be omitted everywhere. Update the maven coordinates
to provide the full groupId for consistency
11 years ago
Phillip Webb dd7391d07e Add missing @Since tag 11 years ago
Tyler Frederick 43bd42f0f5 Add multi-datasource health indicator support
Update EndpointAutoConfiguration to support multiple datasources.

Fixes gh-783
11 years ago
Tyler Frederick 697afe3842 Add CompositeHealthIndicator
Add CompositeHealthIndicator that allows multiple HealthIndicators
to be combined into a single result.

Fixes gh-782
11 years ago
Stephane Nicoll e26e06d5dd Fix build
Two modules are still relying on the spring-boot test-jar but it was
not generated anymore. Adding the generation of test-jar again as
a workaround until we completely removes the use of it.
11 years ago
Christian Dupuis a66fc3030e Add more runtime metrics like information about heap, class loading and threads to the metrics infrastructure 11 years ago
Dave Syer ef4e83a879 Move ErrorController to autoconfig 11 years ago
Dave Syer 27580e726f Add generic error handling to BasicErrorController
Since Spring supports gobal error handling through
@ControllerAdvice, it is quite easy to set up more meta-data
about an exception for the BasicErrorController. You need
to be careful not to swallow Security exceptions, and probably
others (optionally) so this feature needs a bit more work.

See gh-538
11 years ago
Andy Wilkinson b6cd2c970c Use Jedis rather than Lettuce as preferred Redis client
Salvatore has indicated that Jedis is his Java Redis client of choice.
This commit updates the auto-configuration support, actuator and
Redis starter accordingly.

Completes #745
11 years ago
sopov.ivan 174b654faf minor test fixes
Reverting arguments in assertEquals where constant was placed on
the "actual" place. Replacing assertEquals with assertFalse, assertTrue
and assertNull where applicable.

Fixes gh-735
11 years ago
Phillip Webb 64a835e91a Move master to 1.1.0.BUILD-SNAPSHOT 11 years ago
Spring Buildmaster d3954a1703 Next development version 11 years ago
Phillip Webb 4119ef5cf4 Use random ports for tests
Update remaining tests to use random ports.

Fixes gh-337
11 years ago
Phillip Webb f847ed2b1f Remove getEmbeddedServletContainers()
Remove the mutable getEmbeddedServletContainers() Map from
EmbeddedWebApplicationContext and instead use the `namespace` to
distinguish the management container.

The ServerPortInfoApplicationContextInitializer class replaces the
previous TestExecutionListener to exposes port properties (by
listening for EmbeddedServletContainerInitializedEvents).
11 years ago
Phillip Webb fad5ce45db Polish 11 years ago
Phillip Webb 316cb87583 Create ApplicationPid and remove SystemUtils
Create a new ApplicationPid class to remove the need for SystemUtils
and refactor existing calls.
11 years ago
Dave Syer b291332cd4 Use CountDownLatch instead of Thread.sleep()
... to wait for ApplicationContext to close in the 3 tests
that we needed to do so.

Fixes gh-664
11 years ago
Dave Syer 00b85e8c42 Ensure path starts with "/" in ErrorController
When mapping the ErrorController path to Spring Security it's
important that it starts with "/". This change ensures that is
the case even if the user has omitted the leading "/".

Fixes gh-694
11 years ago
Dave Syer 7b07fe8ce0 Convert remaining samples to use random port
Partial fix for gh-337. See also gh-607 which complements this, but might
conflict on a merge.
11 years ago
Dave Syer f134e96053 Convert Actuator sample to dynamic ports 11 years ago
Dave Syer 41cdb7b48d Add parent directory creation
Also tidied a few other things up (like not needing
SmartApplicationListener).

Fixes gh-550
11 years ago
Jakub Kubrynski f6488c7f66 Now after starting application PID file will be created
Fixes gh-550
11 years ago
Dave Syer 708d5ade9f Fix path stripper in JolokiaEndpoint to account for management.contextPath
When the user sets management.contextPath=/admin the Jolokia
endpoint gets mapped to /admin/jolokia, but that the path stripper it uses
internally makes a false assumption about the form of the request path.
The fix is simple (just use a smarter search for the endpoint path in the
request path).

Fixes gh-642
11 years ago
Spring Buildmaster a5864ebcd0 Next development version 11 years ago
Dave Syer 72d7c286c0 Add Spring MVC-generated path suffixes to endpoint paths
Spring Security doesn't know that Spring MVC maps /foo, /foo.json
and /foo/ all to the same handler. This change explicitly adds
suffixes to the actuator endpoint matchers so they are properly
protected.
11 years ago
Spring Buildmaster 15e9dbe98b Next development version 11 years ago