valueDocument.forEach((fKey, fValue) -> newDocument.put(fKey.replace(".", delimiter), fValue)); valueDocument = newDocument;
.generateMetricsBson(registry, TimeUnit.SECONDS, TimeUnit.MILLISECONDS); root.remove("version"); root.forEach((groupKey, groupContent) -> groupContent.asDocument().forEach((metricKey, metricContent) -> { final String[] split = metricKey.split("\\."); final String type = split[0]; final String responseCode = split.length >= 3 ? split[2] : null; metricContent.asDocument().forEach((metricType, value) -> { if (value.isNumber()) { sb.append("http_response_").append(groupKey).append("_").append(metricType);
/** * checks if the aggregation variable start with $ this is not allowed since * the client would be able to modify the aggregation stages * * @param aVars RequestContext.getAggregationVars() */ public static void checkAggregationVariables(BsonValue aVars) throws SecurityException { if (aVars == null) { return; } if (aVars.isDocument()) { BsonDocument _obj = aVars.asDocument(); _obj.forEach((key, value) -> { if (key.startsWith("$")) { throw new SecurityException( "aggregation variables cannot include operators"); } if (value.isDocument() || value.isArray()) { checkAggregationVariables(value); } }); } else if (aVars.isArray()) { aVars.asArray().getValues().stream() .filter(el -> (el.isDocument() || el.isArray())) .forEachOrdered(AbstractAggregationOperation::checkAggregationVariables); } }