fpapon commented on a change in pull request #85: [UNOMI-228] Replace user
agent detector library
URL: https://github.com/apache/unomi/pull/85#discussion_r278816137
##########
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:
@sergehuber @jbonofre : I made some tests and we can use a single shared
instance. The first parsing is around ~2s and the next parsing is <1ms.
I was thinking of creating an OSGi service dedicated to the
UserAgentDetector and use it in the blueprint request plugin.
I also add a filter to only load the fields that we need.
I will make some load tests with JMeter to validate.
Thoughts?
----------------------------------------------------------------
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