Search code examples
azureazure-devopsembeddedcicd

Posting and monitoring build metric from Azure pipeline to Azure DevOps


I have a following use case: Firmware for a microcontroller is build in Azure pipeline, I would like to monitor ROM and RAM memory usage (basically two numbers) on each build and be able to monitor overall trend from a chart somewhere in Azure DevOps (some dashboard probably). I can write a script to extract this data after build, but how to make it available in Azure DevOps?

What have I considered:

  • During build exporting required information to a file (JSON probably) and storing it as an artefact. Then posting it somehow to Azure DevOps (but where and how to post? What is the proper way to do it in Azure?)
  • Azure Pipelines has possibility to read test result format generated by CTest and publish them to Azure DevOps, so it might be possible to make somehow a custom Measuring test with CTest, but would Azure Pipelines/DevOps handle it properly and is it a right way to go?

Any other proposals are welcome!

Edit: Of course this would only be done for main protected branch, not every pipeline run.

Also, the pipeline builds different firmware configurations, each needs to be evaluated separately


Solution

  • I am afraid that there is no built-in Dashboard widget or Extension Dashboard widget can record and monitoring the build metric.

    We can use other Azure Services(e.g. Azure Monitor) or tools(PowerBI) to record data and generate reports, but they cannot be displayed in the Azure DevOps Dashboard.

    For a workaround, I suggest that you can use Azure DevOps Work item to record the ROM and RAM data and then you can use query to filter the work items to generate chart.

    Here are the steps:

    Step1: Create a New Worm item type in Organization Settings -> Processes and add custom fields(e.g. ROM and RAM) to the new work item type.

    Step2: When you running the Pipeline, you can create a new work item for each build(use Rest API: Create work item or extension: Create work item ) and set the value to the work item field.

    For example:

    enter image description here

    Step3: Create and run the Query in Boards -> Queries to filter related work items and set the fields in the query column.

    for example:

    enter image description here

    Step4: You can create the chart in Query/Dashboard based on the query result. Refer to this doc: Example query charts

    For example:

    enter image description here

    Since this is a workaround, it will have limitations.

    I can fully understand your requirement. You can submit a suggest ticket in the site: Developer Community to report this feature.

    Hope there will be an official Dashboard widget in the future that can directly implement this function.