Skip to content

Commit

Permalink
Rebased from main
Browse files Browse the repository at this point in the history
Signed-off-by: Asif Sohail Mohammed <[email protected]>
  • Loading branch information
asifsmohammed committed Feb 12, 2024
1 parent 2064cca commit 5bc1419
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ public class GeoIPProcessor extends AbstractProcessor<Record<Event>, Record<Even
private final List<String> tagsOnFailure;
private final GeoIPProcessorService geoIPProcessorService;
private final ExpressionEvaluator expressionEvaluator;
// private final Map<EntryConfig, Set<GeoIPDatabase>> entryDatabaseMap;

/**
* GeoIPProcessor constructor for initialization of required attributes
Expand Down Expand Up @@ -125,10 +124,14 @@ public Collection<Record<Event>> doExecute(final Collection<Record<Event>> recor
} else {
isEventFailedLookup = true;
}
} catch (final UnknownHostException | EnrichFailedException ex) {
} catch (final EnrichFailedException ex) {
isEventFailedLookup = true;
LOG.error(DataPrepperMarkers.EVENT, "Failed to get Geo data for event: [{}] for the IP address [{}]. Caused by:{}",
event, ipAddress, ex.getMessage());
} catch (final UnknownHostException e) {
isEventFailedLookup = true;
LOG.error(DataPrepperMarkers.EVENT, "Failed to validate IP address: [{}] in event: [{}]. Caused by:[{}]",
event, ipAddress, e.getMessage());
}
} else {
//No Enrichment.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public Map<String, Object> getGeoData(final InetAddress inetAddress, final List<
} catch (final GeoIp2Exception e) {
throw new EnrichFailedException("Address not found in database.");
} catch (final IOException e) {
throw new EnrichFailedException("ailed to close database readers gracefully. It can be due to expired databases");
throw new EnrichFailedException("Failed to close database readers gracefully. It can be due to expired databases");
}
return geoData;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
import static org.mockito.Mockito.when;
import static org.opensearch.dataprepper.plugins.processor.GeoIPProcessor.GEO_IP_EVENTS_FAILED_LOOKUP;
import static org.opensearch.dataprepper.plugins.processor.GeoIPProcessor.GEO_IP_EVENTS_PROCESSED;
import static org.opensearch.dataprepper.plugins.processor.GeoIPProcessor.GEO_IP_EVENTS_FAILED_DB_LOOKUP;

@ExtendWith(MockitoExtension.class)
class GeoIPProcessorTest {
Expand Down

0 comments on commit 5bc1419

Please sign in to comment.