import { Analytics } from 'analytics.do';
const workflowAnalytics = new Analytics({
workflowId: 'order-processing-workflow',
metrics: [
{ name: 'completion_rate', target: '98%' },
{ name: 'average_duration', target: '< 2 minutes' },
{ name: 'error_rate', target: '< 0.5%' },
{ name: 'cost_per_execution', target: '< $0.05' }
],
timeframe: 'daily',
notifications: true
});
async function runValidation() {
const results = await workflowAnalytics.validate();
console.log('Workflow Validation Results:', results);
// Example Result:
// {
// workflowId: 'order-processing-workflow',
// validationStatus: 'PASS',
// metrics: [
// { name: 'completion_rate', value: '98.5%', status: 'PASS' },
// { name: 'average_duration', value: '1 minute 45 seconds', status: 'PASS' },
// { name: 'error_rate', value: '0.4%', status: 'PASS' },
// { name: 'cost_per_execution', value: '$0.04', status: 'PASS' }
// ],
// timestamp: '2023-10-27T10:00:00Z'
// }
}
runValidation();