/** * @param path to the object or value to set * @param json value to set it to, can be a json primitive or struct */ default void update(String path, String json) { update(path, json.getBytes(StandardCharsets.UTF_8)); }
/** * @param path to the object or value to set * @param json value to set it to, can be a json primitive or struct */ default void update(String path, String json) { update(path, json.getBytes(StandardCharsets.UTF_8)); }
default void update(String path, byte[] json) { update(path, new ByteArrayInputStream(json)); }
default void update(String path, byte[] json) { update(path, new ByteArrayInputStream(json)); }
@Path("/{path: .*}.json") @Consumes(APPLICATION_JSON) @PATCH public void patch(@PathParam("path") String path, InputStream body) { jsondb.update(path, body); }
@Path("/{path: .*}.json") @Consumes(APPLICATION_JSON) @PATCH public void patch(@PathParam("path") String path, InputStream body) { jsondb.update(path, body); }
jsonDB.update("/logs", Json.mapper().writeValueAsBytes(batch)); LOG.info("Batch ingested {} log events", eventCounter);
/** * Persists the latest metrics of a live pod to the database. */ @Override public void persist(RawMetrics rawMetrics) { try { //persist the latest rawMetrics String path = path(rawMetrics.getIntegrationId(), rawMetrics.getPod()); String json = Json.writer().writeValueAsString(rawMetrics); if (jsonDB.exists(path)) { //only update if not the same (don't cause unnecessary and expensive writes) if (! jsonDB.getAsString(path).equals(json)) { jsonDB.update(path, json); } } else { jsonDB.set(path, json); } } catch (JsonProcessingException e) { LOGGER.error("Error persisting metrics!", e); } }
.build(); String json = Json.writer().writeValueAsString(updatedHistoryMetrics); jsonDB.update(path(integrationId,historyKey), json); } else {