Skip to content

Tracing Feature#7

Merged
nassor merged 10 commits intomainfrom
feature/tracing
Aug 5, 2025
Merged

Tracing Feature#7
nassor merged 10 commits intomainfrom
feature/tracing

Conversation

@nassor
Copy link
Copy Markdown
Owner

@nassor nassor commented Aug 5, 2025

  • ✨ New tracing Feature:

    • Integrated the tracing library to provide detailed observability into workflow execution.
    • Added with_tracing_span methods to Workflow and ConcurrentWorkflow to allow users to attach custom tracing spans.
    • Instrumented key components for detailed logging:
      • Workflow: Orchestration lifecycle (start, completion, state transitions).
      • Node: Execution phases (prep, exec, post) and retry attempts.
      • Task: Execution and retry logic.
      • Scheduler: Scheduled and concurrent workflow executions.
    • Added a new tracing_demo example to showcase the latest capabilities.
    • Added tracing_tests to validate the integration.
  • 📦 Optional Scheduler:

    • The scheduler module is now an optional feature. To use it, enable the scheduler feature in Cargo.toml.
    • This reduces the core library's dependencies for users who do not require scheduling.
    • Updated scheduler-related examples to use required-features = ["scheduler"].
  • 🔧 Build & Configuration:

    • Added tracing, scheduler, and all feature flags to Cargo.toml.
    • Updated tokio dependencies to be more granular, reducing unused features for minimal builds.
    • Updated README.md with detailed documentation for the new features and how to enable them.

How to Use the tracing Feature

  1. Enable the feature in Cargo.toml:

    [dependencies]
    cano = { version = "0.5", features = ["tracing"] }
    tracing = "0.1"
    tracing-subscriber = "0.3"
  2. Initialize a tracing subscriber:

    use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
    
    tracing_subscriber::registry()
        .with(tracing_subscriber::EnvFilter::from_default_env())
        .with(tracing_subscriber::fmt::layer())
        .init();
  3. Attach a custom span to a workflow:

    use cano::prelude::*;
    use tracing::info_span;
    
    let workflow_span = info_span!("my_workflow", user_id = "123");
    let mut workflow = Workflow::new(MyState::Start)
        .with_tracing_span(workflow_span);

All operations within the workflow will now be traced under the provided span, offering rich, structured logs for debugging and monitoring.

This PR significantly improves the library's utility for building robust, observable, and modular applications.

Copilot AI review requested due to automatic review settings August 5, 2025 16:21
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a comprehensive tracing feature to the Cano workflow library and makes the scheduler module optional. The tracing integration provides detailed observability into workflow execution using the tracing library, while the optional scheduler reduces core dependencies for users who don't need scheduling capabilities.

  • Integrated the tracing library with custom span support for workflows and concurrent workflows
  • Added optional tracing instrumentation to all key components (workflows, nodes, tasks, scheduler)
  • Made the scheduler module optional behind a scheduler feature flag
  • Added granular feature flags (tracing, scheduler, all) for better dependency management

Reviewed Changes

Copilot reviewed 15 out of 16 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/workflow.rs Added tracing span support and instrumentation to Workflow and ConcurrentWorkflow
src/tracing_tests.rs New test module for validating tracing integration functionality
src/task.rs Added tracing instrumentation to task execution and retry logic
src/scheduler.rs Added tracing to scheduler workflow executions with workflow context
src/node.rs Added detailed tracing to node execution phases (prep, exec, post)
src/lib.rs Made scheduler module optional and updated public API exports
examples/tracing_demo.rs New comprehensive example demonstrating tracing capabilities
examples/scheduler_*.rs Added feature gates to scheduler examples
README.md Updated documentation with tracing usage and feature flag information
Cargo.toml Added feature flags and optional dependencies

Comment thread src/workflow.rs Outdated
Comment thread src/scheduler.rs
Comment thread src/node.rs Outdated
Comment thread examples/tracing_demo.rs Outdated
@nassor nassor merged commit 664aa80 into main Aug 5, 2025
5 checks passed
@nassor nassor deleted the feature/tracing branch August 5, 2025 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants