C3 AI Documentation Home

Analyze Code Using the Action Profiler

The Action Profiler has been migrated from the legacy UI framework to React. The underlying functionality remains the same, but the interface has been rebuilt using React components, resulting in improved performance and visual consistency with the rest of the Data Fusion UI.

The action profiler helps an advanced developer diagnose code performance issues. An action is a task executed by a piece of code. You can drill into individual code execution actions and sub-actions to visualize statistics about how each action runs over time. You can expand tasks and sub-tasks as many times as needed. There is no limit to the number of levels you can drill into using the action profiler.

When to Use the Action Profiler

Use the Action Profiler to monitor and analyze action execution activity within your application. You can review execution history, inspect action performance metrics, and identify performance bottlenecks or execution failures during runtime.

Common use cases include:

  • identifying actions that are causing slow pipeline execution,

  • reviewing execution history for failed actions,

  • analyzing execution activity within a specific time range,

  • profiling actions in multi-node environments, and

  • troubleshooting intermittent ingestion or transformation failures.

For example, if a pipeline run completes slower than expected, you can use the Action Profiler histogram and execution history to identify which actions consumed the most execution time and isolate potential bottlenecks.

Selecting an action opens a panel with two visualization tabs:

  • Action profiler: A tree view of the action and its sub-actions.
  • Flame graph: A flame-graph view of the same action.

You can see the following data for actions and child actions:

  • T. Time — Total time it took for the action to complete
  • S. Time — Time spent in the action itself
  • T. CPU — CPU time
  • S. CPU — CPU time spent in the action itself
  • T. IO — Total IO time (SQL / Key Value Pairs / other input and output)
  • S. IO — Input/output time spent in the action itself
  • T. KV — Total key value time
  • S. KV — Key value store time spent 
  • T. SQL — Total SQL time
  • S. SQL — SQL time spent in the action itself

Aggregate the data by the following mathematical functions for each kind of action data:

  • Sum & Mean (the default)
  • Sum
  • Mean
  • Median
  • Maximum
  • Third quartile
  • 90th percentile

For example, you can choose to see the sum of the total time the action took to complete (T. Time), the mean of the total time the action took to complete, the mean of the total time it took the action to complete, etc.

You can change the format of the action data to:

  • Time
  • Time with ms
  • Seconds
  • Seconds with ms
  • Milliseconds

You can filter by type of action or for a specific timeframe.

Analyze code using the action profiler

Prerequisites:

  • Create an app with one or more actions
  • AppAdmin or higher permissions

To analyze code using the action profiler:

  1. In C3 AI Studio, navigate to Apps.
  2. Select an application, then navigate to Monitoring > Action Profiler.
  3. Search for the action you want to analyze.
  4. Select the action to open the Action profiler.

You can now see the actions in a tree view. You can expand each level in the tree view to see data for individual actions and sub-actions.

Updated UI enhancements

The updated Action Profiler UI includes the following enhancements:

Filter Panel Layout

The filter panel at the top of the page provides additional horizontal workspace and a streamlined layout for reviewing profiler results.

Interactive Histogram

The Action Profiler histogram displays action counts over time using fixed time intervals.

You can use the histogram to analyze execution activity within a selected time range. The histogram supports the following interactions:

  • Hover over a histogram bar to view the corresponding timestamp and action count.

  • Click and drag across the histogram to select a time range. The selected range automatically updates the date filters and refreshes the profiler results.

  • Use the interval dropdown to change the histogram interval granularity, such as auto, second, minute, hour, or day.

  • Toggle histogram visibility using the toolbar control.

If the selected interval would generate too many histogram buckets, the Action Profiler automatically scales the interval and displays a warning message.

Find actions

You can find currently running and past actions in the action profiler.

You can search completed actions by using C3 AI Types and actions.

You can change the format of the time measurement by selecting an option under Format. And you can set the aggregation type under Aggregation.

You can filter actions by:

  • Action type. Under Filter by, your options are:
    • Interesting actions
    • Root actions
    • All actions
  • Time the action ran under Timestamp

You can group actions in the list by:

  • Type/Action
  • Action
  • Individual actions

Change the format of the action data

You can change the format of the action data to:

  • Time
  • Time with ms
  • Seconds
  • Seconds with ms
  • Milliseconds

To change the format of the action data:

  1. In C3 AI Studio, navigate to Apps.
  2. Select an application, then navigate to Monitoring > Action Profiler.
  3. In the left nav, select the dropdown under Format and choose another format.

Actions display in the format you selected.

Visualizations

View actions in a tree view

To analyze code using the action profiler:

  1. In C3 AI Studio, navigate to Apps.
  2. Select an application, then navigate to Monitoring > Action Profiler.
  3. Search for the action you want to analyze.
  4. Select the action to open the Action profiler.

You can now see the actions in a tree view. You can expand each level in the tree view to see data for individual actions and sub-actions.

View actions in a flame graph

To analyze code using the action profiler:

  1. In C3 AI Studio, navigate to Apps.
  2. Select an application, then navigate to Monitoring > Action Profiler.
  3. Search for the action you want to analyze.
  4. Select the app to open the Action profiler.
  5. Select the Flame graph tab to see the flame graph.

Profile past root actions

The action profiler allows you to see data about past actions. See past actions by:

  1. In C3 AI Studio, navigate to Apps.
  2. Select an application, then navigate to Monitoring > Action Profiler.
  3. In Filter by, select Root actions.

Profile actions in a multi-node environment

If you application is running in a multi-node environment, all the actions listed are collected from all the nodes within your app.

Profile actions within your application

When you open action profiler in Studio, it only shows actions that belong to your application.

Examples

The following examples show how the action profiler displays a tree view and a flame graph for a set of sample code.

The following code shows an action with child actions you can turn on and off. When TestActionProfilerMain.mainAction() is set to false, this code prints “I love C3” in one action. When TestActionProfilerMain.mainAction() is set to true, this code prints “I love C3” in 3 child actions.

Type
type TestActionProfilerMain {
  mainAction: function(childAction: !boolean): string py-server
}
Python
def mainAction(cls, childAction):
    import time
    import random
    if childAction:
        a = c3.TestActionProfilerChild.childAction('I ')
        b = c3.TestActionProfilerChild.childAction('love ')
        c = c3.TestActionProfilerChild.childAction('C3 ')
        return a+b+c
    else:
        time.sleep(random.random())
        return "I love C3"
Type
type TestActionProfilerChild {
  childAction: function(input: !string): string py-server
}
Python
def childAction(cls, input):
    import time
    time.sleep(1)
    return input 

Example 1: Code with no child actions

When TestActionProfilerMain.mainAction() is set to false, the action profiler shows the actions and child actions in the flame graph. Expand all types for a drill down view of the action profiler.

Example 2: Code with child actions

When TestActionProfilerMain.mainAction() is set to true, the action profiler shows the actions in the code and the child actions in the flame graph.

You can drill down on the child actions to see what is happening at each stage of the code.

Was this page helpful?