Module metrics_export

Module metrics_export 

Source
Expand description

Metrics Export - Export workflow metrics to monitoring systems

This module provides functionality to export workflow execution metrics to popular monitoring formats like Prometheus and OpenTelemetry.

§Example

use oxify_model::{
    WorkflowAnalytics, MetricsExporter, ExportFormat,
    ExecutionStats, PerformanceMetrics, AnalyticsPeriod, PeriodType
};
use chrono::Utc;
use uuid::Uuid;

// Create analytics data
let analytics = WorkflowAnalytics {
    workflow_id: Uuid::new_v4(),
    workflow_name: "my_workflow".to_string(),
    period: AnalyticsPeriod {
        start: Utc::now(),
        end: Utc::now(),
        period_type: PeriodType::Daily,
    },
    execution_stats: ExecutionStats::default(),
    performance_metrics: PerformanceMetrics::default(),
    node_analytics: vec![],
    error_patterns: vec![],
    updated_at: Utc::now(),
};

// Export to Prometheus format
let exporter = MetricsExporter::new("my_workflow");
let prometheus_output = exporter.export_prometheus(&analytics)?;
println!("{}", prometheus_output);

// Export to OpenTelemetry JSON format
let otel_output = exporter.export_opentelemetry(&analytics)?;
println!("{}", serde_json::to_string_pretty(&otel_output)?);

Structs§

MetricsExporter
Metrics exporter for workflow analytics

Enums§

ExportFormat
Export format for metrics
MetricsError
Errors that can occur during metrics export