I have a .NET Framework ASP.NET WebAPI running under IIS. For this application I would like it to report performance counter values as metrics to an OpenTelemetry Collector. The challenge is how I can construct the instance name at runtime when running under IIS. I see from the simple sample how this can be done, but I don't see how I can achieve the same from a running WebAPI application (one among several other WebAPI applications on the same machine).
When I open PerfMon in Windows I see the instance name being similar to this:
_lm_w3svc_1_root_aaaa_bbbb-w...[12100,2]. I have not found a way to construct this instance name at runtime.