Filter to log user agent statistics as spring boot actuator metrics. Uses Yauaa library (https://github.com/nielsbasjes/yauaa) under the hood.
With version 0.3 the baseline has been updated to java 11 and spring boot 2.1 and the underlying user agent parser library has been replaced with a more recent project.
To match the new metrics framework (micrometer), the metrics concept has been changed from individual metrics keys per value (e.g. browser version) to a single metric with (configurable) tags. Therefore, the keys
namespace in the configuration has been renamed to tags
.
Note: do not use version 0.2.0, while it was updated to work with current framework versions, the library used for user agent parsing was outdated and could not correctly identify a number of current browsers.
runtime("eu.hinsch:spring-boot-actuator-user-agent-metrics:0.3.2")
<dependency>
<groupId>eu.hinsch</groupId>
<artifactId>spring-boot-actuator-user-agent-metrics</artifactId>
<version>0.3.2</version>
</dependency>
All config properties are located beneath the prefix user-agent-metric
Key | Default | Description |
---|---|---|
enabled | false | Turn metrics filter on/off |
url-patterns | empty list | List of patterns (ant style) to match the servlet filter on |
exclude-patterns | empty list | List of patterns (regex) to match against the request URI to exclude the request from metrics collection |
tags | empty list | list of fields to be added as micrometer tags. For a list of available fields see https://github.com/nielsbasjes/yauaa/blob/master/analyzer/src/main/java/nl/basjes/parse/useragent/UserAgent.java |
For an example see SpringBootActuatorUserAgentMetricsTestApplication and application.yml