skip to Main Content

I have a pipeline that will be shared by many functions
I want some MI around that:

  • What function ran the pipeline
  • How many times has function x called that pipeline

I was planning to provide a unique parameter to the functions that called my pipeline, then report passes and fails of the pipeline over x days based on that parameter.

I have used the DevOps dash and thought I could just insert a Query for it via a widget but it seems not. The pipeline Analytics are okay, but not what I want and I have to go into each pipeline individually to get the data – there has to be a better way. What am I missing, please?

Thanks

3

Answers


  1. Chosen as BEST ANSWER

    Thank you to everyone. am quite locked down so that I only have access to ADO not function apps or ADF/App insights etc.

    I have gone the API route - I am working on pulling out the param I passed in for the response I get when I hit the run api, that has everything I need. I have a request in for storage etc and I can build something a bit more useful then. Meantime this will do - thanks :)

    Maybe I will do the extends idea as we scale - cheers :)


  2. I think azure DevOps doesn’t have built-in features for tracking pipeline runs at the function level, but you can do this via custom solution, let me explain you a structure for you to work on.

    As you already mentioned, pass a unique parameter to the pipeline based on the function that calls it. this can be dobe by adding a parameter to your pipeline YAML file in the Azure DevOps portal.
    And Within your pipeline, use logging and telemetry to capture information about which function triggered the pipeline run.

    Within your pipeline, use logging and telemetry to capture info about which function triggered the pipeline run. This can be logged as part of your build process.
    Set up a system to collect and store the telemetry data. This could be a custom database, Azure Application Insights etc any stirage

    Then use Azure DevOps REST API to query and retrieve information about pipeline runs based on your custom parameters. You can use the API to filter runs and get details about each run. like a sample below

    GET https://dev.azure.com/{organization}/{project}/_apis/pipelines/{pipelineId}/runs?api-version=6.0&searchFilter=branchName:{your_custom_parameter}

    You can then link it with you’re azure monitor.

    I suggest you to visit Microsoft documentation, there you will find detailed info on how to create deploy etc, ill give u the link below

    https://learn.microsoft.com/en-us/search/?terms=DevOps%20REST%20API

    Login or Signup to reply.
  3. There is no built-in feature to list the pipeline result for the ones triggered by the function app.

    As an alternative, in your function app, you can use rest api Runs – Run Pipeline to trigger the target pipeline, you can transfer the function name or other info as parameters to target pipeline. You can check my answer here for your reference.

    In your target pipeline, use logging command to add the build tag, the tag name can be function name parameter transferred. You can add the task at the beginning of your pipeline to make sure it always runs even build will fail at last.

    - task: Bash@3
      inputs:
        targetType: 'inline'
        script: |
            echo "##vso[build.addbuildtag]${{ parameters.functionappname }}"
        displayName: 'Apply function name as build tag'
    

    Tag added:

    enter image description here

    Install extension Pipeline overview to filter the build as per tag in widget. so you can check which functionapp trigger the pipeline and how many time it triggered.

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search