How can we detect an increase in Throughput Units (TUs) when Auto-Inflate is enabled for an Azure Event Hub namespace?

Bharata, Swapnil 0 Reputation points
2025-02-06T06:20:11.0666667+00:00

Hi,

I am deploying Azure Event Hub using the Azurerm Terraform provider and have also configured several alerts, such as highIncomingBytes and highEventHubSize. The threshold values for these alerts are based on the number of Throughput Units (TUs) assigned to the Event Hub.

However, since Auto-Inflate is enabled, the TUs can increase automatically based on demand. In such cases, the alert thresholds should also be dynamically adjusted according to the current TU value.

I would like to understand how I can detect changes in TU count, retrieve the correct value, and update the alert thresholds accordingly when deploying via Terraform.

Your guidance on this would be greatly appreciated.

Thank you for your time and support.

Azure Event Hubs
Azure Event Hubs
An Azure real-time data ingestion service.
688 questions
0 comments No comments
{count} votes

Accepted answer
  1. Smaran Thoomu 19,955 Reputation points Microsoft Vendor
    2025-02-06T14:51:09.0833333+00:00

    Hi @Bharata, Swapnil

    Welcome to Microsoft Q&A platform and thanks for posting your query here.
    To detect changes in the number of Throughput Units (TUs) and dynamically adjust your alert thresholds when Auto-Inflate is enabled for an Azure Event Hub namespace, you can follow these steps:

    1. Monitor Throughput Units Using Azure Metrics: Azure provides a metric called Throughput Unit under the Event Hub namespace monitoring. You can track this metric to observe changes in TU usage. This metric reflects the current number of TUs assigned to the namespace, including any changes due to Auto-Inflate.
    2. Retrieve Current TU Count Programmatically: Use Azure Monitor REST API or Azure CLI to query the Throughput Unit metric in near real-time. Alternatively, you can leverage the Azure Terraform provider's azurerm_monitor_metric_alert to capture the metric data and build custom workflows.
    3. Update Terraform Alert Thresholds Dynamically: Unfortunately, Terraform does not support dynamic metric-based configurations out of the box. However, you can achieve this by:

    -Integrating a scripting mechanism (e.g., a Python script or Azure Function) that fetches the current TU count via Azure Monitor API.

    -Use this script to calculate and update the alert thresholds dynamically based on the TU value.

    -Re-run the Terraform configuration to apply the updated thresholds.

    1. Consider Using Log Analytics or Alerts with Azure Monitor: Instead of manually adjusting alert thresholds, you can use dynamic thresholds in Azure Monitor. Dynamic thresholds automatically adjust based on historical data trends and might reduce the need for manual intervention.

    Reference: https://learn.microsoft.com/en-us/azure/event-hubs/event-hubs-auto-inflate?source=recommendations

    https://learn.microsoft.com/en-us/azure/event-hubs/event-hubs-scalability?source=recommendations

    Hope this helps. Do let us know if you any further queries.


    If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.