@@ -0,0 +1,1836 @@
+/**%0A * Copyright 2013 Netflix, Inc.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage com.netflix.servo.publish;%0A%0Aimport com.google.common.base.Function;%0Aimport com.google.common.collect.Lists;%0Aimport com.netflix.servo.Metric;%0A%0Aimport java.util.List;%0A%0A/**%0A * An observer that will transform the list of metrics using a given function.%0A */%0Apublic class MetricTransformObserver implements MetricObserver %7B%0A    private final Function%3CMetric, Metric%3E transformer;%0A    private final MetricObserver observer;%0A%0A    /**%0A     * Create a new MetricTransformObserver using the given transfomer function%0A     * @param transformer The function used to transform metrics.%0A     * @param observer    The MetricObserver that will receive the transfomed metrics.%0A     */%0A    public MetricTransformObserver(Function%3CMetric, Metric%3E transformer, MetricObserver observer) %7B%0A        this.transformer = transformer;%0A        this.observer = observer;%0A    %7D%0A%0A    @Override%0A    public void update(List%3CMetric%3E metrics) %7B%0A        final List%3CMetric%3E newMetrics = Lists.newArrayListWithCapacity(metrics.size());%0A        for (Metric m : metrics) %7B%0A            newMetrics.add(transformer.apply(m));%0A        %7D%0A        observer.update(newMetrics);%0A    %7D%0A%0A    @Override%0A    public String getName() %7B%0A        return %22MetricTransformObserver%22;%0A    %7D%0A%7D%0A

Add an observer that can transfom a list of metrics before forwarding them to the underlying observer