Cost profiling stages

Jenkins setup:
Jenkins version 2.401.3

Hi,
I have several pipelines running.
Each pipeline can have multiple stages.
Each of which can run on a different agent.

My agents are Virtual Machines inside azure.

I want to present data in form of graphs about what pipelines are most expansive as in: time it takes, what type of agents did it run on, how long a particular agent was used by pipeline or its stages.

Does anyone have already set such a thing up ?

One way I could think of, was to send information at the end of each job to an external database. I am guessing, job has all the necessary information but in this case, I will have to run call my function in each jenkinsfile.

Any suggestions are welcome.

Thanks for reading.

That seems like a very good case for OpenTelemetry exporting data from your Jenkins controller to a monitoring package. Darin Pope created a video on Jenkins Pipeline tracing with Jaeger.

Hi Mark,
Thanks for prompt reply. I have never used telemetry and Jaeger but it seems interesting. I will give it a go and share my findings here if I succeed.
Thanks once again for the lead.