Java Code Examples for java.util.AbstractMap.SimpleImmutableEntry#getValue()

The following examples show how to use java.util.AbstractMap.SimpleImmutableEntry#getValue() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CoreOutputManager.java    From ffwd with Apache License 2.0 6 votes vote down vote up
/**
 * Filter the provided Metric and complete fields.
 */
private Metric filter(final Metric metric) {
    final Date time = metric.getTime() != null ? metric.getTime() : new Date();

    final Map<String, String> tags = selectTags(metric);
    final Map<String, String> commonResource = Maps.newHashMap(resource);
    commonResource.putAll(metric.getResource());

    final SimpleImmutableEntry<Map<String, String>, Map<String, String>>
        tagsAndResources = processTagsToResource(tags, commonResource);
    final Map<String, String> mergedTags = tagsAndResources.getKey();
    final Map<String, String> mergedResource = tagsAndResources.getValue();

    final Set<String> mergedRiemannTags = Sets.newHashSet(riemannTags);
    mergedRiemannTags.addAll(metric.getRiemannTags());

    return new Metric(metric.getKey(), metric.getValue(), time, mergedRiemannTags,
        mergedTags, mergedResource, metric.getProc());
}
 
Example 2
Source File: CoreOutputManager.java    From ffwd with Apache License 2.0 5 votes vote down vote up
/**
 * Filter the provided Batch and complete fields.
 */
private Batch filter(final Batch batch) {
    final Map<String, String> commonTags = Maps.newHashMap(tags);
    commonTags.putAll(batch.getCommonTags());

    final Map<String, String> commonResource = Maps.newHashMap(resource);
    commonResource.putAll(batch.getCommonResource());

    final SimpleImmutableEntry<Map<String, String>, Map<String, String>>
        tagsAndResources = processTagsToResource(commonTags, commonResource);
    final Map<String, String> mergedCommonTags = tagsAndResources.getKey();
    final Map<String, String> mergedCommonResource = tagsAndResources.getValue();

    final List<Batch.Point> points = batch.getPoints().stream().map(point -> {
        final Map<String, String> pointTags = point.getTags();
        final Map<String, String> pointResource = point.getResource();

        final SimpleImmutableEntry<Map<String, String>, Map<String, String>>
            pointTagsAndResources = processTagsToResource(pointTags, pointResource);
        final Map<String, String> mergedTags = pointTagsAndResources.getKey();
        final Map<String, String> mergedResource = pointTagsAndResources.getValue();

        return new Batch.Point(
            point.getKey(),
            mergedTags,
            mergedResource,
            point.getValue(),
            point.getTimestamp());

    }).collect(Collectors.toList());

    return new Batch(mergedCommonTags, mergedCommonResource, points);
}