Welcome to Zuora Product Documentation

Explore our rich library of product information

Create and publish a metric

Learn how to create a billable metric that aggregates usage events, publish the metric to an event source, and uses the generated ingestion URL to track entitlement usage.

Create a meter when usage data must be aggregated and used to update an entitlement balance.

A meter defines how Zuora receives and processes usage events. When you configure a meter, specify the event type or event definition, the computed property used to measure consumption, and the aggregation behavior. A meter can aggregate storage consumption events by summing the reported quantity and measuring the result in gigabytes.

To create and publish a metric:

  1. Navigate to Products > Catalog.
  2. Click Manage Metrics.

    The Billable Metrics page displays:

    • A list of existing billable metrics.

    • A metric card for each billable metric, showing the metric name, status, metric type, event, aggregation method, grouping key, and processing steps.

    • Manage Connections, which lets you configure event source connections used by billable metrics.

    • New Metric, which lets you create a billable metric.

    The billable metrics displayed on the page reflect the data in your tenant. Metric names, event names, aggregation methods, grouping keys, and status values shown in the UI are examples and can vary.
  3. Click New Metric.
  4. Enter the following details:

    Field

    Description

    NameEnter a unique name to identify the billable metric. Use a descriptive name that identifies the usage being measured, such as api_calls_total or storage_consumption.
    DescriptionEnter an optional description of what the billable metric measures, such as total storage consumed in GB.
    Event TypesSelect an existing event type or create a new one. The selected event type defines the events that the metric processes to calculate usage.
    FiltersAdd one or more filters to include only events that meet the specified criteria when calculating the metric.If no filters are configured, all events that match the selected event types are eligible.
    Computed PropertiesDefine derived properties by applying expressions to fields in the incoming event data. You can use computed properties as inputs for metric aggregation. Add a computed property when the meter needs to derive the value to be measured, such as tokens consumed or quantity used.

    Aggregation Type

    Select how event data is aggregated to calculate the metric. Supported aggregation types include Count, Sum, Max, Min, Count Distinct, Last Value, Percentile, and Formula.
    Group KeysSelect one or more event properties to group events before aggregation. Use group keys when measurements must be calculated separately for a customer, account, subscription, device, or another dimension.
  5. Click Save.
  6. Click Publish to publish the billable metric.
  7. In the Publish metric dialog, select the event source.

    Streaming API - Receives events through the Streaming API.

    Amazon S3 - Receives events from files uploaded to an Amazon S3 bucket.

  8. In the Event Mapping section, map the incoming event field that identifies the customer (for example, customer_id) to the appropriate Zuora reference field, such as Account.AccountNumber or Account.Id.
  9. If required, click Add Field Mapping to map additional event fields.
  10. Click Publish.

Zuora generates a unique ingestion URL for the billable metric.

After the metric is published:

  • Use the ingestion URL to send usage events to Zuora through the Streaming API or your integration.

  • Use the sample event payload generated for the metric as the request body template. Replace the sample customer identifier with the appropriate customer account ID or account number before sending events.

  • Associate the published billable metric with a metered feature to begin tracking entitlement usage.

For Streaming API source behavior, prerequisites, request formats, volume limits, and troubleshooting, see Streaming API as a source and Ingest usage events for a meter.