CareflowDocumentation

Funnel Logs

Last Updated: June 15, 2026


Funnel logging is N/A at the moment for AI Applications running on Careflow, so AI App developers can skip this section. (The feature is implemented and initialized in the library; this note reflects platform/back-end availability — verify whether the Grafana/Loki funnel back-end is enabled for your deployment before relying on it.)

Initialization

  • The careflow.funnel object is automatically initialized during container startup (FunnelService()).
  • No additional configuration is required; it uses instance.ID from the config and generates a per-run uuid.
  • The logs are emitted to the standard logger (tagged for Loki) and surfaced in Grafana.

Available Methods

1. careflow.funnel.start(input_data)

Logs the start of a process. Sets status='started' and started_on (UTC).

  • Input: Dictionary containing optional keys: source_script, task_name, version, number_of_items_at_start, transaction_object, key_mapping, parameters.

2. careflow.funnel.process(input_data)

Logs processing updates. Sets status=processing'.

  • Input: Dictionary containing optional keys: number_of_items_at_start, number_of_items_processed, transaction_object, key_mapping, parameters.

3. careflow.funnel.end(input_data)

Logs successful completion. Sets status='completed' and completed_on (UTC).

  • Input: Dictionary containing optional keys: number_of_items_at_end, transaction_object, key_mapping, parameters.

4. careflow.funnel.fail(input_data)

Logs a failure event. Sets status='failed' and completed_on (UTC). Emits two log lines: a transaction line (status) and a separate error_detail line (item / stack_trace / description).

  • Input: Dictionary containing optional keys: number_of_items_at_end, transaction_object, key_mapping, parameters, item, stack_trace, description.

5. careflow.funnel.message(message)

Logs custom, free-form messages with funnel traceability.

  • Input: message (str): A custom message string to log.

Note: the service also defines internal subscribe_log() / publish_log() helpers used by the broker layer. These are not intended for direct use by model developers.

Logging Format

Transaction Logs

plaintext
[loki-funnel][model_transaction] instance_id=<instance UUID> uuid=<funnel UUID> <key=value pairs>

Error Logs

plaintext
[loki-funnel][model_transaction_log] instance_id=<instance UUID> uuid=<funnel UUID> <error details>

Message Logs

plaintext
[loki-funnel][model_transaction_log] instance_id=<instance UUID> uuid=<funnel UUID> <custom message>

Example Workflow

Start Process

python
careflow.funnel.start({
    "source_script": "example.py",
    "task_name": "LoadData",
    "number_of_items_at_start": 100
})

Process Items

python
careflow.funnel.process({
    "number_of_items_processed": 50
})

Complete Process

python
careflow.funnel.end({
    "number_of_items_at_end": 100
})

Log failure

python
careflow.funnel.fail({
    "item": "Item42",
    "description": "Unexpected error occurred",
    "stack_trace": "Traceback..."
})

Custom Message

python
careflow.funnel.message("Processing delay encountered.")