sergehuber commented on a change in pull request #85: [UNOMI-228] Replace user
agent detector library
URL: https://github.com/apache/unomi/pull/85#discussion_r277143401
##########
File path:
plugins/request/src/main/java/org/apache/unomi/plugins/request/actions/SetRemoteHostInfoAction.java
##########
@@ -150,14 +148,19 @@ public int execute(Action action, Event event) {
logger.error("Cannot lookup IP", e);
}
- UserAgentStringParser parser =
UADetectorServiceFactory.getResourceModuleParser();
- ReadableUserAgent agent =
parser.parse(httpServletRequest.getHeader("User-Agent"));
- session.setProperty("operatingSystemFamily",
agent.getOperatingSystem().getFamilyName());
- session.setProperty("operatingSystemName",
agent.getOperatingSystem().getName());
- session.setProperty("userAgentName", agent.getName());
- session.setProperty("userAgentVersion",
agent.getVersionNumber().toVersionString());
+ UserAgentAnalyzer uaa = UserAgentAnalyzer
Review comment:
This should not be done for each rule execution as its creation is very
expensive (multiple seconds). As documented here:
https://yauaa.basjes.nl/README-Usage.html we should either use a shared
instance that will have a synchronized call or use a ThreadPool or ThreadLocale
of these agent analyzers.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services