@manthena2020 Thanks for sharing this, a quick glance suggests the code looks ok but as I mentioned above there are some changes you need to make to your environment/collector to get this working
Please raise a support request so we can work this through with you