Merge pull request #2646 from atomx/update-maxmind

Update com.maxmind.geoip2 to 2.6.0
This commit is contained in:
Nishant 2016-03-14 11:20:48 -07:00
commit 773d6fe86c
2 changed files with 5 additions and 4 deletions

View File

@ -613,7 +613,7 @@
<dependency> <dependency>
<groupId>com.maxmind.geoip2</groupId> <groupId>com.maxmind.geoip2</groupId>
<artifactId>geoip2</artifactId> <artifactId>geoip2</artifactId>
<version>0.4.0</version> <version>2.6.0</version>
<exclusions> <exclusions>
<exclusion> <exclusion>
<groupId>org.apache.httpcomponents</groupId> <groupId>org.apache.httpcomponents</groupId>

View File

@ -24,9 +24,10 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.maxmind.db.CHMCache;
import com.maxmind.geoip2.DatabaseReader; import com.maxmind.geoip2.DatabaseReader;
import com.maxmind.geoip2.exception.GeoIp2Exception; import com.maxmind.geoip2.exception.GeoIp2Exception;
import com.maxmind.geoip2.model.Omni; import com.maxmind.geoip2.model.CityResponse;
import com.metamx.common.logger.Logger; import com.metamx.common.logger.Logger;
import io.druid.data.input.InputRow; import io.druid.data.input.InputRow;
import io.druid.data.input.Row; import io.druid.data.input.Row;
@ -123,7 +124,7 @@ class WikipediaIrcDecoder implements IrcDecoder
private DatabaseReader openGeoIpDb(File geoDb) { private DatabaseReader openGeoIpDb(File geoDb) {
try { try {
DatabaseReader reader = new DatabaseReader(geoDb); DatabaseReader reader = new DatabaseReader.Builder(geoDb).withCache(new CHMCache()).build();
log.info("Using geo ip database at [%s].", geoDb); log.info("Using geo ip database at [%s].", geoDb);
return reader; return reader;
} catch (IOException e) { } catch (IOException e) {
@ -196,7 +197,7 @@ class WikipediaIrcDecoder implements IrcDecoder
if (anonymous) { if (anonymous) {
try { try {
final InetAddress ip = InetAddress.getByName(ipMatch.group()); final InetAddress ip = InetAddress.getByName(ipMatch.group());
final Omni lookup = geoLookup.omni(ip); final CityResponse lookup = geoLookup.city(ip);
dimensions.put("continent", lookup.getContinent().getName()); dimensions.put("continent", lookup.getContinent().getName());
dimensions.put("country", lookup.getCountry().getName()); dimensions.put("country", lookup.getCountry().getName());