var lookup = {},
    lookup_histogram = {},
    result = [];

JSON.parse(value).forEach(function (item) {
    if (item.name === 'kubelet_runtime_operations_total'){
        var op_type = item.labels.operation_type;

        if (lookup[op_type]) {
            return;
        }
        lookup[op_type] = 1;
        result.push({
            '{#TYPE}': 'totals',
            '{#OP_TYPE}': op_type
        });
    }

    else if (item.name === 'kubelet_runtime_operations_duration_seconds_bucket'){
        var labels = item.labels.operation_type + item.labels.le;

        if (lookup_histogram[labels]) {
            return;
        }
        lookup_histogram[labels] = 1;
        result.push({
            '{#TYPE}': 'buckets',
            '{#OP_TYPE}': item.labels.operation_type,
            '{#LE}': item.labels.le
        });
    }
});

return JSON.stringify(result);