# <a id="bitdrift.public.unary.workflows.v1.ActionRule"></a>ActionRule

**Source definition:** [`src/bitdrift/public/unary/workflows/v1/workflow.proto#L1292-L1321`](<https://github.com/bitdriftlabs/api/blob/main/src/bitdrift/public/unary/workflows/v1/workflow.proto#L1292-L1321>)

An action rule defines workflow output or side-effect behavior such as charts, session capture,
 or tracing.

<section class="proto-fields-table" markdown>
| Field | Type | Description |
|---|---|---|
| rule_id | <span class="proto-type proto-type-primitive">string</span><br><em class="proto-field-annotation">between 1 and 100 chars</em> | ID of this action rule. Must be unique within the workflow. Other APIs may refer to this ID,  and some actions also reference it. For example, chart and flush actions can refer to the  `rule_id` of a measure time action. |
| metric_chart_rule | <span class="proto-type proto-type-message">[<i class="proto-type-part">bitdrift</i><i class="proto-type-dot">.</i><i class="proto-type-part">public</i><i class="proto-type-dot">.</i><i class="proto-type-part">unary</i><i class="proto-type-dot">.</i><i class="proto-type-part">workflows</i><i class="proto-type-dot">.</i><i class="proto-type-part">v1</i><i class="proto-type-dot">.</i><i class="proto-type-part">Rule</i><i class="proto-type-dot">.</i><i class="proto-type-part">RuleMetricChartConfiguration</i>](bitdrift_public_unary_workflows_v1_Rule.md "bitdrift.public.unary.workflows.v1.Rule.RuleMetricChartConfiguration")</span><span class="proto-field-annotation">only one of <em>metric_chart_rule</em>, or <em>flush_rule</em>, <em>funnel_rule</em>, <em>sankey_diagram_rule</em>, <em>measure_time_rule</em>, <em>start_tracing_rule</em> can be set</span> | Emits one or more time series that are rendered as a chart. |
| flush_rule | <span class="proto-type proto-type-message">[<i class="proto-type-part">bitdrift</i><i class="proto-type-dot">.</i><i class="proto-type-part">public</i><i class="proto-type-dot">.</i><i class="proto-type-part">unary</i><i class="proto-type-dot">.</i><i class="proto-type-part">workflows</i><i class="proto-type-dot">.</i><i class="proto-type-part">v1</i><i class="proto-type-dot">.</i><i class="proto-type-part">Rule</i><i class="proto-type-dot">.</i><i class="proto-type-part">RuleFlushConfiguration</i>](bitdrift_public_unary_workflows_v1_Rule.md "bitdrift.public.unary.workflows.v1.Rule.RuleFlushConfiguration")</span><span class="proto-field-annotation">only one of <em>flush_rule</em>, or <em>metric_chart_rule</em>, <em>funnel_rule</em>, <em>sankey_diagram_rule</em>, <em>measure_time_rule</em>, <em>start_tracing_rule</em> can be set</span> | Triggers session capture by flushing buffered logs for the current session. |
| funnel_rule | <span class="proto-type proto-type-message">[<i class="proto-type-part">bitdrift</i><i class="proto-type-dot">.</i><i class="proto-type-part">public</i><i class="proto-type-dot">.</i><i class="proto-type-part">unary</i><i class="proto-type-dot">.</i><i class="proto-type-part">workflows</i><i class="proto-type-dot">.</i><i class="proto-type-part">v1</i><i class="proto-type-dot">.</i><i class="proto-type-part">Rule</i><i class="proto-type-dot">.</i><i class="proto-type-part">RuleFunnelConfiguration</i>](bitdrift_public_unary_workflows_v1_Rule.md "bitdrift.public.unary.workflows.v1.Rule.RuleFunnelConfiguration")</span><span class="proto-field-annotation">only one of <em>funnel_rule</em>, or <em>metric_chart_rule</em>, <em>flush_rule</em>, <em>sankey_diagram_rule</em>, <em>measure_time_rule</em>, <em>start_tracing_rule</em> can be set</span> | Produces a funnel chart across ordered match rules in a single flow. |
| sankey_diagram_rule | <span class="proto-type proto-type-message">[<i class="proto-type-part">bitdrift</i><i class="proto-type-dot">.</i><i class="proto-type-part">public</i><i class="proto-type-dot">.</i><i class="proto-type-part">unary</i><i class="proto-type-dot">.</i><i class="proto-type-part">workflows</i><i class="proto-type-dot">.</i><i class="proto-type-part">v1</i><i class="proto-type-dot">.</i><i class="proto-type-part">Rule</i><i class="proto-type-dot">.</i><i class="proto-type-part">RuleSankeyDiagramConfiguration</i>](bitdrift_public_unary_workflows_v1_Rule.md "bitdrift.public.unary.workflows.v1.Rule.RuleSankeyDiagramConfiguration")</span><span class="proto-field-annotation">only one of <em>sankey_diagram_rule</em>, or <em>metric_chart_rule</em>, <em>flush_rule</em>, <em>funnel_rule</em>, <em>measure_time_rule</em>, <em>start_tracing_rule</em> can be set</span> | Produces a Sankey diagram across match rules in a single flow. |
| measure_time_rule | <span class="proto-type proto-type-message">[<i class="proto-type-part">bitdrift</i><i class="proto-type-dot">.</i><i class="proto-type-part">public</i><i class="proto-type-dot">.</i><i class="proto-type-part">unary</i><i class="proto-type-dot">.</i><i class="proto-type-part">workflows</i><i class="proto-type-dot">.</i><i class="proto-type-part">v1</i><i class="proto-type-dot">.</i><i class="proto-type-part">Rule</i><i class="proto-type-dot">.</i><i class="proto-type-part">RuleMeasureTime</i>](bitdrift_public_unary_workflows_v1_Rule.md "bitdrift.public.unary.workflows.v1.Rule.RuleMeasureTime")</span><span class="proto-field-annotation">only one of <em>measure_time_rule</em>, or <em>metric_chart_rule</em>, <em>flush_rule</em>, <em>funnel_rule</em>, <em>sankey_diagram_rule</em>, <em>start_tracing_rule</em> can be set</span> | Measures elapsed time between two match rules in a flow and can feed other actions. |
| start_tracing_rule | <span class="proto-type proto-type-message">[<i class="proto-type-part">bitdrift</i><i class="proto-type-dot">.</i><i class="proto-type-part">public</i><i class="proto-type-dot">.</i><i class="proto-type-part">unary</i><i class="proto-type-dot">.</i><i class="proto-type-part">workflows</i><i class="proto-type-dot">.</i><i class="proto-type-part">v1</i><i class="proto-type-dot">.</i><i class="proto-type-part">RuleStartTracing</i>](bitdrift_public_unary_workflows_v1_RuleStartTracing.md "bitdrift.public.unary.workflows.v1.RuleStartTracing")</span><span class="proto-field-annotation">only one of <em>start_tracing_rule</em>, or <em>metric_chart_rule</em>, <em>flush_rule</em>, <em>funnel_rule</em>, <em>sankey_diagram_rule</em>, <em>measure_time_rule</em> can be set</span> | Starts trace sampling for the current session when the referenced match rule fires. |

</section>
<p class="h4">Example</p>
```json
{
  "metric_chart_rule": {
    "time_series": [
      {
        "aggregated_id": "count/fkQ1PfAZhdYvJexzY6DYuoYCZTEaWO0Y7spxwjr7akc",
        "rate": {
          "denominator": {
            "match_id": "_i1yUnHjKfmWpCaD5Tazo",
            "name": "field_name"
          },
          "denominator_id": "fkQ1PfAZhdYvJexzY6DYuoYCZTEaWO0Y7spxwjr7akc",
          "group_by": {
            "values": [
              {
                "log_body": false
              }
            ]
          },
          "numerator": {
            "match_id": "_i1yUnHjKfmWpCaD5Tazo",
            "name": "field_name"
          },
          "numerator_id": "fkQ1PfAZhdYvJexzY6DYuoYCZTEaWO0Y7spxwjr7akc"
        },
        "track_unique": {
          "device_id": true
        }
      }
    ]
  },
  "rule_id": "_i1yUnHjKfmWpCaD5Tazo"
}
```

