How To
How to Clear the Swimlane Usage Metrics
resetting the swimlane usage metrics is available in the swimlane health & maintenance operations application however, having the following manual method to reset the data using a python script is also helpful when troubleshooting using mongodb connect to the mongodb using the mongo shell or a tool like robo3t and run the following query use swimlane; db usageentryaggregates remove({}) using python script description create the following script inputs in your task swimlane api pat mongoserver mongoport mongouser # for the swimlane database mongopass # for the swimlane database database = swimlane collection = usageentryaggregates task = reset usage metrics note for a standalone deployment, remove line number 16 below from the code (replicaset='rs0',) from pymongo import mongoclient from swimlane import swimlane import pendulum import ssl \#connect to swimlane swimlane = swimlane(sw context config\['internalswimlaneurl'], access token=sw context inputs\['swimlane api pat'], verify ssl=false) \#connect to mongo def connect to mongo(swimlane auth source) connectionparams = mongoclient(host=sw context inputs\['mongoserver'], port=int(sw context inputs\['mongoport']), username=sw context inputs\['mongouser'], password=sw context inputs\['mongopass'], authsource=swimlane auth source, replicaset='rs0', authmechanism='scram sha 1', ssl=true, ssl cert reqs=ssl cert none) return connectionparams \#set database & auth to swimlane or swimlanehistory from workflow action set field swimlane auth source = swimlane database = sw context inputs\['database'] \#retrieve collection from workflow action set field collection name = sw context inputs\['collection'] try if swimlane auth source and collection name and sw context inputs\['task'] == 'reset usage metrics' db = connect to mongo(swimlane auth source)\[swimlane database] collection = db\[collection name] resetusagemetrics = collection delete many({}) sw outputs = \[{'deleted count' resetusagemetrics deleted count}] except exception as e print(e)