This commit adds the required infrastructure for instrumenting the
GraphQL engine and datafetchers in order to collect metrics.
With this infrastructure, we can collect metrics such as:
* "graphql.request", a timer for GraphQL query
* "graphql.datafetcher", a timer for GraphQL datafetcher calls
* "graphql.request.datafetch.count", a distribution summary of
datafetcher count per query
* "graphql.error", an error counter
See gh-29140
Previously the parameters were not ignored so */*;q=0.8 was not
identified as accepting */*. As a result, the most recent producible
content type was returned rather than the default.
This commit updates the argument resolver to ignore parameters.
The default content type is now produced in response to a request
that accepts */*, irrespective of its parameters.
Fixes gh-28446
Change the cache in `CachingOperationInvoker` to be a reference based
map and also clean stale entries when a specific threshold is met.
Fixes gh-28313
Update Prometheus `TextOutputFormat` so that OpenMetrics is used in
preference to text output when an appropriate accept header is found.
If the accept header contains `*/*` or is missing then the text format
will be used.
See gh-28130
Add an `isDefault()` method to `Producible` which can be used to
indicate which of the enum values should be used when the accept header
is `*/*` or `null`.
Prior to this commit, the last enum value was always used as the
default.
See gh-28130
Previously, the URI template handler installed by the client metrics
interceptor would always capture the URI template and push it onto the
deque, irrespective of whether auto timing was enabled. When
auto-timing is disabled the deque is never polled so this led to its
unrestricted growth.
This commit updates the URI template handler so that a URI template is
only pushed onto the deque when the auto timing configuration enables
the interceptor.
Fixes gh-26915
Change `CompositeHealth.getDetails()` to public so that it serializes
correctly when `MapperFeature.CAN_OVERRIDE_ACCESS_MODIFIERS` is
disabled.
Fixes gh-26797
Rework existing `@Timer` annotation support to remove duplicate code
and offer general purpose utilities that can be used in future metrics
support.
See gh-23112
See gh-22217
Extract common method logic to a `HandlerMethodTimedAnnotations`
utility class and also add some caching. Also move the test code
into a single class.
See gh-23112
Fix package tangle in the actuator endpoint package by relocating a
few classes.
The `Producible` and `ProducibleOperationArgumentResolver` classes have
been moved from `endpoint.annotation` to `endpoint` since they aren't
directly tied to annotations.
The `ApiVersion` class has been moved from `endpoint.http` to
`endpoint` since it needs to implement `Producible` and isn't really
tied to HTTP.
Closes gh-25914
This commit reworks the initial proposal so that jobs and triggers are
treated as first class concepts.
`/actuator/quartz` now returns the group names for jobs and triggers.
`actuator/quartz/jobs` returns the job names, keyed by the available
group names, while `/actuator/quartz/triggers` does the same for
triggers.
`/actuator/jobs/{groupName}` provides an overview of a job group. It
provides a map of job names with the class name of the job.
implementation
`/actuator/triggers/{groupName}` provides an overview of a trigger
group. There are five supported trigger implementations: cron, simple,
daily time interval, calendar interval, and custom for any other
implementation. Given that each implementation has specific settings,
triggers are split in five objects.
`/actuator/jobs/{groupName}/{jobName}` provides the full details of a
particular job. This includes a sanitized data map and a list of
triggers ordered by next fire time.
`/actuator/triggers/{groupName}/{triggerName}` provides the full details
of a particular trigger. This includes the state, its type, and a
dedicate object containing implementation-specific settings.
See gh-10364
Prior to this commit, some exceptions handled at the controller or
handler function level would:
* not bubble up to the Spring Boot error handling support
* not be tagged as part of the request metrics
This situation is inconsistent because in general, exceptions handled at
the controller level can be considered as expected behavior.
Also, depending on how the exception is handled, the request metrics
might not be tagged with the exception.
This will be reconsidered in gh-23795.
This commit prepares a transition to the new situation. Developers can
now opt-in and set the handled exception as a request attribute. This
well-known attribute will be later read by the metrics support and used
for tagging the request metrics with the exception provided.
This mechanism is automatically used by the error handling support in
Spring Boot.
Closes gh-24028
Previously, would log an error for any exception and also stop
publishing for an UnknownHostException. By constrast, Micrometer's
PushMeterRegistry treats all exceptions the same, logging a warning
and continuing with subsequent push attempts.
This commit updates the push gateway manager's behaviour to match
PushMeterRegistry. UknownHostExceptions no longer receive special
treatment and push (and delete) failures are now logged as warnings
rather than errors.
Fixes gh-25804
Prior to this commit, the Actuator instrumentation for WebFlux servers
would not record metrics in two cases:
* the client disconnects before the response has been sent
* a server timeout is triggered before the response is sent
This commit improves the existing instrumentation to record metrics in
these cases. Since the causes of timeouts/disconnections can vary a lot,
the chosen "outcome" tag for metrics is "UNKNOWN".
Closes gh-23606
Update `AbstractWebMvcEndpointHandlerMapping` to chain any caught
InvalidEndpointRequestExceptions so that a more complete stacktrace
is available. The exception has also been updated to a
`ResponseStatusException` so that the reason can be propagated.
Fixes gh-25642
Previously, the auto-configuration for DataSource initialization and
the properties used to configure it were part of the general
DataSource auto-configuration and properties.
This commit moves the auto-configuration of DataSource initialization
out into a separate top-level auto-configuration class. Similarly,
the properties for configuring DataSource initialization have been
moved from `spring.datasource.*` into `spring.sql.init.*`.
The old initialization-related `spring.datasource.*` properties have
been deprecated but can still be used. When they are used, they new,
separate initialization auto-configuration will back off. In other
words, the initialization related `spring.datasource.*` properties
and the `spring.sql.init.*` properties cannot be used in combination.
Closes gh-25323
Previously, a root URI configured via RestTemplateBuilder's rootUri
method and RootUriTemplateHandler was not taken into account when
generated the URI tag for RestTemplate request metrics.
This commit updates MetricsClientHttpRequestInterceptor to be aware
of RootUriTemplateHandler and capture the URI template once the
root URI has been applied.
Fixes gh-25744
Refine the new `Producible` support so that it can also be used with
`@ReadOperation`, `@WriteOperation` and `@DeleteOperation` annotations.
This update allows the same enum to be used both as an argument and as
an indicator of the media-types that an operation may produce.
Closes gh-25738
Update the actuator @Enpoint` infrastructure code so that operations
may inject enums that indicate the type of output to produce. A new
`Producible` interface can be implemented by any enum that indicates
the mime-type that an enum value produces.
The new `OperationArgumentResolver` provides a general strategy for
resolving operation arguments with `ProducibleOperationArgumentResolver`
providing support for `Producible` enums. Existing injection support has
been refactored to use the new resolver.
See gh-25738