Created
August 26, 2014 19:27
-
-
Save hernanliendo/493df50964edcf956f07 to your computer and use it in GitHub Desktop.
Hackademy - BigQuery client example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final List<Map<String, Object>> rowValues = new ArrayList<>(logsSharedObject.getItems().size()); | |
for (final ObjectVar itemOV : logsSharedObject.getItems()) { | |
final Map<String, Object> item = new HashMap<>(); | |
rowValues.add(item); | |
item.put("User", clientUserId); | |
item.put("Timestamp", time); | |
item.put("Device", device); | |
item.put("Type", itemOV.getString("t")); | |
item.put("Context", clientContext); | |
item.put("Log", itemOV.getString("l")); | |
item.put("Stack", itemOV.getString("s")); | |
item.put("RemoteAddress", remoteAddress); | |
} | |
if (!rowValues.isEmpty()) { | |
try { | |
BigQueryServerFactory.instance().getBigQueryClientFactory().insertRows("Audit", "ClientLog", rowValues); | |
} catch (final Throwable _throwable) { | |
log.log(Level.WARNING, "Problems sending logs to BigQuery: " + _throwable.getMessage(), _throwable); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment